Skip to content

Commit 9a2d310

Browse files
committed
regression test for lint attrs parsing ICE
1 parent 15ce924 commit 9a2d310

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Regression test for #154800 and #154847
2+
//@ compile-flags: --crate-type=lib
3+
4+
#[expect]
5+
//~^ ERROR malformed
6+
#[cfg(false)]
7+
fn main() {
8+
let _ : fn(#[expect[]] i32);
9+
//~^ ERROR wrong meta list delimiters
10+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
error[E0539]: malformed `expect` attribute input
2+
--> $DIR/malformed-expect.rs:4:1
3+
|
4+
LL | #[expect]
5+
| ^^------^
6+
| |
7+
| expected this to be a list
8+
|
9+
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes>
10+
help: try changing it to one of the following valid forms of the attribute
11+
|
12+
LL | #[expect(lint1)]
13+
| +++++++
14+
LL | #[expect(lint1, lint2, ...)]
15+
| +++++++++++++++++++
16+
LL | #[expect(lint1, lint2, lint3, reason = "...")]
17+
| +++++++++++++++++++++++++++++++++++++
18+
19+
error: wrong meta list delimiters
20+
--> $DIR/malformed-expect.rs:8:24
21+
|
22+
LL | let _ : fn(#[expect[]] i32);
23+
| ^^
24+
|
25+
help: the delimiters should be `(` and `)`
26+
|
27+
LL - let _ : fn(#[expect[]] i32);
28+
LL + let _ : fn(#[expect()] i32);
29+
|
30+
31+
error: aborting due to 2 previous errors
32+
33+
For more information about this error, try `rustc --explain E0539`.

0 commit comments

Comments
 (0)