about summary refs log tree commit diff
path: root/src/librustc_error_codes/error_codes
diff options
context:
space:
mode:
authorPankaj Chaudhary <pankajchaudhary172@gmail.com>2020-07-13 14:14:37 +0530
committerPankajChaudhary5 <pankajchaudhary172@gmail.com>2020-07-13 14:57:22 +0530
commitbc2b37aad7f9cbd1c97e416e6b16325b607422b8 (patch)
tree867a6176bcf763bba6e5de12bc08f034a320ac56 /src/librustc_error_codes/error_codes
parente3ae4c7345cfd06b06c6996536d7c158ce6970db (diff)
parent9d09331e00b02f81c714b0c41ce3a38380dd36a2 (diff)
downloadrust-bc2b37aad7f9cbd1c97e416e6b16325b607422b8.tar.gz
rust-bc2b37aad7f9cbd1c97e416e6b16325b607422b8.zip
Merge branch 'master' into E0688
Diffstat (limited to 'src/librustc_error_codes/error_codes')
-rw-r--r--src/librustc_error_codes/error_codes/E0055.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0060.md4
-rw-r--r--src/librustc_error_codes/error_codes/E0081.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0130.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0198.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0202.md10
-rw-r--r--src/librustc_error_codes/error_codes/E0207.md4
-rw-r--r--src/librustc_error_codes/error_codes/E0228.md40
-rw-r--r--src/librustc_error_codes/error_codes/E0230.md10
-rw-r--r--src/librustc_error_codes/error_codes/E0231.md10
-rw-r--r--src/librustc_error_codes/error_codes/E0232.md10
-rw-r--r--src/librustc_error_codes/error_codes/E0281.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0307.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0308.md9
-rw-r--r--src/librustc_error_codes/error_codes/E0364.md26
-rw-r--r--src/librustc_error_codes/error_codes/E0378.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0432.md35
-rw-r--r--src/librustc_error_codes/error_codes/E0446.md32
-rw-r--r--src/librustc_error_codes/error_codes/E0493.md12
-rw-r--r--src/librustc_error_codes/error_codes/E0539.md48
-rw-r--r--src/librustc_error_codes/error_codes/E0554.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0567.md6
-rw-r--r--src/librustc_error_codes/error_codes/E0569.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0570.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0571.md6
-rw-r--r--src/librustc_error_codes/error_codes/E0579.md10
-rw-r--r--src/librustc_error_codes/error_codes/E0581.md9
-rw-r--r--src/librustc_error_codes/error_codes/E0582.md4
-rw-r--r--src/librustc_error_codes/error_codes/E0583.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0589.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0590.md12
-rw-r--r--src/librustc_error_codes/error_codes/E0593.md11
-rw-r--r--src/librustc_error_codes/error_codes/E0599.md15
-rw-r--r--src/librustc_error_codes/error_codes/E0600.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0601.md5
-rw-r--r--src/librustc_error_codes/error_codes/E0602.md4
-rw-r--r--src/librustc_error_codes/error_codes/E0608.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0617.md11
-rw-r--r--src/librustc_error_codes/error_codes/E0619.md1
-rw-r--r--src/librustc_error_codes/error_codes/E0622.md14
-rw-r--r--src/librustc_error_codes/error_codes/E0637.md5
-rw-r--r--src/librustc_error_codes/error_codes/E0639.md12
-rw-r--r--src/librustc_error_codes/error_codes/E0641.md12
-rw-r--r--src/librustc_error_codes/error_codes/E0642.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0644.md12
-rw-r--r--src/librustc_error_codes/error_codes/E0646.md1
-rw-r--r--src/librustc_error_codes/error_codes/E0647.md3
-rw-r--r--src/librustc_error_codes/error_codes/E0648.md11
-rw-r--r--src/librustc_error_codes/error_codes/E0658.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0660.md4
-rw-r--r--src/librustc_error_codes/error_codes/E0661.md4
-rw-r--r--src/librustc_error_codes/error_codes/E0662.md4
-rw-r--r--src/librustc_error_codes/error_codes/E0663.md4
-rw-r--r--src/librustc_error_codes/error_codes/E0664.md4
-rw-r--r--src/librustc_error_codes/error_codes/E0666.md18
-rw-r--r--src/librustc_error_codes/error_codes/E0668.md13
-rw-r--r--src/librustc_error_codes/error_codes/E0669.md12
-rw-r--r--src/librustc_error_codes/error_codes/E0670.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0687.md36
-rw-r--r--src/librustc_error_codes/error_codes/E0689.md19
-rw-r--r--src/librustc_error_codes/error_codes/E0690.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0695.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0696.md49
-rw-r--r--src/librustc_error_codes/error_codes/E0698.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0699.md6
-rw-r--r--src/librustc_error_codes/error_codes/E0700.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0701.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0708.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0712.md4
-rw-r--r--src/librustc_error_codes/error_codes/E0714.md14
-rw-r--r--src/librustc_error_codes/error_codes/E0715.md19
-rw-r--r--src/librustc_error_codes/error_codes/E0724.md24
-rw-r--r--src/librustc_error_codes/error_codes/E0727.md24
-rw-r--r--src/librustc_error_codes/error_codes/E0732.md21
-rw-r--r--src/librustc_error_codes/error_codes/E0736.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0737.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0739.md1
-rw-r--r--src/librustc_error_codes/error_codes/E0740.md15
-rw-r--r--src/librustc_error_codes/error_codes/E0744.md11
-rw-r--r--src/librustc_error_codes/error_codes/E0746.md3
-rw-r--r--src/librustc_error_codes/error_codes/E0751.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0752.md11
-rw-r--r--src/librustc_error_codes/error_codes/E0753.md31
-rw-r--r--src/librustc_error_codes/error_codes/E0754.md33
-rw-r--r--src/librustc_error_codes/error_codes/E0758.md20
-rw-r--r--src/librustc_error_codes/error_codes/E0759.md67
-rw-r--r--src/librustc_error_codes/error_codes/E0760.md32
-rw-r--r--src/librustc_error_codes/error_codes/E0761.md25
-rw-r--r--src/librustc_error_codes/error_codes/E0762.md13
-rw-r--r--src/librustc_error_codes/error_codes/E0763.md13
-rw-r--r--src/librustc_error_codes/error_codes/E0764.md39
-rw-r--r--src/librustc_error_codes/error_codes/E0765.md13
-rw-r--r--src/librustc_error_codes/error_codes/E0766.md13
-rw-r--r--src/librustc_error_codes/error_codes/E0767.md20
-rw-r--r--src/librustc_error_codes/error_codes/E0768.md13
95 files changed, 926 insertions, 192 deletions
diff --git a/src/librustc_error_codes/error_codes/E0055.md b/src/librustc_error_codes/error_codes/E0055.md
index d5b863081a6..223ba400029 100644
--- a/src/librustc_error_codes/error_codes/E0055.md
+++ b/src/librustc_error_codes/error_codes/E0055.md
@@ -6,7 +6,7 @@ recursion limit (which can be set via the `recursion_limit` attribute).
 For a somewhat artificial example:
 
 ```compile_fail,E0055
-#![recursion_limit="5"]
+#![recursion_limit="4"]
 
 struct Foo;
 
diff --git a/src/librustc_error_codes/error_codes/E0060.md b/src/librustc_error_codes/error_codes/E0060.md
index 7a07b8e7ed6..e6906d72367 100644
--- a/src/librustc_error_codes/error_codes/E0060.md
+++ b/src/librustc_error_codes/error_codes/E0060.md
@@ -2,12 +2,14 @@ External C functions are allowed to be variadic. However, a variadic function
 takes a minimum number of arguments. For example, consider C's variadic `printf`
 function:
 
-```
+```compile_fail,E0060
 use std::os::raw::{c_char, c_int};
 
 extern "C" {
     fn printf(_: *const c_char, ...) -> c_int;
 }
+
+unsafe { printf(); } // error!
 ```
 
 Using this declaration, it must be called with at least one argument, so
diff --git a/src/librustc_error_codes/error_codes/E0081.md b/src/librustc_error_codes/error_codes/E0081.md
index fd5eca68e21..b834a734cef 100644
--- a/src/librustc_error_codes/error_codes/E0081.md
+++ b/src/librustc_error_codes/error_codes/E0081.md
@@ -1,4 +1,4 @@
-A discrimant value is present more than once.
+A discriminant value is present more than once.
 
 Erroneous code example:
 
diff --git a/src/librustc_error_codes/error_codes/E0130.md b/src/librustc_error_codes/error_codes/E0130.md
index 539049edb33..a270feaf58c 100644
--- a/src/librustc_error_codes/error_codes/E0130.md
+++ b/src/librustc_error_codes/error_codes/E0130.md
@@ -2,7 +2,7 @@ A pattern was declared as an argument in a foreign function declaration.
 
 Erroneous code example:
 
