rust/src/test
bors 989190874f Auto merge of #76538 - fusion-engineering-forks:check-useless-unstable-trait-impl, r=lcnr
Warn for #[unstable] on trait impls when it has no effect.

Earlier today I sent a PR with an `#[unstable]` attribute on a trait `impl`, but was informed that this attribute has no effect there. (comment: https://github.com/rust-lang/rust/pull/76525#issuecomment-689678895, issue: https://github.com/rust-lang/rust/issues/55436)

This PR adds a warning for this situation. Trait `impl` blocks with `#[unstable]` where both the type and the trait are stable will result in a warning:

```
warning: An `#[unstable]` annotation here has no effect. See issue #55436 <https://github.com/rust-lang/rust/issues/55436> for more information.
   --> library/std/src/panic.rs:235:1
    |
235 | #[unstable(feature = "integer_atomics", issue = "32976")]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

---

It detects three problems in the existing code:

1. A few `RefUnwindSafe` implementations for the atomic integer types in `library/std/src/panic.rs`. Example:
d92155bf6a/library/std/src/panic.rs (L235-L236)
2. An implementation of `Error` for `LayoutErr` in `library/std/srd/error.rs`:
d92155bf6a/library/std/src/error.rs (L392-L397)
3. `From` implementations for `Waker` and `RawWaker` in `library/alloc/src/task.rs`. Example:
d92155bf6a/library/alloc/src/task.rs (L36-L37)

Case 3 interesting: It has a bound with an `#[unstable]` trait (`W: Wake`), so appears to have much effect on stable code. It does however break similar blanket implementations. It would also have immediate effect if `Wake` was implemented for any stable type. (Which is not the case right now, but there are no warnings in place to prevent it.) Whether this case is a problem or not is not clear to me. If it isn't, adding a simple `c.visit_generics(..);` to this PR will stop the warning for this case.
2020-09-12 18:01:33 +00:00
..
assembly Fix test 2020-08-28 18:53:09 +01:00
auxiliary
codegen Add codegen tests 2020-08-31 08:19:15 +02:00
codegen-units ty: remove obsolete printer 2020-08-30 18:59:07 +01:00
compile-fail pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
debuginfo debuginfo: Ignore HashMap tests before cdb 10.0.18362.1 2020-09-05 14:47:16 -07:00
incremental pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
mir-opt Rollup merge of #76500 - richkadel:mir-graphviz-dark, r=tmandry 2020-09-09 21:02:35 -07:00
pretty pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
run-make proc_macro: Add API for tracked access to environment variables 2020-07-26 13:37:37 +03:00
run-make-fulldeps Auto merge of #76378 - petrochenkov:lldtest, r=Mark-Simulacrum 2020-09-10 10:06:44 +00:00
run-pass-valgrind
rustdoc Rollup merge of #76297 - lcnr:const-ty-alias, r=varkor 2020-09-12 10:43:15 +02:00
rustdoc-js Allow #[doc(alias)] on impl const items 2020-08-12 11:09:24 +02:00
rustdoc-js-std
rustdoc-ui Auto merge of #75756 - jyn514:diagnostic-suggestions, r=estebank 2020-09-12 05:52:14 +00:00
rustfix
ui Auto merge of #76538 - fusion-engineering-forks:check-useless-unstable-trait-impl, r=lcnr 2020-09-12 18:01:33 +00:00
ui-fulldeps Fully integrate token collection for additional AST structs 2020-09-10 17:58:14 -04:00
COMPILER_TESTS.md