rust/src
bors aa5740c715 Auto merge of #90104 - spastorino:coherence-for-negative-trait, r=nikomatsakis
Implement coherence checks for negative trait impls

The main purpose of this PR is to be able to [move Error trait to core](https://github.com/rust-lang/project-error-handling/issues/3).

This feature is necessary to handle the following from impl on box.

```rust
impl From<&str> for Box<dyn Error> { ... }
```

Without having negative traits affect coherence moving the error trait into `core` and moving that `From` impl to `alloc` will cause the from impl to no longer compiler because of a potential future incompatibility. The compiler indicates that `&str` _could_ introduce an `Error` impl in the future, and thus prevents the `From` impl in `alloc` that would cause overlap with `From<E: Error> for Box<dyn Error>`. Adding `impl !Error for &str {}` with the negative trait coherence feature will disable this error by encoding a stability guarantee that `&str` will never implement `Error`, making the `From` impl compile.

We would have this in `alloc`:

```rust
impl From<&str> for Box<dyn Error> {} // A
impl<E> From<E> for Box<dyn Error> where E: Error {} // B
```

and this in `core`:

```rust
trait Error {}
impl !Error for &str {}
```

r? `@nikomatsakis`

This PR was built on top of `@yaahc` PR #85764.

Language team proposal: to https://github.com/rust-lang/lang-team/issues/96
2021-10-23 12:51:15 +00:00
..
bootstrap Auto merge of #90054 - michaelwoerister:v0-mangling-in-compiler, r=Mark-Simulacrum 2021-10-23 03:06:21 +00:00
build_helper Migrate to 2021 2021-09-20 22:21:42 -04:00
ci Rollup merge of #90122 - rusticstuff:ci_curl_max_time, r=Mark-Simulacrum 2021-10-23 05:28:27 +02:00
doc Rollup merge of #89920 - hudson-ayers:location-detail-control, r=davidtwco 2021-10-23 05:28:23 +02:00
etc Encode json files with UTF-8 2021-09-30 00:11:14 +09:00
librustdoc Auto merge of #89998 - camelid:box-default, r=jyn514 2021-10-21 01:38:55 +00:00
llvm-project@a7348ae0df Update to the final LLVM 13.0.0 release 2021-10-01 21:06:19 -07:00
rustdoc-json-types Moved format-version constant to rustdoc-json-types 2021-10-15 12:27:42 +03:00
test Auto merge of #90104 - spastorino:coherence-for-negative-trait, r=nikomatsakis 2021-10-23 12:51:15 +00:00
tools Rollup merge of #90087 - calebcartwright:rustfmt-subtree, r=calebcartwright 2021-10-23 05:28:25 +02:00
README.md
stage0.json Bump stage0 compiler to 1.56 2021-09-08 20:51:05 -04:00
version bump version to rust 1.58.0 2021-10-17 16:04:44 +02:00

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.