-```compile_fail
+```compile_fail,E0130
 extern {
     fn foo((a, b): (u32, u32)); // error: patterns aren't allowed in foreign
                                 //        function declarations
diff --git a/src/librustc_error_codes/error_codes/E0198.md b/src/librustc_error_codes/error_codes/E0198.md
index 687214a2050..90f1e542874 100644
--- a/src/librustc_error_codes/error_codes/E0198.md
+++ b/src/librustc_error_codes/error_codes/E0198.md
@@ -2,7 +2,7 @@ A negative implementation was marked as unsafe.
 
 Erroneous code example:
 
-```compile_fail
+```compile_fail,E0198
 struct Foo;
 
 unsafe impl !Clone for Foo { } // error!
diff --git a/src/librustc_error_codes/error_codes/E0202.md b/src/librustc_error_codes/error_codes/E0202.md
index b20d338c5fd..afc61ec2e48 100644
--- a/src/librustc_error_codes/error_codes/E0202.md
+++ b/src/librustc_error_codes/error_codes/E0202.md
@@ -1,5 +1,15 @@
 Inherent associated types were part of [RFC 195] but are not yet implemented.
 See [the tracking issue][iss8995] for the status of this implementation.
 
+Erroneous code example:
+
+```compile_fail,E0202
+struct Foo;
+
+impl Foo {
+    type Bar = isize; // error!
+}
+```
+
 [RFC 195]: https://github.com/rust-lang/rfcs/blob/master/text/0195-associated-items.md
 [iss8995]: https://github.com/rust-lang/rust/issues/8995
diff --git a/src/librustc_error_codes/error_codes/E0207.md b/src/librustc_error_codes/error_codes/E0207.md
index 21e7e461c75..cb4f5d5157d 100644
--- a/src/librustc_error_codes/error_codes/E0207.md
+++ b/src/librustc_error_codes/error_codes/E0207.md
@@ -1,4 +1,4 @@
-A type or lifetime parameter that is specified for `impl` is not constrained.
+A type parameter that is specified for `impl` is not constrained.
 
 Erroneous code example:
 
@@ -14,7 +14,7 @@ impl<T: Default> Foo {
 }
 ```
 
-Any type parameter or lifetime parameter of an `impl` must meet at least one of
+Any type parameter parameter of an `impl` must meet at least one of
 the following criteria:
 
  - it appears in the _implementing type_ of the impl, e.g. `impl<T> Foo<T>`
diff --git a/src/librustc_error_codes/error_codes/E0228.md b/src/librustc_error_codes/error_codes/E0228.md
new file mode 100644
index 00000000000..3443a5ae863
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0228.md
@@ -0,0 +1,40 @@
+The lifetime bound for this object type cannot be deduced from context and must
+be specified.
+
+Erroneous code example:
+
+```compile_fail,E0228
+trait Trait { }
+
+struct TwoBounds<'a, 'b, T: Sized + 'a + 'b> {
+    x: &'a i32,
+    y: &'b i32,
+    z: T,
+}
+
+type Foo<'a, 'b> = TwoBounds<'a, 'b, dyn Trait>;
+```
+
+When a trait object is used as a type argument of a generic type, Rust will try
+to infer its lifetime if unspecified. However, this isn't possible when the
+containing type has more than one lifetime bound.
+
+The above example can be resolved by either reducing the number of lifetime
+bounds to one or by making the trait object lifetime explicit, like so:
+
+```
+trait Trait { }
+
+struct TwoBounds<'a, 'b, T: Sized + 'a + 'b> {
+    x: &'a i32,
+    y: &'b i32,
+    z: T,
+}
+
+type Foo<'a, 'b> = TwoBounds<'a, 'b, dyn Trait + 'b>;
+```
+
+For more information, see [RFC 599] and its amendment [RFC 1156].
+
+[RFC 599]: https://github.com/rust-lang/rfcs/blob/master/text/0599-default-object-bound.md
+[RFC 1156]: https://github.com/rust-lang/rfcs/blob/master/text/1156-adjust-default-object-bounds.md
diff --git a/src/librustc_error_codes/error_codes/E0230.md b/src/librustc_error_codes/error_codes/E0230.md
index 9dbcb8e010b..cfb72e74319 100644
--- a/src/librustc_error_codes/error_codes/E0230.md
+++ b/src/librustc_error_codes/error_codes/E0230.md
@@ -3,15 +3,11 @@ message for when a particular trait isn't implemented on a type placed in a
 position that needs that trait. For example, when the following code is
 compiled:
 
-```compile_fail
+```compile_fail,E0230
 #![feature(rustc_attrs)]
 
-fn foo<T: Index<u8>>(x: T){}
-
-#[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
-trait Index<Idx> { /* ... */ }
-
-foo(true); // `bool` does not implement `Index<u8>`
+#[rustc_on_unimplemented = "error on `{Self}` with params `<{A},{B}>`"] // error
+trait BadAnnotation<A> {}
 ```
 
 There will be an error about `bool` not implementing `Index<u8>`, followed by a
diff --git a/src/librustc_error_codes/error_codes/E0231.md b/src/librustc_error_codes/error_codes/E0231.md
index 4f80da54540..23a0a88ecdd 100644
--- a/src/librustc_error_codes/error_codes/E0231.md
+++ b/src/librustc_error_codes/error_codes/E0231.md
@@ -3,15 +3,11 @@ message for when a particular trait isn't implemented on a type placed in a
 position that needs that trait. For example, when the following code is
 compiled:
 
-```compile_fail
+```compile_fail,E0231
 #![feature(rustc_attrs)]
 
-fn foo<T: Index<u8>>(x: T){}
-
-#[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
-trait Index<Idx> { /* ... */ }
-
-foo(true); // `bool` does not implement `Index<u8>`
+#[rustc_on_unimplemented = "error on `{Self}` with params `<{A},{}>`"] // error!
+trait BadAnnotation<A> {}
 ```
 
 there will be an error about `bool` not implementing `Index<u8>`, followed by a
diff --git a/src/librustc_error_codes/error_codes/E0232.md b/src/librustc_error_codes/error_codes/E0232.md
index 07a031488d0..b310caefa6e 100644
--- a/src/librustc_error_codes/error_codes/E0232.md
+++ b/src/librustc_error_codes/error_codes/E0232.md
@@ -3,15 +3,11 @@ message for when a particular trait isn't implemented on a type placed in a
 position that needs that trait. For example, when the following code is
 compiled:
 
-```compile_fail
+```compile_fail,E0232
 #![feature(rustc_attrs)]
 
-fn foo<T: Index<u8>>(x: T){}
-
-#[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
-trait Index<Idx> { /* ... */ }
-
-foo(true); // `bool` does not implement `Index<u8>`
+#[rustc_on_unimplemented(lorem="")] // error!
+trait BadAnnotation {}
 ```
 
 there will be an error about `bool` not implementing `Index<u8>`, followed by a
diff --git a/src/librustc_error_codes/error_codes/E0281.md b/src/librustc_error_codes/error_codes/E0281.md
index 1a9796d2790..1d7904b67dd 100644
--- a/src/librustc_error_codes/error_codes/E0281.md
+++ b/src/librustc_error_codes/error_codes/E0281.md
@@ -4,7 +4,7 @@ You tried to supply a type which doesn't implement some trait in a location
 which expected that trait. This error typically occurs when working with
 `Fn`-based types. Erroneous code example:
 
-```compile-fail
+```compile_fail
 fn foo<F: Fn(usize)>(x: F) { }
 
 fn main() {
diff --git a/src/librustc_error_codes/error_codes/E0307.md b/src/librustc_error_codes/error_codes/E0307.md
index 52707b93acc..0d29d56ea1a 100644
--- a/src/librustc_error_codes/error_codes/E0307.md
+++ b/src/librustc_error_codes/error_codes/E0307.md
@@ -64,7 +64,7 @@ impl Trait for Foo {
 }
 ```
 
-The nightly feature [Arbintrary self types][AST] extends the accepted
+The nightly feature [Arbitrary self types][AST] extends the accepted
 set of receiver types to also include any type that can dereference to
 `Self`:
 
diff --git a/src/librustc_error_codes/error_codes/E0308.md b/src/librustc_error_codes/error_codes/E0308.md
index b2c84370490..e2c40f03019 100644
--- a/src/librustc_error_codes/error_codes/E0308.md
+++ b/src/librustc_error_codes/error_codes/E0308.md
@@ -12,8 +12,7 @@ let x: i32 = "I am not a number!";
 //    type `i32` assigned to variable `x`
 ```
 
-This error occurs when the compiler was unable to infer the concrete type of a
-variable. It can happen in several cases, the most common being a mismatch
-between the type that the compiler inferred for a variable based on its
-initializing expression, on the one hand, and the type the author explicitly
-assigned to the variable, on the other hand.
+This error occurs when the compiler is unable to infer the concrete type of a
+variable. It can occur in several cases, the most common being a mismatch
+between two types: the type the author explicitly assigned, and the type the
+compiler inferred.
diff --git a/src/librustc_error_codes/error_codes/E0364.md b/src/librustc_error_codes/error_codes/E0364.md
index ec1fb911f3c..d01fb0c9c42 100644
--- a/src/librustc_error_codes/error_codes/E0364.md
+++ b/src/librustc_error_codes/error_codes/E0364.md
@@ -3,27 +3,27 @@ attempted to `pub use` a type or value that was not itself public.
 
 Erroneous code example:
 
-```compile_fail
-mod foo {
-    const X: u32 = 1;
-}
-
-pub use foo::X;
+```compile_fail,E0364
+mod a {
+    fn foo() {}
 
-fn main() {}
+    mod a {
+        pub use super::foo; // error!
+    }
+}
 ```
 
 The solution to this problem is to ensure that the items that you are
 re-exporting are themselves marked with `pub`:
 
 ```
-mod foo {
-    pub const X: u32 = 1;
-}
-
-pub use foo::X;
+mod a {
+    pub fn foo() {} // ok!
 
-fn main() {}
+    mod a {
+        pub use super::foo;
+    }
+}
 ```
 
 See the [Use Declarations][use-declarations] section of the reference for
diff --git a/src/librustc_error_codes/error_codes/E0378.md b/src/librustc_error_codes/error_codes/E0378.md
index 7f4374738de..c6fe997f3dc 100644
--- a/src/librustc_error_codes/error_codes/E0378.md
+++ b/src/librustc_error_codes/error_codes/E0378.md
@@ -3,7 +3,7 @@ or a newtype wrapper around a pointer.
 
 Erroneous code example:
 
-```compile-fail,E0378
+```compile_fail,E0378
 #![feature(dispatch_from_dyn)]
 use std::ops::DispatchFromDyn;
 
diff --git a/src/librustc_error_codes/error_codes/E0432.md b/src/librustc_error_codes/error_codes/E0432.md
index b562a85b785..a6e2acac5d2 100644
--- a/src/librustc_error_codes/error_codes/E0432.md
+++ b/src/librustc_error_codes/error_codes/E0432.md
@@ -6,14 +6,20 @@ Erroneous code example:
 use something::Foo; // error: unresolved import `something::Foo`.
 ```
 
-Paths in `use` statements are relative to the crate root. To import items
-relative to the current and parent modules, use the `self::` and `super::`
-prefixes, respectively. Also verify that you didn't misspell the import
-name and that the import exists in the module from where you tried to
-import it. Example:
+In Rust 2015, paths in `use` statements are relative to the crate root. To
+import items relative to the current and parent modules, use the `self::` and
+`super::` prefixes, respectively.
+
+In Rust 2018, paths in `use` statements are relative to the current module
+unless they begin with the name of a crate or a literal `crate::`, in which
+case they start from the crate root. As in Rust 2015 code, the `self::` and
+`super::` prefixes refer to the current and parent modules respectively.
+
+Also verify that you didn't misspell the import name and that the import exists
+in the module from where you tried to import it. Example:
 
 ```
-use self::something::Foo; // ok!
+use self::something::Foo; // Ok.
 
 mod something {
     pub struct Foo;
@@ -21,12 +27,21 @@ mod something {
 # fn main() {}
 ```
 
-Or, if you tried to use a module from an external crate, you may have missed
-the `extern crate` declaration (which is usually placed in the crate root):
+If you tried to use a module from an external crate and are using Rust 2015,
+you may have missed the `extern crate` declaration (which is usually placed in
+the crate root):
 
-```
-extern crate core; // Required to use the `core` crate
+```edition2015
+extern crate core; // Required to use the `core` crate in Rust 2015.
 
 use core::any;
 # fn main() {}
 ```
+
+In Rust 2018 the `extern crate` declaration is not required and you can instead
+just `use` it:
+
+```edition2018
+use core::any; // No extern crate required in Rust 2018.
+# fn main() {}
+```
diff --git a/src/librustc_error_codes/error_codes/E0446.md b/src/librustc_error_codes/error_codes/E0446.md
index 77a1834ece4..6ec47c4962c 100644
--- a/src/librustc_error_codes/error_codes/E0446.md
+++ b/src/librustc_error_codes/error_codes/E0446.md
@@ -4,10 +4,10 @@ Erroneous code example:
 
 ```compile_fail,E0446
 #![deny(private_in_public)]
+struct Bar(u32);
 
-mod Foo {
-    struct Bar(u32);
-
+mod foo {
+    use crate::Bar;
     pub fn bar() -> Bar { // error: private type in public interface
         Bar(0)
     }
@@ -16,15 +16,31 @@ mod Foo {
 fn main() {}
 ```
 
-To solve this error, please ensure that the type is also public. The type
-can be made inaccessible if necessary by placing it into a private inner
-module, but it still has to be marked with `pub`.
+There are two ways to solve this error. The first is to make the public type
+signature only public to a module that also has access to the private type.
+This is done by using pub(crate) or pub(in crate::my_mod::etc)
 Example:
 
 ```
-mod Foo {
-    pub struct Bar(u32); // we set the Bar type public
+struct Bar(u32);
+
+mod foo {
+    use crate::Bar;
+    pub(crate) fn bar() -> Bar { // only public to crate root
+        Bar(0)
+    }
+}
 
+fn main() {}
+```
+
+The other way to solve this error is to make the private type public.
+Example:
+
+```
+pub struct Bar(u32); // we set the Bar type public
+mod foo {
+    use crate::Bar;
     pub fn bar() -> Bar { // ok!
         Bar(0)
     }
diff --git a/src/librustc_error_codes/error_codes/E0493.md b/src/librustc_error_codes/error_codes/E0493.md
index 90a0cbce623..0dcc3b62b4b 100644
--- a/src/librustc_error_codes/error_codes/E0493.md
+++ b/src/librustc_error_codes/error_codes/E0493.md
@@ -1,5 +1,4 @@
-A type with a `Drop` implementation was destructured when trying to initialize
-a static item.
+A value with a custom `Drop` implementation may be dropped during const-eval.
 
 Erroneous code example:
 
@@ -16,13 +15,14 @@ struct Foo {
     field1: DropType,
 }
 
-static FOO: Foo = Foo { ..Foo { field1: DropType::A } }; // error!
+static FOO: Foo = Foo { field1: (DropType::A, DropType::A).1 }; // error!
 ```
 
 The problem here is that if the given type or one of its fields implements the
-`Drop` trait, this `Drop` implementation cannot be called during the static
-type initialization which might cause a memory leak. To prevent this issue,
-you need to instantiate all the static type's fields by hand.
+`Drop` trait, this `Drop` implementation cannot be called within a const
+context since it may run arbitrary, non-const-checked code. To prevent this
+issue, ensure all values with custom a custom `Drop` implementation escape the
+initializer.
 
 ```
 enum DropType {
diff --git a/src/librustc_error_codes/error_codes/E0539.md b/src/librustc_error_codes/error_codes/E0539.md
new file mode 100644
index 00000000000..df2d7d910bb
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0539.md
@@ -0,0 +1,48 @@
+An invalid meta-item was used inside an attribute.
+
+Erroneous code example:
+
+```compile_fail,E0539
+#![feature(staged_api)]
+#![stable(since = "1.0.0", feature = "test")]
+
+#[rustc_deprecated(reason)] // error!
+#[unstable(feature = "deprecated_fn", issue = "123")]
+fn deprecated() {}
+
+#[unstable(feature = "unstable_struct", issue)] // error!
+struct Unstable;
+
+#[rustc_const_unstable(feature)] // error!
+const fn unstable_fn() {}
+
+#[stable(feature = "stable_struct", since)] // error!
+struct Stable;
+
+#[rustc_const_stable(feature)] // error!
+const fn stable_fn() {}
+```
+
+Meta items are the key-value pairs inside of an attribute.
+To fix these issues you need to give required key-value pairs.
+
+```
+#![feature(staged_api)]
+#![stable(since = "1.0.0", feature = "test")]
+
+#[rustc_deprecated(since = "1.39.0", reason = "reason")] // ok!
+#[unstable(feature = "deprecated_fn", issue = "123")]
+fn deprecated() {}
+
+#[unstable(feature = "unstable_struct", issue = "123")] // ok!
+struct Unstable;
+
+#[rustc_const_unstable(feature = "unstable_fn", issue = "124")] // ok!
+const fn unstable_fn() {}
+
+#[stable(feature = "stable_struct", since = "1.39.0")] // ok!
+struct Stable;
+
+#[rustc_const_stable(feature = "stable_fn", since = "1.39.0")] // ok!
+const fn stable_fn() {}
+```
diff --git a/src/librustc_error_codes/error_codes/E0554.md b/src/librustc_error_codes/error_codes/E0554.md
index e25212983eb..e55fa4c6ede 100644
--- a/src/librustc_error_codes/error_codes/E0554.md
+++ b/src/librustc_error_codes/error_codes/E0554.md
@@ -1,7 +1,7 @@
 Feature attributes are only allowed on the nightly release channel. Stable or
 beta compilers will not comply.
 
-Example of erroneous code (on a stable compiler):
+Erroneous code example:
 
 ```ignore (depends on release channel)
 #![feature(non_ascii_idents)] // error: `#![feature]` may not be used on the
diff --git a/src/librustc_error_codes/error_codes/E0567.md b/src/librustc_error_codes/error_codes/E0567.md
index ec1ed03c126..05cf8fed031 100644
--- a/src/librustc_error_codes/error_codes/E0567.md
+++ b/src/librustc_error_codes/error_codes/E0567.md
@@ -6,8 +6,7 @@ Erroneous code example:
 #![feature(optin_builtin_traits)]
 
 auto trait Generic<T> {} // error!
-
-fn main() {}
+# fn main() {}
 ```
 
 Since an auto trait is implemented on all existing types, the
@@ -20,6 +19,5 @@ To fix this issue, just remove the generics:
 #![feature(optin_builtin_traits)]
 
 auto trait Generic {} // ok!
-
-fn main() {}
+# fn main() {}
 ```
diff --git a/src/librustc_error_codes/error_codes/E0569.md b/src/librustc_error_codes/error_codes/E0569.md
index 4cba0cf9c96..2ca2b57ecac 100644
--- a/src/librustc_error_codes/error_codes/E0569.md
+++ b/src/librustc_error_codes/error_codes/E0569.md
@@ -1,5 +1,5 @@
 If an impl has a generic parameter with the `#[may_dangle]` attribute, then
-that impl must be declared as an `unsafe impl.
+that impl must be declared as an `unsafe impl`.
 
 Erroneous code example:
 
diff --git a/src/librustc_error_codes/error_codes/E0570.md b/src/librustc_error_codes/error_codes/E0570.md
index bf9615f8738..355e71ffb43 100644
--- a/src/librustc_error_codes/error_codes/E0570.md
+++ b/src/librustc_error_codes/error_codes/E0570.md
@@ -1,6 +1,6 @@
 The requested ABI is unsupported by the current target.
 
-The rust compiler maintains for each target a blacklist of ABIs unsupported on
+The rust compiler maintains for each target a list of unsupported ABIs on
 that target. If an ABI is present in such a list this usually means that the
 target / ABI combination is currently unsupported by llvm.
 
diff --git a/src/librustc_error_codes/error_codes/E0571.md b/src/librustc_error_codes/error_codes/E0571.md
index c2a3a8d7588..eadae05aa30 100644
--- a/src/librustc_error_codes/error_codes/E0571.md
+++ b/src/librustc_error_codes/error_codes/E0571.md
@@ -7,7 +7,7 @@ Example of erroneous code:
 # fn satisfied(n: usize) -> bool { n % 23 == 0 }
 let result = while true {
     if satisfied(i) {
-        break 2*i; // error: `break` with value from a `while` loop
+        break 2 * i; // error: `break` with value from a `while` loop
     }
     i += 1;
 };
@@ -22,9 +22,9 @@ Make sure `break value;` statements only occur in `loop` loops:
 ```
 # let mut i = 1;
 # fn satisfied(n: usize) -> bool { n % 23 == 0 }
-let result = loop { // ok!
+let result = loop { // This is now a "loop" loop.
     if satisfied(i) {
-        break 2*i;
+        break 2 * i; // ok!
     }
     i += 1;
 };
diff --git a/src/librustc_error_codes/error_codes/E0579.md b/src/librustc_error_codes/error_codes/E0579.md
index 225e27f0cab..f554242a3d4 100644
--- a/src/librustc_error_codes/error_codes/E0579.md
+++ b/src/librustc_error_codes/error_codes/E0579.md
@@ -1,7 +1,4 @@
-When matching against an exclusive range, the compiler verifies that the range
-is non-empty. Exclusive range patterns include the start point but not the end
-point, so this is equivalent to requiring the start of the range to be less
-than the end of the range.
+A lower range wasn't less than the upper range.
 
 Erroneous code example:
 
@@ -17,3 +14,8 @@ fn main() {
     }
 }
 ```
+
+When matching against an exclusive range, the compiler verifies that the range
+is non-empty. Exclusive range patterns include the start point but not the end
+point, so this is equivalent to requiring the start of the range to be less
+than the end of the range.
diff --git a/src/librustc_error_codes/error_codes/E0581.md b/src/librustc_error_codes/error_codes/E0581.md
index 947ec255a9d..89f6e3269ec 100644
--- a/src/librustc_error_codes/error_codes/E0581.md
+++ b/src/librustc_error_codes/error_codes/E0581.md
@@ -1,4 +1,4 @@
-In a `fn` type, a lifetime appears only in the return type,
+In a `fn` type, a lifetime appears only in the return type
 and not in the arguments types.
 
 Erroneous code example:
@@ -10,8 +10,11 @@ fn main() {
 }
 ```
 
-To fix this issue, either use the lifetime in the arguments, or use
-`'static`. Example:
+The problem here is that the lifetime isn't contrained by any of the arguments,
+making it impossible to determine how long it's supposed to live.
+
+To fix this issue, either use the lifetime in the arguments, or use the
+`'static` lifetime. Example:
 
 ```
 fn main() {
diff --git a/src/librustc_error_codes/error_codes/E0582.md b/src/librustc_error_codes/error_codes/E0582.md
index c0cf44852c4..e50cc60ea33 100644
--- a/src/librustc_error_codes/error_codes/E0582.md
+++ b/src/librustc_error_codes/error_codes/E0582.md
@@ -1,5 +1,5 @@
-A lifetime appears only in an associated-type binding,
-and not in the input types to the trait.
+A lifetime is only present in an associated-type binding, and not in the input
+types to the trait.
 
 Erroneous code example:
 
diff --git a/src/librustc_error_codes/error_codes/E0583.md b/src/librustc_error_codes/error_codes/E0583.md
index 2dcbbf88556..701900bb0cd 100644
--- a/src/librustc_error_codes/error_codes/E0583.md
+++ b/src/librustc_error_codes/error_codes/E0583.md
@@ -2,7 +2,7 @@ A file wasn't found for an out-of-line module.
 
 Erroneous code example:
 
-```ignore (compile_fail not working here; see Issue #43707)
+```compile_fail,E0583
 mod file_that_doesnt_exist; // error: file not found for module
 
 fn main() {}
diff --git a/src/librustc_error_codes/error_codes/E0589.md b/src/librustc_error_codes/error_codes/E0589.md
index 5e15a875b0b..8a4f8d21725 100644
--- a/src/librustc_error_codes/error_codes/E0589.md
+++ b/src/librustc_error_codes/error_codes/E0589.md
@@ -1,6 +1,8 @@
 The value of `N` that was specified for `repr(align(N))` was not a power
 of two, or was greater than 2^29.
 
+Erroneous code example:
+
 ```compile_fail,E0589
 #[repr(align(15))] // error: invalid `repr(align)` attribute: not a power of two
 enum Foo {
diff --git a/src/librustc_error_codes/error_codes/E0590.md b/src/librustc_error_codes/error_codes/E0590.md
index 8032e45903c..11005b8336f 100644
--- a/src/librustc_error_codes/error_codes/E0590.md
+++ b/src/librustc_error_codes/error_codes/E0590.md
@@ -1,13 +1,17 @@
-`break` or `continue` must include a label when used in the condition of a
-`while` loop.
+`break` or `continue` keywords were used in a condition of a `while` loop
+without a label.
 
-Example of erroneous code:
+Erroneous code code:
 
-```compile_fail
+```compile_fail,E0590
 while break {}
 ```
 
+`break` or `continue` must include a label when used in the condition of a
+`while` loop.
+
 To fix this, add a label specifying which loop is being broken out of:
+
 ```
 'foo: while break 'foo {}
 ```
diff --git a/src/librustc_error_codes/error_codes/E0593.md b/src/librustc_error_codes/error_codes/E0593.md
index b32923a9e5f..1902d73f4d0 100644
--- a/src/librustc_error_codes/error_codes/E0593.md
+++ b/src/librustc_error_codes/error_codes/E0593.md
@@ -11,3 +11,14 @@ fn main() {
     foo(|y| { });
 }
 ```
+
+You have to provide the same number of arguments as expected by the `Fn`-based
+type. So to fix the previous example, we need to remove the `y` argument:
+
+```
+fn foo<F: Fn()>(x: F) { }
+
+fn main() {
+    foo(|| { }); // ok!
+}
+```
diff --git a/src/librustc_error_codes/error_codes/E0599.md b/src/librustc_error_codes/error_codes/E0599.md
index c44e60571e1..5b1590b2999 100644
--- a/src/librustc_error_codes/error_codes/E0599.md
+++ b/src/librustc_error_codes/error_codes/E0599.md
@@ -9,3 +9,18 @@ let x = Mouth;
 x.chocolate(); // error: no method named `chocolate` found for type `Mouth`
                //        in the current scope
 ```
+
+In this case, you need to implement the `chocolate` method to fix the error:
+
+```
+struct Mouth;
+
+impl Mouth {
+    fn chocolate(&self) { // We implement the `chocolate` method here.
+        println!("Hmmm! I love chocolate!");
+    }
+}
+
+let x = Mouth;
+x.chocolate(); // ok!
+```
diff --git a/src/librustc_error_codes/error_codes/E0600.md b/src/librustc_error_codes/error_codes/E0600.md
index 172e2a346c5..356006c72f3 100644
--- a/src/librustc_error_codes/error_codes/E0600.md
+++ b/src/librustc_error_codes/error_codes/E0600.md
@@ -1,6 +1,6 @@
 An unary operator was used on a type which doesn't implement it.
 
-Example of erroneous code:
+Erroneous code example:
 
 ```compile_fail,E0600
 enum Question {
diff --git a/src/librustc_error_codes/error_codes/E0601.md b/src/librustc_error_codes/error_codes/E0601.md
index 8180c5db46f..7194b7971d3 100644
--- a/src/librustc_error_codes/error_codes/E0601.md
+++ b/src/librustc_error_codes/error_codes/E0601.md
@@ -1,5 +1,6 @@
-No `main` function was found in a binary crate. To fix this error, add a
-`main` function. For example:
+No `main` function was found in a binary crate.
+
+To fix this error, add a `main` function:
 
 ```
 fn main() {
diff --git a/src/librustc_error_codes/error_codes/E0602.md b/src/librustc_error_codes/error_codes/E0602.md
index ca7138a60cc..dcaf251a96b 100644
--- a/src/librustc_error_codes/error_codes/E0602.md
+++ b/src/librustc_error_codes/error_codes/E0602.md
@@ -1,9 +1,9 @@
 An unknown lint was used on the command line.
 
-Erroneous example:
+Erroneous code example:
 
 ```sh
-rustc -D bogus omse_file.rs
+rustc -D bogus rust_file.rs
 ```
 
 Maybe you just misspelled the lint name or the lint doesn't exist anymore.
diff --git a/src/librustc_error_codes/error_codes/E0608.md b/src/librustc_error_codes/error_codes/E0608.md
index 598f1e655e9..d0ebc3a26f0 100644
--- a/src/librustc_error_codes/error_codes/E0608.md
+++ b/src/librustc_error_codes/error_codes/E0608.md
@@ -1,4 +1,4 @@
-An attempt to index into a type which doesn't implement the `std::ops::Index`
+An attempt to use index on a type which doesn't implement the `std::ops::Index`
 trait was performed.
 
 Erroneous code example:
diff --git a/src/librustc_error_codes/error_codes/E0617.md b/src/librustc_error_codes/error_codes/E0617.md
index f4357ff755e..61b56766c26 100644
--- a/src/librustc_error_codes/error_codes/E0617.md
+++ b/src/librustc_error_codes/error_codes/E0617.md
@@ -17,3 +17,14 @@ Certain Rust types must be cast before passing them to a variadic function,
 because of arcane ABI rules dictated by the C standard. To fix the error,
 cast the value to the type specified by the error message (which you may need
 to import from `std::os::raw`).
+
+In this case, `c_double` has the same size as `f64` so we can use it directly:
+
+```no_run
+# extern {
+#     fn printf(c: *const i8, ...);
+# }
+unsafe {
+    printf(::std::ptr::null(), 0f64); // ok!
+}
+```
diff --git a/src/librustc_error_codes/error_codes/E0619.md b/src/librustc_error_codes/error_codes/E0619.md
index 8727692c0a5..f516de43095 100644
--- a/src/librustc_error_codes/error_codes/E0619.md
+++ b/src/librustc_error_codes/error_codes/E0619.md
@@ -1,4 +1,5 @@
 #### Note: this error code is no longer emitted by the compiler.
+
 The type-checker needed to know the type of an expression, but that type had not
 yet been inferred.
 
diff --git a/src/librustc_error_codes/error_codes/E0622.md b/src/librustc_error_codes/error_codes/E0622.md
index 1de81dabb29..990a2549412 100644
--- a/src/librustc_error_codes/error_codes/E0622.md
+++ b/src/librustc_error_codes/error_codes/E0622.md
@@ -5,8 +5,7 @@ Erroneous code example:
 ```compile_fail,E0622
 #![feature(intrinsics)]
 extern "rust-intrinsic" {
-    pub static breakpoint : unsafe extern "rust-intrinsic" fn();
-    // error: intrinsic must be a function
+    pub static breakpoint : fn(); // error: intrinsic must be a function
 }
 
 fn main() { unsafe { breakpoint(); } }
@@ -14,4 +13,13 @@ fn main() { unsafe { breakpoint(); } }
 
 An intrinsic is a function available for use in a given programming language
 whose implementation is handled specially by the compiler. In order to fix this
-error, just declare a function.
+error, just declare a function. Example:
+
+```no_run
+#![feature(intrinsics)]
+extern "rust-intrinsic" {
+    pub fn breakpoint(); // ok!
+}
+
+fn main() { unsafe { breakpoint(); } }
+```
diff --git a/src/librustc_error_codes/error_codes/E0637.md b/src/librustc_error_codes/error_codes/E0637.md
index e114d3d0f94..d9068950bdf 100644
--- a/src/librustc_error_codes/error_codes/E0637.md
+++ b/src/librustc_error_codes/error_codes/E0637.md
@@ -1,6 +1,7 @@
 An underscore `_` character has been used as the identifier for a lifetime.
 
-Erroneous example:
+Erroneous code example:
+
 ```compile_fail,E0106,E0637
 fn longest<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str {
          //^^ `'_` is a reserved lifetime name
@@ -11,6 +12,7 @@ fn longest<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str {
     }
 }
 ```
+
 `'_`, cannot be used as a lifetime identifier because it is a reserved for the
 anonymous lifetime. To fix this, use a lowercase letter such as 'a, or a series
 of lowercase letters such as `'foo`.  For more information, see [the
@@ -18,6 +20,7 @@ book][bk-no].  For more information on using the anonymous lifetime in rust
 nightly, see [the nightly book][bk-al].
 
 Corrected example:
+
 ```
 fn longest<'a>(str1: &'a str, str2: &'a str) -> &'a str {
     if str1.len() > str2.len() {
diff --git a/src/librustc_error_codes/error_codes/E0639.md b/src/librustc_error_codes/error_codes/E0639.md
index c2d9662337f..4646e37fb75 100644
--- a/src/librustc_error_codes/error_codes/E0639.md
+++ b/src/librustc_error_codes/error_codes/E0639.md
@@ -3,5 +3,17 @@ instantiated from outside of the defining crate as it has been marked
 as `non_exhaustive` and as such more fields/variants may be added in
 future that could cause adverse side effects for this code.
 
+Erroneous code example:
+
+```ignore (it only works cross-crate)
+#[non_exhaustive]
+pub struct NormalStruct {
+    pub first_field: u16,
+    pub second_field: u16,
+}
+
+let ns = NormalStruct { first_field: 640, second_field: 480 }; // error!
+```
+
 It is recommended that you look for a `new` function or equivalent in the
 crate's documentation.
diff --git a/src/librustc_error_codes/error_codes/E0641.md b/src/librustc_error_codes/error_codes/E0641.md
index e2110042c7e..5848e9b5c05 100644
--- a/src/librustc_error_codes/error_codes/E0641.md
+++ b/src/librustc_error_codes/error_codes/E0641.md
@@ -1,19 +1,19 @@
 Attempted to cast to/from a pointer with an unknown kind.
 
-Erroneous code examples:
+Erroneous code example:
 
 ```compile_fail,E0641
 let b = 0 as *const _; // error
 ```
 
-Must give information for type of pointer that is being cast from/to if the
-type cannot be inferred.
+Type information must be provided if a pointer type being cast from/into another
+type which cannot be inferred:
 
 ```
 // Creating a pointer from reference: type can be inferred
-let a = &(String::from("Hello world!")) as *const _; // Ok
+let a = &(String::from("Hello world!")) as *const _; // ok!
 
-let b = 0 as *const i32; // Ok
+let b = 0 as *const i32; // ok!
 
-let c: *const i32 = 0 as *const _; // Ok
+let c: *const i32 = 0 as *const _; // ok!
 ```
diff --git a/src/librustc_error_codes/error_codes/E0642.md b/src/librustc_error_codes/error_codes/E0642.md
index 592ada6ecad..c790aa154bd 100644
--- a/src/librustc_error_codes/error_codes/E0642.md
+++ b/src/librustc_error_codes/error_codes/E0642.md
@@ -1,6 +1,6 @@
 Trait methods currently cannot take patterns as arguments.
 
-Example of erroneous code:
+Erroneous code example:
 
 ```compile_fail,E0642
 trait Foo {
diff --git a/src/librustc_error_codes/error_codes/E0644.md b/src/librustc_error_codes/error_codes/E0644.md
index 7a653bd2264..8c68da3b2f3 100644
--- a/src/librustc_error_codes/error_codes/E0644.md
+++ b/src/librustc_error_codes/error_codes/E0644.md
@@ -1,18 +1,18 @@
 A closure or generator was constructed that references its own type.
 
-Erroneous example:
+Erroneous code example:
 
-```compile-fail,E0644
+```compile_fail,E0644
 fn fix<F>(f: &F)
   where F: Fn(&F)
 {
-  f(&f);
+    f(&f);
 }
 
 fn main() {
-  fix(&|y| {
-    // Here, when `x` is called, the parameter `y` is equal to `x`.
-  });
+    fix(&|y| {
+        // Here, when `x` is called, the parameter `y` is equal to `x`.
+    });
 }
 ```
 
diff --git a/src/librustc_error_codes/error_codes/E0646.md b/src/librustc_error_codes/error_codes/E0646.md
index e01dbae8b90..1e9ec7d4380 100644
--- a/src/librustc_error_codes/error_codes/E0646.md
+++ b/src/librustc_error_codes/error_codes/E0646.md
@@ -1,4 +1,5 @@
 It is not possible to define `main` with a where clause.
+
 Erroneous code example:
 
 ```compile_fail,E0646
diff --git a/src/librustc_error_codes/error_codes/E0647.md b/src/librustc_error_codes/error_codes/E0647.md
index 131db38c00d..8ca6e777f30 100644
--- a/src/librustc_error_codes/error_codes/E0647.md
+++ b/src/librustc_error_codes/error_codes/E0647.md
@@ -1,4 +1,5 @@
-It is not possible to define `start` with a where clause.
+The `start` function was defined with a where clause.
+
 Erroneous code example:
 
 ```compile_fail,E0647
diff --git a/src/librustc_error_codes/error_codes/E0648.md b/src/librustc_error_codes/error_codes/E0648.md
index 319bae103f3..d99dc19503d 100644
--- a/src/librustc_error_codes/error_codes/E0648.md
+++ b/src/librustc_error_codes/error_codes/E0648.md
@@ -1,6 +1,15 @@
-`export_name` attributes may not contain null characters (`\0`).
+An `export_name` attribute contains null characters (`\0`).
+
+Erroneous code example:
 
 ```compile_fail,E0648
 #[export_name="\0foo"] // error: `export_name` may not contain null characters
 pub fn bar() {}
 ```
+
+To fix this error, remove the null characters:
+
+```
+#[export_name="foo"] // ok!
+pub fn bar() {}
+```
diff --git a/src/librustc_error_codes/error_codes/E0658.md b/src/librustc_error_codes/error_codes/E0658.md
index 44a38cee23d..d821b9027f1 100644
--- a/src/librustc_error_codes/error_codes/E0658.md
+++ b/src/librustc_error_codes/error_codes/E0658.md
@@ -2,7 +2,7 @@ An unstable feature was used.
 
 Erroneous code example:
 
-```compile_fail,E658
+```compile_fail,E0658
 #[repr(u128)] // error: use of unstable library feature 'repr128'
 enum Foo {
     Bar(u64),
diff --git a/src/librustc_error_codes/error_codes/E0660.md b/src/librustc_error_codes/error_codes/E0660.md
index 732de6a3818..fccd1b96f60 100644
--- a/src/librustc_error_codes/error_codes/E0660.md
+++ b/src/librustc_error_codes/error_codes/E0660.md
@@ -7,6 +7,6 @@ llvm_asm!("nop" "nop");
 ```
 
 Considering that this would be a long explanation, we instead recommend you
-take a look at the [`asm`] chapter of the Unstable book:
+take a look at the [`llvm_asm`] chapter of the Unstable book:
 
-[asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/asm.html
+[llvm_asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/llvm-asm.html
diff --git a/src/librustc_error_codes/error_codes/E0661.md b/src/librustc_error_codes/error_codes/E0661.md
index 3d5cd90f6a3..f1debee7a18 100644
--- a/src/librustc_error_codes/error_codes/E0661.md
+++ b/src/librustc_error_codes/error_codes/E0661.md
@@ -8,6 +8,6 @@ llvm_asm!("nop" : "r"(a));
 ```
 
 Considering that this would be a long explanation, we instead recommend you
-take a look at the [`asm`] chapter of the Unstable book:
+take a look at the [`llvm_asm`] chapter of the Unstable book:
 
-[asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/asm.html
+[llvm_asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/llvm-asm.html
diff --git a/src/librustc_error_codes/error_codes/E0662.md b/src/librustc_error_codes/error_codes/E0662.md
index 9858abd10c5..d4765f078b0 100644
--- a/src/librustc_error_codes/error_codes/E0662.md
+++ b/src/librustc_error_codes/error_codes/E0662.md
@@ -11,6 +11,6 @@ llvm_asm!("xor %eax, %eax"
 ```
 
 Considering that this would be a long explanation, we instead recommend you
-take a look at the [`asm`] chapter of the Unstable book:
+take a look at the [`llvm_asm`] chapter of the Unstable book:
 
-[asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/asm.html
+[llvm_asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/llvm-asm.html
diff --git a/src/librustc_error_codes/error_codes/E0663.md b/src/librustc_error_codes/error_codes/E0663.md
index 36b87be7d6e..d5a85b275db 100644
--- a/src/librustc_error_codes/error_codes/E0663.md
+++ b/src/librustc_error_codes/error_codes/E0663.md
@@ -11,6 +11,6 @@ llvm_asm!("xor %eax, %eax"
 ```
 
 Considering that this would be a long explanation, we instead recommend you
-take a look at the [`asm`] chapter of the Unstable book:
+take a look at the [`llvm_asm`] chapter of the Unstable book:
 
-[asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/asm.html
+[llvm_asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/llvm-asm.html
diff --git a/src/librustc_error_codes/error_codes/E0664.md b/src/librustc_error_codes/error_codes/E0664.md
index 33924b14e6d..ce9c9491df3 100644
--- a/src/librustc_error_codes/error_codes/E0664.md
+++ b/src/librustc_error_codes/error_codes/E0664.md
@@ -11,6 +11,6 @@ llvm_asm!("mov $$0x200, %eax"
 ```
 
 Considering that this would be a long explanation, we instead recommend you
-take a look at the [`asm`] chapter of the Unstable book:
+take a look at the [`llvm_asm`] chapter of the Unstable book:
 
-[asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/asm.html
+[llvm_asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/llvm-asm.html
diff --git a/src/librustc_error_codes/error_codes/E0666.md b/src/librustc_error_codes/error_codes/E0666.md
index 22133683dc5..1a0dc5a5229 100644
--- a/src/librustc_error_codes/error_codes/E0666.md
+++ b/src/librustc_error_codes/error_codes/E0666.md
@@ -1,21 +1,25 @@
-`impl Trait` types cannot appear nested in the
-generic arguments of other `impl Trait` types.
+`impl Trait` types cannot appear nested in the generic arguments of other
+`impl Trait` types.
 
-Example of erroneous code:
+Erroneous code example:
 
 ```compile_fail,E0666
 trait MyGenericTrait<T> {}
 trait MyInnerTrait {}
 
-fn foo(bar: impl MyGenericTrait<impl MyInnerTrait>) {}
+fn foo(
+    bar: impl MyGenericTrait<impl MyInnerTrait>, // error!
+) {}
 ```
 
-Type parameters for `impl Trait` types must be
-explicitly defined as named generic parameters:
+Type parameters for `impl Trait` types must be explicitly defined as named
+generic parameters:
 
 ```
 trait MyGenericTrait<T> {}
 trait MyInnerTrait {}
 
-fn foo<T: MyInnerTrait>(bar: impl MyGenericTrait<T>) {}
+fn foo<T: MyInnerTrait>(
+    bar: impl MyGenericTrait<T>, // ok!
+) {}
 ```
diff --git a/src/librustc_error_codes/error_codes/E0668.md b/src/librustc_error_codes/error_codes/E0668.md
index 3b43a1bcae9..b6fedfe53fc 100644
--- a/src/librustc_error_codes/error_codes/E0668.md
+++ b/src/librustc_error_codes/error_codes/E0668.md
@@ -1,11 +1,7 @@
 Malformed inline assembly rejected by LLVM.
 
-LLVM checks the validity of the constraints and the assembly string passed to
-it. This error implies that LLVM seems something wrong with the inline
-assembly call.
+Erroneous code example:
 
-In particular, it can happen if you forgot the closing bracket of a register
-constraint (see issue #51430):
 ```compile_fail,E0668
 #![feature(llvm_asm)]
 
@@ -17,3 +13,10 @@ fn main() {
     }
 }
 ```
+
+LLVM checks the validity of the constraints and the assembly string passed to
+it. This error implies that LLVM seems something wrong with the inline
+assembly call.
+
+In particular, it can happen if you forgot the closing bracket of a register
+constraint (see issue #51430), like in the previous code example.
diff --git a/src/librustc_error_codes/error_codes/E0669.md b/src/librustc_error_codes/error_codes/E0669.md
index 39de01eebe8..f078c441b34 100644
--- a/src/librustc_error_codes/error_codes/E0669.md
+++ b/src/librustc_error_codes/error_codes/E0669.md
@@ -1,5 +1,17 @@
 Cannot convert inline assembly operand to a single LLVM value.
 
+Erroneous code example:
+
+```compile_fail,E0669
+#![feature(llvm_asm)]
+
+fn main() {
+    unsafe {
+        llvm_asm!("" :: "r"("")); // error!
+    }
+}
+```
+
 This error usually happens when trying to pass in a value to an input inline
 assembly operand that is actually a pair of values. In particular, this can
 happen when trying to pass in a slice, for instance a `&str`. In Rust, these
diff --git a/src/librustc_error_codes/error_codes/E0670.md b/src/librustc_error_codes/error_codes/E0670.md
index 2026370bec3..74c1af06cf4 100644
--- a/src/librustc_error_codes/error_codes/E0670.md
+++ b/src/librustc_error_codes/error_codes/E0670.md
@@ -1,6 +1,6 @@
 Rust 2015 does not permit the use of `async fn`.
 
-Example of erroneous code:
+Erroneous code example:
 
 ```compile_fail,E0670
 async fn foo() {}
diff --git a/src/librustc_error_codes/error_codes/E0687.md b/src/librustc_error_codes/error_codes/E0687.md
new file mode 100644
index 00000000000..67b7db2d31f
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0687.md
@@ -0,0 +1,36 @@
+In-band lifetimes cannot be used in `fn`/`Fn` syntax.
+
+Erroneous code examples:
+
+```compile_fail,E0687
+#![feature(in_band_lifetimes)]
+
+fn foo(x: fn(&'a u32)) {} // error!
+
+fn bar(x: &Fn(&'a u32)) {} // error!
+
+fn baz(x: fn(&'a u32), y: &'a u32) {} // error!
+
+struct Foo<'a> { x: &'a u32 }
+
+impl Foo<'a> {
+    fn bar(&self, x: fn(&'a u32)) {} // error!
+}
+```
+
+Lifetimes used in `fn` or `Fn` syntax must be explicitly
+declared using `<...>` binders. For example:
+
+```
+fn foo<'a>(x: fn(&'a u32)) {} // ok!
+
+fn bar<'a>(x: &Fn(&'a u32)) {} // ok!
+
+fn baz<'a>(x: fn(&'a u32), y: &'a u32) {} // ok!
+
+struct Foo<'a> { x: &'a u32 }
+
+impl<'a> Foo<'a> {
+    fn bar(&self, x: fn(&'a u32)) {} // ok!
+}
+```
diff --git a/src/librustc_error_codes/error_codes/E0689.md b/src/librustc_error_codes/error_codes/E0689.md
index 26c2c15ccfa..a680a204211 100644
--- a/src/librustc_error_codes/error_codes/E0689.md
+++ b/src/librustc_error_codes/error_codes/E0689.md
@@ -1,13 +1,16 @@
-This error indicates that the numeric value for the method being passed exists
-but the type of the numeric value or binding could not be identified.
+A method was called on an ambiguous numeric type.
 
-The error happens on numeric literals:
+Erroneous code example:
 
 ```compile_fail,E0689
-2.0.neg();
+2.0.neg(); // error!
 ```
 
-and on numeric bindings without an identified concrete type:
+This error indicates that the numeric value for the method being passed exists
+but the type of the numeric value or binding could not be identified.
+
+The error happens on numeric literals and on numeric bindings without an
+identified concrete type:
 
 ```compile_fail,E0689
 let x = 2.0;
@@ -19,8 +22,8 @@ Because of this, you must give the numeric literal or binding a type:
 ```
 use std::ops::Neg;
 
-let _ = 2.0_f32.neg();
+let _ = 2.0_f32.neg(); // ok!
 let x: f32 = 2.0;
-let _ = x.neg();
-let _ = (2.0 as f32).neg();
+let _ = x.neg(); // ok!
+let _ = (2.0 as f32).neg(); // ok!
 ```
diff --git a/src/librustc_error_codes/error_codes/E0690.md b/src/librustc_error_codes/error_codes/E0690.md
index 3a4d1c56fad..1673456580a 100644
--- a/src/librustc_error_codes/error_codes/E0690.md
+++ b/src/librustc_error_codes/error_codes/E0690.md
@@ -14,7 +14,7 @@ struct LengthWithUnit<U> { // error: transparent struct needs exactly one
 Because transparent structs are represented exactly like one of their fields at
 run time, said field must be uniquely determined. If there is no field, or if
 there are multiple fields, it is not clear how the struct should be represented.
-Note that fields of zero-typed types (e.g., `PhantomData`) can also exist
+Note that fields of zero-sized types (e.g., `PhantomData`) can also exist
 alongside the field that contains the actual data, they do not count for this
 error. When generic types are involved (as in the above example), an error is
 reported because the type parameter could be non-zero-sized.
diff --git a/src/librustc_error_codes/error_codes/E0695.md b/src/librustc_error_codes/error_codes/E0695.md
index 208f7f4c7b1..5013e83ca03 100644
--- a/src/librustc_error_codes/error_codes/E0695.md
+++ b/src/librustc_error_codes/error_codes/E0695.md
@@ -1,6 +1,6 @@
 A `break` statement without a label appeared inside a labeled block.
 
-Example of erroneous code:
+Erroneous code example:
 
 ```compile_fail,E0695
 # #![feature(label_break_value)]
diff --git a/src/librustc_error_codes/error_codes/E0696.md b/src/librustc_error_codes/error_codes/E0696.md
new file mode 100644
index 00000000000..fc32d1cc5f7
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0696.md
@@ -0,0 +1,49 @@
+A function is using `continue` keyword incorrectly.
+
+Erroneous code example:
+
+```compile_fail,E0696
+fn continue_simple() {
+    'b: {
+        continue; // error!
+    }
+}
+fn continue_labeled() {
+    'b: {
+        continue 'b; // error!
+    }
+}
+fn continue_crossing() {
+    loop {
+        'b: {
+            continue; // error!
+        }
+    }
+}
+```
+
+Here we have used the `continue` keyword incorrectly. As we
+have seen above that `continue` pointing to a labeled block.
+
+To fix this we have to use the labeled block properly.
+For example:
+
+```
+fn continue_simple() {
+    'b: loop {
+        continue ; // ok!
+    }
+}
+fn continue_labeled() {
+    'b: loop {
+        continue 'b; // ok!
+    }
+}
+fn continue_crossing() {
+    loop {
+        'b: loop {
+            continue; // ok!
+        }
+    }
+}
+```
diff --git a/src/librustc_error_codes/error_codes/E0698.md b/src/librustc_error_codes/error_codes/E0698.md
index d0fcec39902..3ba992a8476 100644
--- a/src/librustc_error_codes/error_codes/E0698.md
+++ b/src/librustc_error_codes/error_codes/E0698.md
@@ -3,7 +3,7 @@ generator can be constructed.
 
 Erroneous code example:
 
-```edition2018,compile-fail,E0698
+```edition2018,compile_fail,E0698
 async fn bar<T>() -> () {}
 
 async fn foo() {
diff --git a/src/librustc_error_codes/error_codes/E0699.md b/src/librustc_error_codes/error_codes/E0699.md
index f90fd3b5624..454d2507e5e 100644
--- a/src/librustc_error_codes/error_codes/E0699.md
+++ b/src/librustc_error_codes/error_codes/E0699.md
@@ -1,14 +1,16 @@
 A method was called on a raw pointer whose inner type wasn't completely known.
 
-For example, you may have done something like:
+Erroneous code example:
 
-```compile_fail
+```compile_fail,edition2018,E0699
 # #![deny(warnings)]
+# fn main() {
 let foo = &1;
 let bar = foo as *const _;
 if bar.is_null() {
     // ...
 }
+# }
 ```
 
 Here, the type of `bar` isn't known; it could be a pointer to anything. Instead,
diff --git a/src/librustc_error_codes/error_codes/E0700.md b/src/librustc_error_codes/error_codes/E0700.md
index 41ac4d948c2..b1eb8b66ad6 100644
--- a/src/librustc_error_codes/error_codes/E0700.md
+++ b/src/librustc_error_codes/error_codes/E0700.md
@@ -3,7 +3,7 @@ appear within the `impl Trait` itself.
 
 Erroneous code example:
 
-```compile-fail,E0700
+```compile_fail,E0700
 use std::cell::Cell;
 
 trait Trait<'a> { }
diff --git a/src/librustc_error_codes/error_codes/E0701.md b/src/librustc_error_codes/error_codes/E0701.md
index 87f416ada18..4965e643105 100644
--- a/src/librustc_error_codes/error_codes/E0701.md
+++ b/src/librustc_error_codes/error_codes/E0701.md
@@ -1,7 +1,7 @@
 This error indicates that a `#[non_exhaustive]` attribute was incorrectly placed
 on something other than a struct or enum.
 
-Examples of erroneous code:
+Erroneous code example:
 
 ```compile_fail,E0701
 #[non_exhaustive]
diff --git a/src/librustc_error_codes/error_codes/E0708.md b/src/librustc_error_codes/error_codes/E0708.md
index a0f53e38b53..9287fc803d1 100644
--- a/src/librustc_error_codes/error_codes/E0708.md
+++ b/src/librustc_error_codes/error_codes/E0708.md
@@ -2,7 +2,7 @@
 
 Erroneous code example:
 
-```compile_fail,edition2018
+```compile_fail,edition2018,E0708
 #![feature(async_closure)]
 
 fn main() {
diff --git a/src/librustc_error_codes/error_codes/E0712.md b/src/librustc_error_codes/error_codes/E0712.md
index 89f60084f0a..7e09210e787 100644
--- a/src/librustc_error_codes/error_codes/E0712.md
+++ b/src/librustc_error_codes/error_codes/E0712.md
@@ -1,5 +1,5 @@
-This error occurs because a borrow of a thread-local variable was made inside a
-function which outlived the lifetime of the function.
+A borrow of a thread-local variable was made inside a function which outlived
+the lifetime of the function.
 
 Erroneous code example:
 
diff --git a/src/librustc_error_codes/error_codes/E0714.md b/src/librustc_error_codes/error_codes/E0714.md
index e8707f3e390..45d1cafa690 100644
--- a/src/librustc_error_codes/error_codes/E0714.md
+++ b/src/librustc_error_codes/error_codes/E0714.md
@@ -1,5 +1,19 @@
 A `#[marker]` trait contained an associated item.
 
+Erroneous code example:
+
+```compile_fail,E0714
+#![feature(marker_trait_attr)]
+#![feature(associated_type_defaults)]
+
+#[marker]
+trait MarkerConst {
+    const N: usize; // error!
+}
+
+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
 reasons, consider making an extension trait instead.
diff --git a/src/librustc_error_codes/error_codes/E0715.md b/src/librustc_error_codes/error_codes/E0715.md
index 9e20e813683..8f0022d9425 100644
--- a/src/librustc_error_codes/error_codes/E0715.md
+++ b/src/librustc_error_codes/error_codes/E0715.md
@@ -1,5 +1,24 @@
 An `impl` for a `#[marker]` trait tried to override an associated item.
 
+Erroneous code example:
+
+```compile_fail,E0715
+#![feature(marker_trait_attr)]
+
+#[marker]
+trait Marker {
+    const N: usize = 0;
+    fn do_something() {}
+}
+
+struct OverrideConst;
+impl Marker for OverrideConst { // error!
+    const N: usize = 1;
+}
+
+fn main() {}
+```
+
 Because marker traits are allowed to have multiple implementations for the same
 type, it's not allowed to override anything in those implementations, as it
 would be ambiguous which override should actually be used.
diff --git a/src/librustc_error_codes/error_codes/E0724.md b/src/librustc_error_codes/error_codes/E0724.md
new file mode 100644
index 00000000000..7a7ba154854
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0724.md
@@ -0,0 +1,24 @@
+`#[ffi_returns_twice]` was used on non-foreign function.
+
+Erroneous code example:
+
+```compile_fail,E0724
+#![feature(ffi_returns_twice)]
+#![crate_type = "lib"]
+
+#[ffi_returns_twice] // error!
+pub fn foo() {}
+```
+
+`#[ffi_returns_twice]` can only be used on foreign function declarations.
+For example, we might correct the previous example by declaring
+the function inside of an `extern` block.
+
+```
+#![feature(ffi_returns_twice)]
+
+extern {
+   #[ffi_returns_twice] // ok!
+   pub fn foo();
+}
+```
diff --git a/src/librustc_error_codes/error_codes/E0727.md b/src/librustc_error_codes/error_codes/E0727.md
index 528807ee9af..be1b68e645d 100644
--- a/src/librustc_error_codes/error_codes/E0727.md
+++ b/src/librustc_error_codes/error_codes/E0727.md
@@ -2,14 +2,16 @@ A `yield` clause was used in an `async` context.
 
 Example of erroneous code:
 
-```compile_fail
+```compile_fail,E0727,edition2018
 #![feature(generators)]
 
-let generator = || {
-    async {
-        yield;
-    }
-};
+fn main() {
+    let generator = || {
+        async {
+            yield;
+        }
+    };
+}
 ```
 
 Here, the `yield` keyword is used in an `async` block,
@@ -17,10 +19,12 @@ which is not yet supported.
 
 To fix this error, you have to move `yield` out of the `async` block:
 
-```
+```edition2018
 #![feature(generators)]
 
-let generator = || {
-    yield;
-};
+fn main() {
+    let generator = || {
+        yield;
+    };
+}
 ```
diff --git a/src/librustc_error_codes/error_codes/E0732.md b/src/librustc_error_codes/error_codes/E0732.md
index 03137590e88..7347e6654c5 100644
--- a/src/librustc_error_codes/error_codes/E0732.md
+++ b/src/librustc_error_codes/error_codes/E0732.md
@@ -1,5 +1,18 @@
 An `enum` with a discriminant must specify a `#[repr(inttype)]`.
 
+Erroneous code example:
+
+```compile_fail,E0732
+#![feature(arbitrary_enum_discriminant)]
+
+enum Enum { // error!
+    Unit = 1,
+    Tuple() = 2,
+    Struct{} = 3,
+}
+# fn main() {}
+```
+
 A `#[repr(inttype)]` must be provided on an `enum` if it has a non-unit
 variant with a discriminant, or where there are both unit variants with
 discriminants and non-unit variants. This restriction ensures that there
@@ -23,7 +36,9 @@ fn discriminant(v : &Enum) -> u8 {
     unsafe { *(v as *const Enum as *const u8) }
 }
 
-assert_eq!(3, discriminant(&Enum::Unit));
-assert_eq!(2, discriminant(&Enum::Tuple(5)));
-assert_eq!(1, discriminant(&Enum::Struct{a: 7, b: 11}));
+fn main() {
+    assert_eq!(3, discriminant(&Enum::Unit));
+    assert_eq!(2, discriminant(&Enum::Tuple(5)));
+    assert_eq!(1, discriminant(&Enum::Struct{a: 7, b: 11}));
+}
 ```
diff --git a/src/librustc_error_codes/error_codes/E0736.md b/src/librustc_error_codes/error_codes/E0736.md
index 8a60dc32059..0f3d41ba66d 100644
--- a/src/librustc_error_codes/error_codes/E0736.md
+++ b/src/librustc_error_codes/error_codes/E0736.md
@@ -3,8 +3,6 @@
 Erroneous code example:
 
 ```compile_fail,E0736
-#![feature(track_caller)]
-
 #[naked]
 #[track_caller]
 fn foo() {}
diff --git a/src/librustc_error_codes/error_codes/E0737.md b/src/librustc_error_codes/error_codes/E0737.md
index c6553e97b7e..ab5e60692b4 100644
--- a/src/librustc_error_codes/error_codes/E0737.md
+++ b/src/librustc_error_codes/error_codes/E0737.md
@@ -5,8 +5,6 @@ restrictions.
 Erroneous code example:
 
 ```compile_fail,E0737
-#![feature(track_caller)]
-
 #[track_caller]
 extern "C" fn foo() {}
 ```
diff --git a/src/librustc_error_codes/error_codes/E0739.md b/src/librustc_error_codes/error_codes/E0739.md
index 707751066ed..8d9039bef93 100644
--- a/src/librustc_error_codes/error_codes/E0739.md
+++ b/src/librustc_error_codes/error_codes/E0739.md
@@ -3,7 +3,6 @@
 Erroneous code example:
 
 ```compile_fail,E0739
-#![feature(track_caller)]
 #[track_caller]
 struct Bar {
     a: u8,
diff --git a/src/librustc_error_codes/error_codes/E0740.md b/src/librustc_error_codes/error_codes/E0740.md
index a9eb5f2790d..37776785189 100644
--- a/src/librustc_error_codes/error_codes/E0740.md
+++ b/src/librustc_error_codes/error_codes/E0740.md
@@ -1 +1,16 @@
 A `union` cannot have fields with destructors.
+
+Erroneous code example:
+
+```compile_fail,E0740
+union Test {
+    a: A, // error!
+}
+
+#[derive(Debug)]
+struct A(i32);
+
+impl Drop for A {
+    fn drop(&mut self) { println!("A"); }
+}
+```
diff --git a/src/librustc_error_codes/error_codes/E0744.md b/src/librustc_error_codes/error_codes/E0744.md
index 602fbc50a71..56b947a8282 100644
--- a/src/librustc_error_codes/error_codes/E0744.md
+++ b/src/librustc_error_codes/error_codes/E0744.md
@@ -3,16 +3,13 @@ Control-flow expressions are not allowed inside a const context.
 At the moment, `if` and `match`, as well as the looping constructs `for`,
 `while`, and `loop`, are forbidden inside a `const`, `static`, or `const fn`.
 
-```compile_fail,E0658
+```compile_fail,E0744
 const _: i32 = {
     let mut x = 0;
-    loop {
-        x += 1;
-        if x == 4 {
-            break;
-        }
+
+    for i in 0..4 { // error!
+        x += i;
     }
-    x
 };
 ```
 
diff --git a/src/librustc_error_codes/error_codes/E0746.md b/src/librustc_error_codes/error_codes/E0746.md
index 16b2722f0ea..305667e58f8 100644
--- a/src/librustc_error_codes/error_codes/E0746.md
+++ b/src/librustc_error_codes/error_codes/E0746.md
@@ -2,8 +2,7 @@ Return types cannot be `dyn Trait`s as they must be `Sized`.
 
 Erroneous code example:
 
-```compile_fail,E0277
-# // FIXME: after E0746 is in beta, change the above
+```compile_fail,E0746
 trait T {
     fn bar(&self);
 }
diff --git a/src/librustc_error_codes/error_codes/E0751.md b/src/librustc_error_codes/error_codes/E0751.md
index a440f82e4b6..809b888d92a 100644
--- a/src/librustc_error_codes/error_codes/E0751.md
+++ b/src/librustc_error_codes/error_codes/E0751.md
@@ -2,7 +2,7 @@ There are both a positive and negative trait implementation for the same type.
 
 Erroneous code example:
 
-```compile_fail,E0748
+```compile_fail,E0751
 trait MyTrait {}
 impl MyTrait for i32 { }
 impl !MyTrait for i32 { }
diff --git a/src/librustc_error_codes/error_codes/E0752.md b/src/librustc_error_codes/error_codes/E0752.md
new file mode 100644
index 00000000000..86945f83b55
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0752.md
@@ -0,0 +1,11 @@
+`fn main()` or the specified start function is not allowed to be
+async. You might be seeing this error because your async runtime
+library is not set up correctly.
+
+Erroneous code example:
+
+```compile_fail,E0752
+async fn main() -> Result<i32, ()> {
+    Ok(1)
+}
+```
diff --git a/src/librustc_error_codes/error_codes/E0753.md b/src/librustc_error_codes/error_codes/E0753.md
new file mode 100644
index 00000000000..a69da964aee
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0753.md
@@ -0,0 +1,31 @@
+An inner doc comment was used in an invalid context.
+
+Erroneous code example:
+
+```compile_fail,E0753
+fn foo() {}
+//! foo
+// ^ error!
+fn main() {}
+```
+
+Inner document can only be used before items. For example:
+
+```
+//! A working comment applied to the module!
+fn foo() {
+    //! Another working comment!
+}
+fn main() {}
+```
+
+In case you want to document the item following the doc comment, you might want
+to use outer doc comment:
+
+```
+/// I am an outer doc comment
+#[doc = "I am also an outer doc comment!"]
+fn foo() {
+    // ...
+}
+```
diff --git a/src/librustc_error_codes/error_codes/E0754.md b/src/librustc_error_codes/error_codes/E0754.md
new file mode 100644
index 00000000000..abdc01ed21a
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0754.md
@@ -0,0 +1,33 @@
+An non-ascii identifier was used in an invalid context.
+
+Erroneous code example:
+
+```compile_fail,E0754
+# #![feature(non_ascii_idents)]
+
+mod řųśť;
+// ^ error!
+fn main() {}
+```
+
+```compile_fail,E0754
+# #![feature(non_ascii_idents)]
+
+#[no_mangle]
+fn řųśť() {}
+// ^ error!
+fn main() {}
+```
+
+Non-ascii can be used as module names if it is inline
+or a #\[path\] attribute is specified. For example:
+
+```
+# #![feature(non_ascii_idents)]
+
+mod řųśť {
+    const IS_GREAT: bool = true;
+}
+
+fn main() {}
+```
diff --git a/src/librustc_error_codes/error_codes/E0758.md b/src/librustc_error_codes/error_codes/E0758.md
new file mode 100644
index 00000000000..ddca4b3d75f
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0758.md
@@ -0,0 +1,20 @@
+A multi-line (doc-)comment is unterminated.
+
+Erroneous code example:
+
+```compile_fail,E0758
+/* I am not terminated!
+```
+
+The same goes for doc comments:
+
+```compile_fail,E0758
+/*! I am not terminated!
+```
+
+You need to end your multi-line comment with `*/` in order to fix this error:
+
+```
+/* I am terminated! */
+/*! I am also terminated! */
+```
diff --git a/src/librustc_error_codes/error_codes/E0759.md b/src/librustc_error_codes/error_codes/E0759.md
new file mode 100644
index 00000000000..a74759bdf63
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0759.md
@@ -0,0 +1,67 @@
+A `'static` requirement in a return type involving a trait is not fulfilled.
+
+Erroneous code examples:
+
+```compile_fail,E0759
+use std::fmt::Debug;
+
+fn foo(x: &i32) -> impl Debug {
+    x
+}
+```
+
+```compile_fail,E0759
+# use std::fmt::Debug;
+fn bar(x: &i32) -> Box<dyn Debug> {
+    Box::new(x)
+}
+```
+
+These examples have the same semantics as the following:
+
+```compile_fail,E0759
+# use std::fmt::Debug;
+fn foo(x: &i32) -> impl Debug + 'static {
+    x
+}
+```
+
+```compile_fail,E0759
+# use std::fmt::Debug;
+fn bar(x: &i32) -> Box<dyn Debug + 'static> {
+    Box::new(x)
+}
+```
+
+Both [`dyn Trait`] and [`impl Trait`] in return types have a an implicit
+`'static` requirement, meaning that the value implementing them that is being
+returned has to be either a `'static` borrow or an owned value.
+
+In order to change the requirement from `'static` to be a lifetime derived from
+its arguments, you can add an explicit bound, either to an anonymous lifetime
+`'_` or some appropriate named lifetime.
+
+```
+# use std::fmt::Debug;
+fn foo(x: &i32) -> impl Debug + '_ {
+    x
+}
+fn bar(x: &i32) -> Box<dyn Debug + '_> {
+    Box::new(x)
+}
+```
+
+These are equivalent to the following explicit lifetime annotations:
+
+```
+# use std::fmt::Debug;
+fn foo<'a>(x: &'a i32) -> impl Debug + 'a {
+    x
+}
+fn bar<'a>(x: &'a i32) -> Box<dyn Debug + 'a> {
+    Box::new(x)
+}
+```
+
+[`dyn Trait`]: https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types
+[`impl Trait`]: https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits
diff --git a/src/librustc_error_codes/error_codes/E0760.md b/src/librustc_error_codes/error_codes/E0760.md
new file mode 100644
index 00000000000..e1dcfefebcd
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0760.md
@@ -0,0 +1,32 @@
+`async fn`/`impl trait` return type cannot contain a projection
+or `Self` that references lifetimes from a parent scope.
+
+Erroneous code example:
+
+```compile_fail,E0760,edition2018
+struct S<'a>(&'a i32);
+
+impl<'a> S<'a> {
+    async fn new(i: &'a i32) -> Self {
+        S(&22)
+    }
+}
+```
+
+To fix this error we need to spell out `Self` to `S<'a>`:
+
+```edition2018
+struct S<'a>(&'a i32);
+
+impl<'a> S<'a> {
+    async fn new(i: &'a i32) -> S<'a> {
+        S(&22)
+    }
+}
+```
+
+This will be allowed at some point in the future,
+but the implementation is not yet complete.
+See the [issue-61949] for this limitation.
+
+[issue-61949]: https://github.com/rust-lang/rust/issues/61949
diff --git a/src/librustc_error_codes/error_codes/E0761.md b/src/librustc_error_codes/error_codes/E0761.md
new file mode 100644
index 00000000000..c01574e413c
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0761.md
@@ -0,0 +1,25 @@
+Multiple candidate files were found for an out-of-line module.
+
+Erroneous code example:
+
+```rust
+// file: ambiguous_module/mod.rs
+
+fn foo() {}
+```
+
+```rust
+// file: ambiguous_module.rs
+
+fn foo() {}
+```
+
+```ignore (multiple source files required for compile_fail)
+mod ambiguous_module; // error: file for module `ambiguous_module`
+                      // found at both ambiguous_module.rs and
+                      // ambiguous_module.rs/mod.rs
+
+fn main() {}
+```
+
+Please remove this ambiguity by deleting/renaming one of the candidate files.
diff --git a/src/librustc_error_codes/error_codes/E0762.md b/src/librustc_error_codes/error_codes/E0762.md
new file mode 100644
index 00000000000..b01ded4a866
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0762.md
@@ -0,0 +1,13 @@
+A character literal wasn't ended with a quote.
+
+Erroneous code example:
+
+```compile_fail,E0762
+static C: char = '●; // error!
+```
+
+To fix this error, add the missing quote:
+
+```
+static C: char = '●'; // ok!
+```
diff --git a/src/librustc_error_codes/error_codes/E0763.md b/src/librustc_error_codes/error_codes/E0763.md
new file mode 100644
index 00000000000..095b779f3e7
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0763.md
@@ -0,0 +1,13 @@
+A byte constant wasn't correctly ended.
+
+Erroneous code example:
+
+```compile_fail,E0763
+let c = b'a; // error!
+```
+
+To fix this error, add the missing quote:
+
+```
+let c = b'a'; // ok!
+```
diff --git a/src/librustc_error_codes/error_codes/E0764.md b/src/librustc_error_codes/error_codes/E0764.md
new file mode 100644
index 00000000000..e9061f988ac
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0764.md
@@ -0,0 +1,39 @@
+Mutable references (`&mut`) can only be used in constant functions, not statics
+or constants. This limitation exists to prevent the creation of constants that
+have a mutable reference in their final value. If you had a constant of `&mut
+i32` type, you could modify the value through that reference, making the
+constant essentially mutable. While there could be a more fine-grained scheme
+in the future that allows mutable references if they are not "leaked" to the
+final value, a more conservative approach was chosen for now. `const fn` do not
+have this problem, as the borrow checker will prevent the `const fn` from
+returning new mutable references.
+
+Erroneous code example:
+
+```compile_fail,E0764
+#![feature(const_fn)]
+#![feature(const_mut_refs)]
+
+fn main() {
+    const OH_NO: &'static mut usize = &mut 1; // error!
+}
+```
+
+Remember: you cannot use a function call inside a constant or static. However,
+you can totally use it in constant functions:
+
+```
+#![feature(const_fn)]
+#![feature(const_mut_refs)]
+
+const fn foo(x: usize) -> usize {
+    let mut y = 1;
+    let z = &mut y;
+    *z += x;
+    y
+}
+
+fn main() {
+    const FOO: usize = foo(10); // ok!
+}
+```
diff --git a/src/librustc_error_codes/error_codes/E0765.md b/src/librustc_error_codes/error_codes/E0765.md
new file mode 100644
index 00000000000..456e3f3e9e4
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0765.md
@@ -0,0 +1,13 @@
+A double quote string (`"`) was not terminated.
+
+Erroneous code example:
+
+```compile_fail,E0765
+let s = "; // error!
+```
+
+To fix this error, add the missing double quote at the end of the string:
+
+```
+let s = ""; // ok!
+```
diff --git a/src/librustc_error_codes/error_codes/E0766.md b/src/librustc_error_codes/error_codes/E0766.md
new file mode 100644
index 00000000000..4e775df2cac
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0766.md
@@ -0,0 +1,13 @@
+A double quote byte string (`b"`) was not terminated.
+
+Erroneous code example:
+
+```compile_fail,E0766
+let s = b"; // error!
+```
+
+To fix this error, add the missing double quote at the end of the string:
+
+```
+let s = b""; // ok!
+```
diff --git a/src/librustc_error_codes/error_codes/E0767.md b/src/librustc_error_codes/error_codes/E0767.md
new file mode 100644
index 00000000000..679fe7e41e9
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0767.md
@@ -0,0 +1,20 @@
+An unreachable label was used.
+
+Erroneous code example:
+
+```compile_fail,E0767
+'a: loop {
+    || {
+        loop { break 'a } // error: use of unreachable label `'a`
+    };
+}
+```
+
+Ensure that the label is within scope. Labels are not reachable through
+functions, closures, async blocks or modules. Example:
+
+```
+'a: loop {
+    break 'a; // ok!
+}
+```
diff --git a/src/librustc_error_codes/error_codes/E0768.md b/src/librustc_error_codes/error_codes/E0768.md
new file mode 100644
index 00000000000..24169ef512e
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0768.md
@@ -0,0 +1,13 @@
+A number in a non-decimal base has no digits.
+
+Erroneous code example:
+
+```compile_fail,E0768
+let s: i32 = 0b; // error!
+```
+
+To fix this error, add the missing digits:
+
+```
+let s: i32 = 0b1; // ok!
+```