Skip to content

Commit cbe3266

Browse files
authored
Rollup merge of #70548 - Ersikan:master, r=GuillaumeGomez
Add long error code for error E0226 Added a long description message for error E0226, which previously did not exist. As requested in issue #61137 r? @GuillaumeGomez
2 parents 9ee373f + 32103b1 commit cbe3266

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

src/librustc_error_codes/error_codes.rs

+1-1
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,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
More than one explicit lifetime bound was used on a trait object.
2+
3+
Example of erroneous code:
4+
5+
```compile_fail,E0226
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+
Only a single explicit lifetime bound is permitted on trait objects.
15+
To fix this error, consider removing one of the lifetime bounds:
16+
17+
```
18+
trait Foo {}
19+
20+
type T<'a> = dyn Foo + 'a;
21+
```

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

+2-2
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)