-
Couldn't load subscription status.
- Fork 13.9k
Description
Code
I tried this code:
#![allow(ill_formed_attribute_input)]
#[link="dl"]
unsafe extern "C" {
pub fn foo();
}I expected the code to compile, since I allowed the FCW. Instead, it caused the following hard error:
error[E0539]: malformed `link` attribute input
--> src/lib.rs:3:1
|
3 | #[link="dl"]
| ^^^^^^^^^^^^ expected this to be a list
|
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>
help: try changing it to one of the following valid forms of the attribute
|
3 - #[link="dl"]
3 + #[link(name = "...")]
|
3 - #[link="dl"]
3 + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]
|
3 - #[link="dl"]
3 + #[link(name = "...", kind = "dylib|static|...")]
|
3 - #[link="dl"]
3 + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]
|
= and 1 other candidate
For more information about this error, try `rustc --explain E0539`.
This affects old versions of the winit crate. According to the crater run (in which this issue was discovered), this affects at least 450 crates that depend on winit.
This presumably regressed in #143193. CC @JonathanBrouwer
As per T-lang decision, this code should have caused a "deny-by-default FCW (that reports in dependencies)", not a hard error that can't be silenced.
The issue for the FCW is seemingly #57571.
I have not yet tested the behavior of this in dependencies.
Version it worked on
Stable rust 1.90.0 on the playground.
Version with regression
1.91.0-beta.4 (2025-09-27 aa7859c0dec2de6c9cab) on the playground