rust/compiler/rustc_passes/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
..
check_attr.rs Rollup merge of #78208 - liketechnik:issue-69399, r=oli-obk 2020-10-25 18:43:40 +09:00
check_const.rs switch allow_internal_unstable const fns to rustc_allow_const_fn_unstable 2020-10-21 20:54:20 +02:00
dead.rs Remove weird slice conversion 2020-10-18 10:31:58 +02:00
diagnostic_items.rs Cache foreign_modules query 2020-10-27 16:21:55 +01:00
entry.rs Enforce crate level attributes checks 2020-10-04 13:36:47 +02:00
hir_id_validator.rs implement nits 2020-10-07 10:19:04 +02:00
hir_stats.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
intrinsicck.rs Replace target.target with target and target.ptr_width with target.pointer_width 2020-10-15 12:02:24 +02:00
lang_items.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
layout_test.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
lib.rs liveness: Use newtype_index for Variable and LiveNode 2020-09-26 16:44:41 +02:00
lib_features.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
liveness.rs Mark InOut operands as used in RWU table with write_place 2020-10-18 23:51:10 -05:00
loops.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
reachable.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
region.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
stability.rs Improve deprecation attribute diagnostic messages. 2020-11-02 13:21:18 +01:00
upvars.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
weak_lang_items.rs Replace target.target with target and target.ptr_width with target.pointer_width 2020-10-15 12:02:24 +02:00