about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-04-09 21:11:12 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-04-17 09:50:52 +1000
commit4be670f89b94aaeab04b0e52d0efd9c61f1bef9d (patch)
treeb50dd2bdfa63b12d91ae5f69c8b4ad6f232bc75f
parent78f2104e334068d5a892a170d50193c0025c690e (diff)
downloadrust-4be670f89b94aaeab04b0e52d0efd9c61f1bef9d.tar.gz
rust-4be670f89b94aaeab04b0e52d0efd9c61f1bef9d.zip
Warnings-as-errors in `check-builtin-attr-ice.rs`.
This adds two new warnings, both of which print the attribute
incorrectly as `#[]`. The next commit will fix this.
-rw-r--r--tests/ui/attributes/check-builtin-attr-ice.rs4
-rw-r--r--tests/ui/attributes/check-builtin-attr-ice.stderr26
2 files changed, 26 insertions, 4 deletions
diff --git a/tests/ui/attributes/check-builtin-attr-ice.rs b/tests/ui/attributes/check-builtin-attr-ice.rs
index 9ef5890601f..e3a2ffc714d 100644
--- a/tests/ui/attributes/check-builtin-attr-ice.rs
+++ b/tests/ui/attributes/check-builtin-attr-ice.rs
@@ -39,13 +39,17 @@
 
 // Notably, `should_panic` is a `AttributeType::Normal` attribute that is checked separately.
 
+#![deny(unused_attributes)]
+
 struct Foo {
     #[should_panic::skip]
     //~^ ERROR failed to resolve
+    //~| ERROR `#[]` only has an effect on functions
     pub field: u8,
 
     #[should_panic::a::b::c]
     //~^ ERROR failed to resolve
+    //~| ERROR `#[]` only has an effect on functions
     pub field2: u8,
 }
 
diff --git a/tests/ui/attributes/check-builtin-attr-ice.stderr b/tests/ui/attributes/check-builtin-attr-ice.stderr
index 06a4769b2b4..487a0b6d680 100644
--- a/tests/ui/attributes/check-builtin-attr-ice.stderr
+++ b/tests/ui/attributes/check-builtin-attr-ice.stderr
@@ -1,21 +1,39 @@
 error[E0433]: failed to resolve: use of unresolved module or unlinked crate `should_panic`
-  --> $DIR/check-builtin-attr-ice.rs:43:7
+  --> $DIR/check-builtin-attr-ice.rs:45:7
    |
 LL |     #[should_panic::skip]
    |       ^^^^^^^^^^^^ use of unresolved module or unlinked crate `should_panic`
 
 error[E0433]: failed to resolve: use of unresolved module or unlinked crate `should_panic`
-  --> $DIR/check-builtin-attr-ice.rs:47:7
+  --> $DIR/check-builtin-attr-ice.rs:50:7
    |
 LL |     #[should_panic::a::b::c]
    |       ^^^^^^^^^^^^ use of unresolved module or unlinked crate `should_panic`
 
 error[E0433]: failed to resolve: use of unresolved module or unlinked crate `deny`
-  --> $DIR/check-builtin-attr-ice.rs:55:7
+  --> $DIR/check-builtin-attr-ice.rs:59:7
    |
 LL |     #[deny::skip]
    |       ^^^^ use of unresolved module or unlinked crate `deny`
 
-error: aborting due to 3 previous errors
+error: `#[]` only has an effect on functions
+  --> $DIR/check-builtin-attr-ice.rs:45:5
+   |
+LL |     #[should_panic::skip]
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+note: the lint level is defined here
+  --> $DIR/check-builtin-attr-ice.rs:42:9
+   |
+LL | #![deny(unused_attributes)]
+   |         ^^^^^^^^^^^^^^^^^
+
+error: `#[]` only has an effect on functions
+  --> $DIR/check-builtin-attr-ice.rs:50:5
+   |
+LL |     #[should_panic::a::b::c]
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
 
 For more information about this error, try `rustc --explain E0433`.