about summary refs log tree commit diff
path: root/tests/ui/proc-macro
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-12-03 21:18:24 +0000
committerEsteban Küber <esteban@kuber.com.ar>2025-05-29 10:24:23 +0000
commitf80e3ac4ed1e1df2c337cbf7b231cb72ec4e3b7a (patch)
tree7126e809ace3e82228ab9ef05acf66027cbc375d /tests/ui/proc-macro
parent642e49bfed2481e54e252732be20d3c24cbec9e8 (diff)
downloadrust-f80e3ac4ed1e1df2c337cbf7b231cb72ec4e3b7a.tar.gz
rust-f80e3ac4ed1e1df2c337cbf7b231cb72ec4e3b7a.zip
Use `cfg_attr` AST placeholder AST `cfg_attr_trace` for diagnostics
PR 138515, we insert a placeholder attribute so that checks for attributes can still know about the placement of `cfg` attributes. When we suggest removing items with `cfg_attr`s (fix Issue 56328) and make them verbose. We tweak the wording of the existing "unused `extern crate`" lint.

```
warning: unused extern crate
  --> $DIR/removing-extern-crate.rs:9:1
   |
LL | extern crate removing_extern_crate as foo;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused
   |
note: the lint level is defined here
  --> $DIR/removing-extern-crate.rs:6:9
   |
LL | #![warn(rust_2018_idioms)]
   |         ^^^^^^^^^^^^^^^^
   = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]`
help: remove the unused `extern crate`
   |
LL - #[cfg_attr(test, macro_use)]
LL - extern crate removing_extern_crate as foo;
LL +
   |
```
Diffstat (limited to 'tests/ui/proc-macro')
-rw-r--r--tests/ui/proc-macro/no-macro-use-attr.stderr6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/ui/proc-macro/no-macro-use-attr.stderr b/tests/ui/proc-macro/no-macro-use-attr.stderr
index 4913672450a..0bef563fbb9 100644
--- a/tests/ui/proc-macro/no-macro-use-attr.stderr
+++ b/tests/ui/proc-macro/no-macro-use-attr.stderr
@@ -2,13 +2,17 @@ warning: unused extern crate
   --> $DIR/no-macro-use-attr.rs:6:1
    |
 LL | extern crate test_macros;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^ unused
    |
 note: the lint level is defined here
   --> $DIR/no-macro-use-attr.rs:4:9
    |
 LL | #![warn(unused_extern_crates)]
    |         ^^^^^^^^^^^^^^^^^^^^
+help: remove the unused `extern crate`
+   |
+LL - extern crate test_macros;
+   |
 
 warning: 1 warning emitted