mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
f0112928cb
Improve errors about #[deprecated] attribute This change: 1. Turns `#[deprecated]` on a trait impl block into an error, which fixes #78625; 2. Changes these and other errors about `#[deprecated]` to use the span of the attribute instead of the item; and 3. Turns this error into a lint, to make sure it can be capped with `--cap-lints` and doesn't break any existing dependencies. Can be reviewed per commit. --- Example: ```rust struct X; #[deprecated = "a"] impl Default for X { #[deprecated = "b"] fn default() -> Self { X } } ``` Before: ``` error: This deprecation annotation is useless --> src/main.rs:6:5 | 6 | / fn default() -> Self { 7 | | X 8 | | } | |_____^ ``` After: ``` error: this `#[deprecated]' annotation has no effect --> src/main.rs:3:1 | 3 | #[deprecated = "a"] | ^^^^^^^^^^^^^^^^^^^ help: try removing the deprecation attribute | = note: `#[deny(useless_deprecated)]` on by default error: this `#[deprecated]' annotation has no effect --> src/main.rs:5:5 | 5 | #[deprecated = "b"] | ^^^^^^^^^^^^^^^^^^^ help: try removing the deprecation attribute ``` |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |