Skip to content

Commit 8f7eb62

Browse files
committed
Add long error code for error E0226
1 parent 699f83f commit 8f7eb62

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

src/librustc_error_codes/error_codes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ E0222: include_str!("./error_codes/E0222.md"),
119119
E0223: include_str!("./error_codes/E0223.md"),
120120
E0224: include_str!("./error_codes/E0224.md"),
121121
E0225: include_str!("./error_codes/E0225.md"),
122+
E0226: include_str!("./error_codes/E0226.md"),
122123
E0229: include_str!("./error_codes/E0229.md"),
123124
E0230: include_str!("./error_codes/E0230.md"),
124125
E0231: include_str!("./error_codes/E0231.md"),
@@ -475,7 +476,6 @@ E0751: include_str!("./error_codes/E0751.md"),
475476
// E0217, // ambiguous associated type, defined in multiple supertraits
476477
// E0218, // no associated type defined
477478
// E0219, // associated type defined in higher-ranked supertrait
478-
E0226, // only a single explicit lifetime bound is permitted
479479
E0227, // ambiguous lifetime bound, explicit lifetime bound required
480480
E0228, // explicit lifetime bound required
481481
// E0233,
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Only a single explicit lifetime bound is permitted on trait objects.
2+
3+
Example of erroneous code:
4+
5+
```compile_fail
6+
trait Foo {}
7+
8+
type T<'a, 'b> = dyn Foo + 'a + 'b; // error: Trait object `arg` has two
9+
// lifetime bound, 'a and 'b.
10+
```
11+
12+
Here `T` is a trait object with two explicit lifetime bounds, 'a and 'b.
13+
14+
To fix this error, consider removing one of the lifetime bounds:
15+
16+
```
17+
trait Foo {}
18+
19+
type T<'a> = dyn Foo + 'a;
20+
```

src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ LL | struct Foo<'a,'b,'c> {
3131

3232
error: aborting due to 3 previous errors
3333

34-
Some errors have detailed explanations: E0392, E0478.
35-
For more information about an error, try `rustc --explain E0392`.
34+
Some errors have detailed explanations: E0226, E0392, E0478.
35+
For more information about an error, try `rustc --explain E0226`.

0 commit comments

Comments
 (0)