summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_error_codes/src/error_codes
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_error_codes/src/error_codes')
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0015.md23
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0158.md53
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0208.md46
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0320.md27
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0377.md29
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0387.md2
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0457.md36
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0460.md71
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0461.md30
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0462.md32
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0472.md31
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0492.md1
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0514.md33
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0519.md40
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0588.md2
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0640.md1
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0711.md30
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0713.md2
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0714.md2
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0717.md1
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0729.md2
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0792.md60
22 files changed, 515 insertions, 39 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0015.md b/compiler/rustc_error_codes/src/error_codes/E0015.md
index 021a0219d..ac78f66ad 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0015.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0015.md
@@ -1,5 +1,4 @@
-A constant item was initialized with something that is not a constant
-expression.
+A non-`const` function was called in a `const` context.
Erroneous code example:
@@ -8,26 +7,20 @@ fn create_some() -> Option<u8> {
Some(1)
}
-const FOO: Option<u8> = create_some(); // error!
+// error: cannot call non-const fn `create_some` in constants
+const FOO: Option<u8> = create_some();
```
-The only functions that can be called in static or constant expressions are
-`const` functions, and struct/enum constructors.
+All functions used in a `const` context (constant or static expression) must
+be marked `const`.
To fix this error, you can declare `create_some` as a constant function:
```
-const fn create_some() -> Option<u8> { // declared as a const function
+// declared as a `const` function:
+const fn create_some() -> Option<u8> {
Some(1)
}
-const FOO: Option<u8> = create_some(); // ok!
-
-// These are also working:
-struct Bar {
- x: u8,
-}
-
-const OTHER_FOO: Option<u8> = Some(1);
-const BAR: Bar = Bar {x: 1};
+const FOO: Option<u8> = create_some(); // no error!
```
diff --git a/compiler/rustc_error_codes/src/error_codes/E0158.md b/compiler/rustc_error_codes/src/error_codes/E0158.md
index 0a9ef9c39..03b93d925 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0158.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0158.md
@@ -1,38 +1,53 @@
-An associated const has been referenced in a pattern.
+An associated `const`, `const` parameter or `static` has been referenced
+in a pattern.
Erroneous code example:
```compile_fail,E0158
-enum EFoo { A, B, C, D }
+enum Foo {
+ One,
+ Two
+}
-trait Foo {
- const X: EFoo;
+trait Bar {
+ const X: Foo;
}
-fn test<A: Foo>(arg: EFoo) {
+fn test<A: Bar>(arg: Foo) {
match arg {
- A::X => { // error!
- println!("A::X");
- }
+ A::X => println!("A::X"), // error: E0158: associated consts cannot be
+ // referenced in patterns
+ Foo::Two => println!("Two")
}
}
```
-`const` and `static` mean different things. A `const` is a compile-time
-constant, an alias for a literal value. This property means you can match it
-directly within a pattern.
+Associated `const`s cannot be referenced in patterns because it is impossible
+for the compiler to prove exhaustiveness (that some pattern will always match).
+Take the above example, because Rust does type checking in the *generic*
+method, not the *monomorphized* specific instance. So because `Bar` could have
+theoretically infinite implementations, there's no way to always be sure that
+`A::X` is `Foo::One`. So this code must be rejected. Even if code can be
+proven exhaustive by a programmer, the compiler cannot currently prove this.
-The `static` keyword, on the other hand, guarantees a fixed location in memory.
-This does not always mean that the value is constant. For example, a global
-mutex can be declared `static` as well.
+The same holds true of `const` parameters and `static`s.
-If you want to match against a `static`, consider using a guard instead:
+If you want to match against an associated `const`, `const` parameter or
+`static` consider using a guard instead:
```
-static FORTY_TWO: i32 = 42;
+trait Trait {
+ const X: char;
+}
+
+static FOO: char = 'j';
-match Some(42) {
- Some(x) if x == FORTY_TWO => {}
- _ => {}
+fn test<A: Trait, const Y: char>(arg: char) {
+ match arg {
+ c if c == A::X => println!("A::X"),
+ c if c == Y => println!("Y"),
+ c if c == FOO => println!("FOO"),
+ _ => ()
+ }
}
```
diff --git a/compiler/rustc_error_codes/src/error_codes/E0208.md b/compiler/rustc_error_codes/src/error_codes/E0208.md
new file mode 100644
index 000000000..1ae01106f
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0208.md
@@ -0,0 +1,46 @@
+#### This error code is internal to the compiler and will not be emitted with normal Rust code.
+#### Note: this error code is no longer emitted by the compiler.
+
+This error code shows the variance of a type's generic parameters.
+
+Erroneous code example:
+
+```compile_fail
+// NOTE: this feature is perma-unstable and should *only* be used for
+// testing purposes.
+#![feature(rustc_attrs)]
+
+#[rustc_variance]
+struct Foo<'a, T> { // error: deliberate error to display type's variance
+ t: &'a mut T,
+}
+```
+
+which produces the following error:
+
+```text
+error: [-, o]
+ --> <anon>:4:1
+ |
+4 | struct Foo<'a, T> {
+ | ^^^^^^^^^^^^^^^^^
+```
+
+*Note that while `#[rustc_variance]` still exists and is used within the*
+*compiler, it no longer is marked as `E0208` and instead has no error code.*
+
+This error is deliberately triggered with the `#[rustc_variance]` attribute
+(`#![feature(rustc_attrs)]` must be enabled) and helps to show you the variance
+of the type's generic parameters. You can read more about variance and
+subtyping in [this section of the Rustnomicon]. For a more in depth look at
+variance (including a more complete list of common variances) see
+[this section of the Reference]. For information on how variance is implemented
+in the compiler, see [this section of `rustc-dev-guide`].
+
+This error can be easily fixed by removing the `#[rustc_variance]` attribute,
+the compiler's suggestion to comment it out can be applied automatically with
+`rustfix`.
+
+[this section of the Rustnomicon]: https://doc.rust-lang.org/nomicon/subtyping.html
+[this section of the Reference]: https://doc.rust-lang.org/reference/subtyping.html#variance
+[this section of `rustc-dev-guide`]: https://rustc-dev-guide.rust-lang.org/variance.html
diff --git a/compiler/rustc_error_codes/src/error_codes/E0320.md b/compiler/rustc_error_codes/src/error_codes/E0320.md
new file mode 100644
index 000000000..e6e1b7c19
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0320.md
@@ -0,0 +1,27 @@
+Recursion limit reached while creating drop-check rules.
+
+Example of erroneous code:
+
+```compile_fail,E0320
+enum A<T> {
+ B,
+ C(T, Box<A<(T, T)>>)
+}
+
+fn foo<T>() {
+ A::<T>::B; // error: overflow while adding drop-check rules for A<T>
+}
+```
+
+The Rust compiler must be able to reason about how a type is [`Drop`]ped, and
+by extension the types of its fields, to be able to generate the glue to
+properly drop a value. The code example above shows a type where this inference
+is impossible because it is recursive. Note that this is *not* the same as
+[E0072](E0072.html), where a type has an infinite size; the type here has a
+finite size but any attempt to `Drop` it would recurse infinitely. For more
+information, read [the `Drop` docs](../std/ops/trait.Drop.html).
+
+It is not possible to define a type with recursive drop-check rules. All such
+recursion must be removed.
+
+[`Drop`]: ../std/ops/trait.Drop.html
diff --git a/compiler/rustc_error_codes/src/error_codes/E0377.md b/compiler/rustc_error_codes/src/error_codes/E0377.md
new file mode 100644
index 000000000..b1d364063
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0377.md
@@ -0,0 +1,29 @@
+The trait `CoerceUnsized` may only be implemented for a coercion between
+structures with the same definition.
+
+Example of erroneous code:
+
+```compile_fail,E0377
+#![feature(coerce_unsized)]
+use std::ops::CoerceUnsized;
+
+pub struct Foo<T: ?Sized> {
+ field_with_unsized_type: T,
+}
+
+pub struct Bar<T: ?Sized> {
+ field_with_unsized_type: T,
+}
+
+// error: the trait `CoerceUnsized` may only be implemented for a coercion
+// between structures with the same definition
+impl<T, U> CoerceUnsized<Bar<U>> for Foo<T> where T: CoerceUnsized<U> {}
+```
+
+When attempting to implement `CoerceUnsized`, the `impl` signature must look
+like: `impl CoerceUnsized<Type<U>> for Type<T> where T: CoerceUnsized<U>`;
+the *implementer* and *`CoerceUnsized` type parameter* must be the same
+type. In this example, `Bar` and `Foo` (even though structurally identical)
+are *not* the same type and are rejected. Learn more about the `CoerceUnsized`
+trait and DST coercion in
+[the `CoerceUnsized` docs](../std/ops/trait.CoerceUnsized.html).
diff --git a/compiler/rustc_error_codes/src/error_codes/E0387.md b/compiler/rustc_error_codes/src/error_codes/E0387.md
index 38ad19bd6..1c62d410e 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0387.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0387.md
@@ -17,7 +17,7 @@ fn mutable() {
foo(|| x = 2);
}
-// Attempts to take a mutable reference to closed-over data. Error message
+// Attempts to take a mutable reference to closed-over data. Error message
// reads: `cannot borrow data mutably in a captured outer variable...`
fn mut_addr() {
let mut x = 0u32;
diff --git a/compiler/rustc_error_codes/src/error_codes/E0457.md b/compiler/rustc_error_codes/src/error_codes/E0457.md
new file mode 100644
index 000000000..53d384d36
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0457.md
@@ -0,0 +1,36 @@
+Plugin `..` only found in rlib format, but must be available in dylib format.
+
+Erroronous code example:
+
+`rlib-plugin.rs`
+```ignore (needs-linkage-with-other-tests)
+#![crate_type = "rlib"]
+#![feature(rustc_private)]
+
+extern crate rustc_middle;
+extern crate rustc_driver;
+
+use rustc_driver::plugin::Registry;
+
+#[no_mangle]
+fn __rustc_plugin_registrar(_: &mut Registry) {}
+```
+
+`main.rs`
+```ignore (needs-linkage-with-other-tests)
+#![feature(plugin)]
+#![plugin(rlib_plugin)] // error: plugin `rlib_plugin` only found in rlib
+ // format, but must be available in dylib
+
+fn main() {}
+```
+
+The compiler exposes a plugin interface to allow altering the compile process
+(adding lints, etc). Plugins must be defined in their own crates (similar to
+[proc-macro](../reference/procedural-macros.html) isolation) and then compiled
+and linked to another crate. Plugin crates *must* be compiled to the
+dynamically-linked dylib format, and not the statically-linked rlib format.
+Learn more about different output types in
+[this section](../reference/linkage.html) of the Rust reference.
+
+This error is easily fixed by recompiling the plugin crate in the dylib format.
diff --git a/compiler/rustc_error_codes/src/error_codes/E0460.md b/compiler/rustc_error_codes/src/error_codes/E0460.md
new file mode 100644
index 000000000..001678a9b
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0460.md
@@ -0,0 +1,71 @@
+Found possibly newer version of crate `..` which `..` depends on.
+
+Consider these erroneous files:
+
+`a1.rs`
+```ignore (needs-linkage-with-other-tests)
+#![crate_name = "a"]
+
+pub fn foo<T>() {}
+```
+
+`a2.rs`
+```ignore (needs-linkage-with-other-tests)
+#![crate_name = "a"]
+
+pub fn foo<T>() {
+ println!("foo<T>()");
+}
+```
+
+`b.rs`
+```ignore (needs-linkage-with-other-tests)
+#![crate_name = "b"]
+
+extern crate a; // linked with `a1.rs`
+
+pub fn foo() {
+ a::foo::<isize>();
+}
+```
+
+`main.rs`
+```ignore (needs-linkage-with-other-tests)
+extern crate a; // linked with `a2.rs`
+extern crate b; // error: found possibly newer version of crate `a` which `b`
+ // depends on
+
+fn main() {}
+```
+
+The dependency graph of this program can be represented as follows:
+```text
+ crate `main`
+ |
+ +-------------+
+ | |
+ | v
+depends: | crate `b`
+ `a` v1 | |
+ | | depends:
+ | | `a` v2
+ v |
+ crate `a` <------+
+```
+
+Crate `main` depends on crate `a` (version 1) and crate `b` which in turn
+depends on crate `a` (version 2); this discrepancy in versions cannot be
+reconciled. This difference in versions typically occurs when one crate is
+compiled and linked, then updated and linked to another crate. The crate
+"version" is a SVH (Strict Version Hash) of the crate in an
+implementation-specific way. Note that this error can *only* occur when
+directly compiling and linking with `rustc`; [Cargo] automatically resolves
+dependencies, without using the compiler's own dependency management that
+causes this issue.
+
+This error can be fixed by:
+ * Using [Cargo], the Rust package manager, automatically fixing this issue.
+ * Recompiling crate `a` so that both crate `b` and `main` have a uniform
+ version to depend on.
+
+[Cargo]: ../cargo/index.html
diff --git a/compiler/rustc_error_codes/src/error_codes/E0461.md b/compiler/rustc_error_codes/src/error_codes/E0461.md
new file mode 100644
index 000000000..33105c43c
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0461.md
@@ -0,0 +1,30 @@
+Couldn't find crate `..` with expected target triple `..`.
+
+Example of erroneous code:
+
+`a.rs`
+```ignore (cannot-link-with-other-tests)
+#![crate_type = "lib"]
+
+fn foo() {}
+```
+
+`main.rs`
+```ignore (cannot-link-with-other-tests)
+extern crate a;
+
+fn main() {
+ a::foo();
+}
+```
+
+`a.rs` is then compiled with `--target powerpc-unknown-linux-gnu` and `b.rs`
+with `--target x86_64-unknown-linux-gnu`. `a.rs` is compiled into a binary
+format incompatible with `b.rs`; PowerPC and x86 are totally different
+architectures. This issue also extends to any difference in target triples, as
+`std` is operating-system specific.
+
+This error can be fixed by:
+ * Using [Cargo](../cargo/index.html), the Rust package manager, automatically
+ fixing this issue.
+ * Recompiling either crate so that they target a consistent target triple.
diff --git a/compiler/rustc_error_codes/src/error_codes/E0462.md b/compiler/rustc_error_codes/src/error_codes/E0462.md
new file mode 100644
index 000000000..4509cc6fa
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0462.md
@@ -0,0 +1,32 @@
+Found `staticlib` `..` instead of `rlib` or `dylib`.
+
+Consider the following two files:
+
+`a.rs`
+```ignore (cannot-link-with-other-tests)
+#![crate_type = "staticlib"]
+
+fn foo() {}
+```
+
+`main.rs`
+```ignore (cannot-link-with-other-tests)
+extern crate a;
+
+fn main() {
+ a::foo();
+}
+```
+
+Crate `a` is compiled as a `staticlib`. A `staticlib` is a system-dependant
+library only intended for linking with non-Rust applications (C programs). Note
+that `staticlib`s include all upstream dependencies (`core`, `std`, other user
+dependencies, etc) which makes them significantly larger than `dylib`s:
+prefer `staticlib` for linking with C programs. Learn more about different
+`crate_type`s in [this section of the Reference](../reference/linkage.html).
+
+This error can be fixed by:
+ * Using [Cargo](../cargo/index.html), the Rust package manager, automatically
+ fixing this issue.
+ * Recompiling the crate as a `rlib` or `dylib`; formats suitable for Rust
+ linking.
diff --git a/compiler/rustc_error_codes/src/error_codes/E0472.md b/compiler/rustc_error_codes/src/error_codes/E0472.md
new file mode 100644
index 000000000..0005cd419
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0472.md
@@ -0,0 +1,31 @@
+Inline assembly (`asm!`) is not supported on this target.
+
+Example of erroneous code:
+
+```ignore (cannot-change-target)
+// compile-flags: --target sparc64-unknown-linux-gnu
+#![no_std]
+
+use core::arch::asm;
+
+fn main() {
+ unsafe {
+ asm!(""); // error: inline assembly is not supported on this target
+ }
+}
+```
+
+The Rust compiler does not support inline assembly, with the `asm!` macro
+(previously `llvm_asm!`), for all targets. All Tier 1 targets do support this
+macro but support among Tier 2 and 3 targets is not guaranteed (even when they
+have `std` support). Note that this error is related to
+`error[E0658]: inline assembly is not stable yet on this architecture`, but
+distinct in that with `E0472` support is not planned or in progress.
+
+There is no way to easily fix this issue, however:
+ * Consider if you really need inline assembly, is there some other way to
+ achieve your goal (intrinsics, etc)?
+ * Consider writing your assembly externally, linking with it and calling it
+ from Rust.
+ * Consider contributing to <https://github.com/rust-lang/rust> and help
+ integrate support for your target!
diff --git a/compiler/rustc_error_codes/src/error_codes/E0492.md b/compiler/rustc_error_codes/src/error_codes/E0492.md
index 79e7c069a..7c0719dc2 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0492.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0492.md
@@ -55,7 +55,6 @@ wrapper:
```
use std::cell::Cell;
-use std::marker::Sync;
struct NotThreadSafe<T> {
value: Cell<T>,
diff --git a/compiler/rustc_error_codes/src/error_codes/E0514.md b/compiler/rustc_error_codes/src/error_codes/E0514.md
new file mode 100644
index 000000000..ce2bbc5c5
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0514.md
@@ -0,0 +1,33 @@
+Dependency compiled with different version of `rustc`.
+
+Example of erroneous code:
+
+`a.rs`
+```ignore (cannot-link-with-other-tests)
+// compiled with stable `rustc`
+
+#[crate_type = "lib"]
+```
+
+`b.rs`
+```ignore (cannot-link-with-other-tests)
+// compiled with nightly `rustc`
+
+#[crate_type = "lib"]
+
+extern crate a; // error: found crate `a` compiled by an incompatible version
+ // of rustc
+```
+
+This error is caused when the version of `rustc` used to compile a crate, as
+stored in the binary's metadata, differs from the version of one of its
+dependencies. Many parts of Rust binaries are considered unstable. For
+instance, the Rust ABI is not stable between compiler versions. This means that
+the compiler cannot be sure about *how* to call a function between compiler
+versions, and therefore this error occurs.
+
+This error can be fixed by:
+ * Using [Cargo](../cargo/index.html), the Rust package manager and
+ [Rustup](https://rust-lang.github.io/rustup/), the Rust toolchain installer,
+ automatically fixing this issue.
+ * Recompiling the crates with a uniform `rustc` version.
diff --git a/compiler/rustc_error_codes/src/error_codes/E0519.md b/compiler/rustc_error_codes/src/error_codes/E0519.md
new file mode 100644
index 000000000..12876e2ad
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0519.md
@@ -0,0 +1,40 @@
+The current crate is indistinguishable from one of its dependencies, in terms
+of metadata.
+
+Example of erroneous code:
+
+`a.rs`
+```ignore (cannot-link-with-other-tests)
+#![crate_name = "a"]
+#![crate_type = "lib"]
+
+pub fn foo() {}
+```
+
+`b.rs`
+```ignore (cannot-link-with-other-tests)
+#![crate_name = "a"]
+#![crate_type = "lib"]
+
+// error: the current crate is indistinguishable from one of its dependencies:
+// it has the same crate-name `a` and was compiled with the same
+// `-C metadata` arguments. This will result in symbol conflicts between
+// the two.
+extern crate a;
+
+pub fn foo() {}
+
+fn bar() {
+ a::foo(); // is this calling the local crate or the dependency?
+}
+```
+
+The above example compiles two crates with exactly the same name and
+`crate_type` (plus any other metadata). This causes an error because it becomes
+impossible for the compiler to distinguish between symbols (`pub` item names).
+
+This error can be fixed by:
+ * Using [Cargo](../cargo/index.html), the Rust package manager, automatically
+ fixing this issue.
+ * Recompiling the crate with different metadata (different name/
+ `crate_type`).
diff --git a/compiler/rustc_error_codes/src/error_codes/E0588.md b/compiler/rustc_error_codes/src/error_codes/E0588.md
index 040c7a02e..995d945f1 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0588.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0588.md
@@ -11,7 +11,7 @@ struct Aligned(i32);
struct Packed(Aligned);
```
-Just like you cannot have both `align` and `packed` representation hints on a
+Just like you cannot have both `align` and `packed` representation hints on the
same type, a `packed` type cannot contain another type with the `align`
representation hint. However, you can do the opposite:
diff --git a/compiler/rustc_error_codes/src/error_codes/E0640.md b/compiler/rustc_error_codes/src/error_codes/E0640.md
new file mode 100644
index 000000000..7edd93e56
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0640.md
@@ -0,0 +1 @@
+#### This error code is internal to the compiler and will not be emitted with normal Rust code.
diff --git a/compiler/rustc_error_codes/src/error_codes/E0711.md b/compiler/rustc_error_codes/src/error_codes/E0711.md
new file mode 100644
index 000000000..a2150037f
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0711.md
@@ -0,0 +1,30 @@
+#### This error code is internal to the compiler and will not be emitted with normal Rust code.
+
+Feature declared with conflicting stability requirements.
+
+```compile_fail,E0711
+// NOTE: this attribute is perma-unstable and should *never* be used outside of
+// stdlib and the compiler.
+#![feature(staged_api)]
+
+#![stable(feature = "...", since = "1.0.0")]
+
+#[stable(feature = "foo", since = "1.0.0")]
+fn foo_stable_1_0_0() {}
+
+// error: feature `foo` is declared stable since 1.29.0
+#[stable(feature = "foo", since = "1.29.0")]
+fn foo_stable_1_29_0() {}
+
+// error: feature `foo` is declared unstable
+#[unstable(feature = "foo", issue = "none")]
+fn foo_unstable() {}
+```
+
+In the above example, the `foo` feature is first defined to be stable since
+1.0.0, but is then re-declared stable since 1.29.0. This discrepancy in
+versions causes an error. Furthermore, `foo` is then re-declared as unstable,
+again the conflict causes an error.
+
+This error can be fixed by splitting the feature, this allows any
+stability requirements and removes any possibility of conflict.
diff --git a/compiler/rustc_error_codes/src/error_codes/E0713.md b/compiler/rustc_error_codes/src/error_codes/E0713.md
index 9b1b77f3b..a7b9bbeb1 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0713.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0713.md
@@ -22,7 +22,7 @@ gets called when they go out of scope. This destructor gets exclusive
access to the fields of the struct when it runs.
This means that when `s` reaches the end of `demo`, its destructor
-gets exclusive access to its `&mut`-borrowed string data. allowing
+gets exclusive access to its `&mut`-borrowed string data. allowing
another borrow of that string data (`p`), to exist across the drop of
`s` would be a violation of the principle that `&mut`-borrows have
exclusive, unaliased access to their referenced data.
diff --git a/compiler/rustc_error_codes/src/error_codes/E0714.md b/compiler/rustc_error_codes/src/error_codes/E0714.md
index 45d1cafa6..b75735d60 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0714.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0714.md
@@ -15,5 +15,5 @@ fn main() {}
```
The items of marker traits cannot be overridden, so there's no need to have them
-when they cannot be changed per-type anyway. If you wanted them for ergonomic
+when they cannot be changed per-type anyway. If you wanted them for ergonomic
reasons, consider making an extension trait instead.
diff --git a/compiler/rustc_error_codes/src/error_codes/E0717.md b/compiler/rustc_error_codes/src/error_codes/E0717.md
new file mode 100644
index 000000000..7edd93e56
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0717.md
@@ -0,0 +1 @@
+#### This error code is internal to the compiler and will not be emitted with normal Rust code.
diff --git a/compiler/rustc_error_codes/src/error_codes/E0729.md b/compiler/rustc_error_codes/src/error_codes/E0729.md
index 74f89080b..3891745b5 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0729.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0729.md
@@ -1,3 +1,5 @@
+#### Note: this error code is no longer emitted by the compiler
+
Support for Non-Lexical Lifetimes (NLL) has been included in the Rust compiler
since 1.31, and has been enabled on the 2015 edition since 1.36. The new borrow
checker for NLL uncovered some bugs in the old borrow checker, which in some
diff --git a/compiler/rustc_error_codes/src/error_codes/E0792.md b/compiler/rustc_error_codes/src/error_codes/E0792.md
new file mode 100644
index 000000000..bad2b5abf
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0792.md
@@ -0,0 +1,60 @@
+A type alias impl trait can only have its hidden type assigned
+when used fully generically (and within their defining scope).
+This means
+
+```compile_fail,E0792
+#![feature(type_alias_impl_trait)]
+
+type Foo<T> = impl std::fmt::Debug;
+
+fn foo() -> Foo<u32> {
+ 5u32
+}
+```
+
+is not accepted. If it were accepted, one could create unsound situations like
+
+```compile_fail,E0792
+#![feature(type_alias_impl_trait)]
+
+type Foo<T> = impl Default;
+
+fn foo() -> Foo<u32> {
+ 5u32
+}
+
+fn main() {
+ let x = Foo::<&'static mut String>::default();
+}
+```
+
+
+Instead you need to make the function generic:
+
+```
+#![feature(type_alias_impl_trait)]
+
+type Foo<T> = impl std::fmt::Debug;
+
+fn foo<U>() -> Foo<U> {
+ 5u32
+}
+```
+
+This means that no matter the generic parameter to `foo`,
+the hidden type will always be `u32`.
+If you want to link the generic parameter to the hidden type,
+you can do that, too:
+
+
+```
+#![feature(type_alias_impl_trait)]
+
+use std::fmt::Debug;
+
+type Foo<T: Debug> = impl Debug;
+
+fn foo<U: Debug>() -> Foo<U> {
+ Vec::<U>::new()
+}
+```