]> git.lizzy.rs Git - rust.git/commitdiff
Add long error code for error E0226
authorJulien Philippon <julien.philippon@epitech.eu>
Mon, 30 Mar 2020 00:50:53 +0000 (02:50 +0200)
committerJulien Philippon <julien.philippon@epitech.eu>
Mon, 30 Mar 2020 00:51:25 +0000 (02:51 +0200)
src/librustc_error_codes/error_codes.rs
src/librustc_error_codes/error_codes/E0226.md [new file with mode: 0644]
src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr

index 2f0a3fc1d1c386817112c4e17db4b087af0e62c3..6e690655f60c57409196d623a9df612a6c511dbf 100644 (file)
 E0223: include_str!("./error_codes/E0223.md"),
 E0224: include_str!("./error_codes/E0224.md"),
 E0225: include_str!("./error_codes/E0225.md"),
+E0226: include_str!("./error_codes/E0226.md"),
 E0229: include_str!("./error_codes/E0229.md"),
 E0230: include_str!("./error_codes/E0230.md"),
 E0231: include_str!("./error_codes/E0231.md"),
 //  E0217, // ambiguous associated type, defined in multiple supertraits
 //  E0218, // no associated type defined
 //  E0219, // associated type defined in higher-ranked supertrait
-    E0226, // only a single explicit lifetime bound is permitted
     E0227, // ambiguous lifetime bound, explicit lifetime bound required
     E0228, // explicit lifetime bound required
 //  E0233,
diff --git a/src/librustc_error_codes/error_codes/E0226.md b/src/librustc_error_codes/error_codes/E0226.md
new file mode 100644 (file)
index 0000000..e485771
--- /dev/null
@@ -0,0 +1,20 @@
+Only a single explicit lifetime bound is permitted on trait objects.
+
+Example of erroneous code:
+
+```compile_fail
+trait Foo {}
+
+type T<'a, 'b> = dyn Foo + 'a + 'b; // error: Trait object `arg` has two
+                                    //        lifetime bound, 'a and 'b.
+```
+
+Here `T` is a trait object with two explicit lifetime bounds, 'a and 'b.
+
+To fix this error, consider removing one of the lifetime bounds:
+
+```
+trait Foo {}
+
+type T<'a> = dyn Foo + 'a;
+```
index 184cead21231f114d0da42fadaa113cf8ad1d333..ea9be77a3e8b5bb85a54ad9b715d467c0d5e261f 100644 (file)
@@ -31,5 +31,5 @@ LL | struct Foo<'a,'b,'c> {
 
 error: aborting due to 3 previous errors
 
-Some errors have detailed explanations: E0392, E0478.
-For more information about an error, try `rustc --explain E0392`.
+Some errors have detailed explanations: E0226, E0392, E0478.
+For more information about an error, try `rustc --explain E0226`.