rust/src
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
..
bootstrap Auto merge of #76639 - Mark-Simulacrum:ci-hosts, r=pietroalbini 2020-09-12 15:44:07 +00:00
build_helper cleanup: Remove duplicate library names from `Cargo.toml`s 2020-08-30 22:57:54 +03:00
ci Add host= configuration for msvc/darwin 2020-09-12 08:05:44 -04:00
doc Rollup merge of #76555 - alilleybrinker:reword_trivial_casts_lint_doc, r=steveklabnik 2020-09-10 12:20:06 -07:00
etc Implement HashSet in terms of hashbrown::HashSet 2020-09-08 17:24:23 -07:00
librustdoc Auto merge of #76632 - andjo403:updateDep, r=Mark-Simulacrum 2020-09-12 14:00:39 +00:00
llvm-project@833dd1e3d4 Update llvm-project to include PR 73 2020-09-05 12:49:17 -07:00
test Auto merge of #76538 - fusion-engineering-forks:check-useless-unstable-trait-impl, r=lcnr 2020-09-12 18:01:33 +00:00
tools Auto merge of #75800 - Aaron1011:feature/full-nt-tokens, r=petrochenkov 2020-09-11 02:35:01 +00:00
README.md Update README.md 2020-08-30 13:40:11 -05:00
stage0.txt bump version to 1.48 2020-08-26 10:16:59 +02:00

README.md

This directory contains the source code of the rust project, including:

  • The test suite
  • The bootstrapping build system
  • Various submodules for tools, like rustdoc, rls, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.