rust/compiler/rustc_expand/src
Mara Bos f0112928cb
Rollup merge of #78626 - fusion-engineering-forks:deprecated-trait-impl, r=estebank
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
```
2020-11-03 19:32:36 +01:00
..
mbe Expand NtExpr tokens only in key-value attributes 2020-11-03 00:53:43 +03:00
mut_visit Expand NtExpr tokens only in key-value attributes 2020-11-03 00:53:43 +03:00
parse Move lexer unit tests to rustc_lexer 2020-08-30 19:53:36 +02:00
tokenstream
base.rs Use the right span for errors about #[deprecated] attributes. 2020-11-01 20:48:58 +01:00
build.rs Remove unused code from remaining compiler crates 2020-10-14 04:14:32 +02:00
config.rs parser: Cleanup LazyTokenStream and avoid some clones 2020-10-31 01:56:34 +03:00
expand.rs Rollup merge of #78326 - Aaron1011:fix/min-stmt-lints, r=petrochenkov 2020-10-25 18:43:49 +09:00
lib.rs Remove redundant #![feature(...)] 's from compiler/ 2020-09-17 07:58:45 +02:00
mbe.rs Fix some more clippy warnings 2020-10-30 10:12:56 -04:00
module.rs Syntactically permit unsafety on mods 2020-09-10 06:56:33 -07:00
placeholders.rs Treat trailing semicolon as a statement in macro call 2020-11-02 13:03:13 -05:00
proc_macro_server.rs Rollup merge of #75146 - tmiasko:range-overflow, r=Mark-Simulacrum 2020-09-16 01:30:30 +02:00
proc_macro.rs Improve E0777 help message 2020-10-02 16:33:44 +02:00
tests.rs