Skip to content

Commit a51c1ef

Browse files
Add failing regression test for #[link="dl"]
1 parent 42b384e commit a51c1ef

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

tests/ui/attributes/link-dl.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Regression test for an issue discovered in https://github.com/rust-lang/rust/pull/143193/files and rediscovered in https://github.com/rust-lang/rust/issues/147254#event-20049906781
2+
// This tests
3+
4+
#[link="dl"]
5+
//~^ ERROR valid forms for the attribute are
6+
//~| WARN previously accepted
7+
extern "C" { }
8+
9+
fn main() {}

tests/ui/attributes/link-dl.stderr

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error[E0539]: malformed `link` attribute input
2+
--> $DIR/link-dl.rs:4:1
3+
|
4+
LL | #[link="dl"]
5+
| ^^^^^^^^^^^^ expected this to be a list
6+
|
7+
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>
8+
help: try changing it to one of the following valid forms of the attribute
9+
|
10+
LL - #[link="dl"]
11+
LL + #[link(name = "...")]
12+
|
13+
LL - #[link="dl"]
14+
LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]
15+
|
16+
LL - #[link="dl"]
17+
LL + #[link(name = "...", kind = "dylib|static|...")]
18+
|
19+
LL - #[link="dl"]
20+
LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]
21+
|
22+
= and 1 other candidate
23+
24+
error: aborting due to 1 previous error
25+
26+
For more information about this error, try `rustc --explain E0539`.

0 commit comments

Comments
 (0)