Closed Bug 1790748 Opened 3 years ago Closed 3 years ago

libudev-sys should implement Send trait

Categories

(Core :: DOM: Web Authentication, defect, P1)

Unspecified
All
defect

Tracking

()

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: m_kato, Assigned: m_kato)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

When adding a crate in mozilla-central that uses lazy_static with spin_no_std, we cannot compile libudev-sys in dom/webauthn/libudev-sys.

 0:18.61    Compiling libudev-sys v0.1.3 (/mozilla/mozilla-central/dom/webauthn/libudev-sys)
 0:19.28 error[E0277]: `*mut c_void` cannot be sent between threads safely
 0:19.28   --> dom/webauthn/libudev-sys/src/lib.rs:78:1
 0:19.28    |
 0:19.29 78 | / lazy_static! {
 0:19.29 79 | |   static ref LIBRARY: Library = {
 0:19.29 80 | |     Library::open("libudev.so.1")
 0:19.29 81 | |   };
 0:19.29 82 | | }
 0:19.29    | |_^ `*mut c_void` cannot be sent between threads safely
 0:19.29    |
 0:19.29    = help: within `Library`, the trait `Send` is not implemented for `*mut c_void`
 0:19.29 note: required because it appears within the type `Library`
 0:19.29   --> dom/webauthn/libudev-sys/src/lib.rs:50:8
 0:19.29    |
 0:19.29 50 | struct Library(*mut c_void);
 0:19.29    |        ^^^^^^^
 0:19.29    = note: required because of the requirements on the impl of `Sync` for `spin::once::Once<Library>`
 0:19.29    = note: required because it appears within the type `lazy_static::lazy::Lazy<Library>`
 0:19.29    = note: shared static variables must have a type that implements `Sync`
 0:19.29    = note: this error originates in the macro `__lazy_static_create` (in Nightly builds, run with -Z macro-backtrace for more info)
 0:19.29 error[E0277]: `*mut c_void` cannot be sent between threads safely
 0:19.29    --> dom/webauthn/libudev-sys/src/lib.rs:124:1
 0:19.29     |
 0:19.29 124 | define!(udev_new, extern "C" fn () -> *mut udev);
 0:19.29     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*mut c_void` cannot be sent between threads safely
 0:19.29     |
 0:19.29     = help: within `Symbol<extern "C" fn() -> *mut udev>`, the trait `Send` is not implemented for `*mut c_void`
 0:19.29 note: required because it appears within the type `Symbol<extern "C" fn() -> *mut udev>`
 0:19.29    --> dom/webauthn/libudev-sys/src/lib.rs:84:12
 0:19.29     |
 0:19.29 84  | pub struct Symbol<T> {
 0:19.29     |            ^^^^^^
 0:19.29     = note: required because of the requirements on the impl of `Sync` for `spin::once::Once<Symbol<extern "C" fn() -> *mut udev>>`
 0:19.29     = note: required because it appears within the type `lazy_static::lazy::Lazy<Symbol<extern "C" fn() -> *mut udev>>`
 0:19.29     = note: shared static variables must have a type that implements `Sync`
 0:19.29     = note: this error originates in the macro `__lazy_static_create` (in Nightly builds, run with -Z macro-backtrace for more info)
...

ICU4X uses lazy_static with spin_no_std, so when adding it, this issue occurs.

Blocks: icu4x

When adding a crate in mozilla-central that uses lazy_static with spin_no_std,
we cannot compile libudev-sys in dom/webauthn/libudev-sys.

lazy_static might require Send trait for some struct, so we should add it.

Attachment #9294587 - Attachment description: WIP: Bug 1790748 - Add Send trait implementation in libudev-sys. → Bug 1790748 - Add Send trait implementation in libudev-sys. r=dveditz

The severity field is not set for this bug.
:rmf, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(bugs)
Severity: -- → S2
Flags: needinfo?(bugs)
Priority: -- → P1
Pushed by m_kato@ga2.so-net.ne.jp: https://hg.mozilla.org/integration/autoland/rev/cbab48d429cc Add Send trait implementation in libudev-sys. r=dveditz
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: