diff options
| author | Jana Dönszelmann <jana@donsz.nl> | 2025-08-23 19:42:14 +0200 |
|---|---|---|
| committer | Jana Dönszelmann <jana@donsz.nl> | 2025-08-24 09:20:57 +0200 |
| commit | 48a4e2d2dde8d68e1d00d3eac07b2c6155f3239d (patch) | |
| tree | 21e4c65b03513947890bc1bd38947a7c0ba75f68 /tests | |
| parent | 59ceb02d65f13a20d29422f4d923ecde429d4c0c (diff) | |
| download | rust-48a4e2d2dde8d68e1d00d3eac07b2c6155f3239d.tar.gz rust-48a4e2d2dde8d68e1d00d3eac07b2c6155f3239d.zip | |
fix ICE on stable related to attrs on macros
Diffstat (limited to 'tests')
5 files changed, 46 insertions, 1 deletions
diff --git a/tests/ui/lint/unused/concat-in-crate-deprecated-issue-137687.rs b/tests/ui/lint/unused/concat-in-crate-deprecated-issue-137687.rs new file mode 100644 index 00000000000..22dd55f4421 --- /dev/null +++ b/tests/ui/lint/unused/concat-in-crate-deprecated-issue-137687.rs @@ -0,0 +1,6 @@ +//@ check-pass +#[deprecated = concat !()] +macro_rules! a { + () => {}; +} +fn main() {} diff --git a/tests/ui/lint/unused/concat-in-crate-name-issue-137687.rs b/tests/ui/lint/unused/concat-in-crate-name-issue-137687.rs new file mode 100644 index 00000000000..37fbf93ffa1 --- /dev/null +++ b/tests/ui/lint/unused/concat-in-crate-name-issue-137687.rs @@ -0,0 +1,9 @@ +#![deny(unused)] + +#[crate_name = concat !()] +//~^ ERROR crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo] +macro_rules! a { + //~^ ERROR unused macro definition + () => {}; +} +fn main() {} diff --git a/tests/ui/lint/unused/concat-in-crate-name-issue-137687.stderr b/tests/ui/lint/unused/concat-in-crate-name-issue-137687.stderr new file mode 100644 index 00000000000..4ffb55d493a --- /dev/null +++ b/tests/ui/lint/unused/concat-in-crate-name-issue-137687.stderr @@ -0,0 +1,23 @@ +error: unused macro definition: `a` + --> $DIR/concat-in-crate-name-issue-137687.rs:5:14 + | +LL | macro_rules! a { + | ^ + | +note: the lint level is defined here + --> $DIR/concat-in-crate-name-issue-137687.rs:1:9 + | +LL | #![deny(unused)] + | ^^^^^^ + = note: `#[deny(unused_macros)]` implied by `#[deny(unused)]` + +error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` + --> $DIR/concat-in-crate-name-issue-137687.rs:3:1 + | +LL | #[crate_name = concat !()] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[deny(unused_attributes)]` implied by `#[deny(unused)]` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/resolve/path-attr-in-const-block.rs b/tests/ui/resolve/path-attr-in-const-block.rs index 076511d26d6..0ca356b1ddf 100644 --- a/tests/ui/resolve/path-attr-in-const-block.rs +++ b/tests/ui/resolve/path-attr-in-const-block.rs @@ -5,5 +5,6 @@ fn main() { const { #![path = foo!()] //~^ ERROR: cannot find macro `foo` in this scope + //~| ERROR: attribute value must be a literal } } diff --git a/tests/ui/resolve/path-attr-in-const-block.stderr b/tests/ui/resolve/path-attr-in-const-block.stderr index 8f9e58157c8..19d2745577b 100644 --- a/tests/ui/resolve/path-attr-in-const-block.stderr +++ b/tests/ui/resolve/path-attr-in-const-block.stderr @@ -4,5 +4,11 @@ error: cannot find macro `foo` in this scope LL | #![path = foo!()] | ^^^ -error: aborting due to 1 previous error +error: attribute value must be a literal + --> $DIR/path-attr-in-const-block.rs:6:19 + | +LL | #![path = foo!()] + | ^^^^^^ + +error: aborting due to 2 previous errors |
