-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
Labels
A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-langRelevant to the language teamRelevant to the language team
Description
The following code gives compiler error.
unsafe extern "C" {
static WORLD: &str;
}error[E0106]: missing lifetime specifier
--> src\bin\runner.rs:6:24
|
6 | static WORLD: &str;
| ^ expected named lifetime parameter
For more information about this error, try `rustc --explain E0106`.
error: could not compile `extern_test` (bin "runner") due to 1 previous error
What I expected: The compiler should automatically infer the lifetime of WORLD as 'static.
The bug is still there in nightly toolchain.
P.S. The imported library is a rust cdylib compiled together (and with the same compiler version).
Metadata
Metadata
Assignees
Labels
A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-langRelevant to the language teamRelevant to the language team