Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add long error code for error E0226 #70548

Merged
merged 2 commits into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc_error_codes/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ E0222: include_str!("./error_codes/E0222.md"),
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"),
Expand Down Expand Up @@ -475,7 +476,6 @@ E0751: include_str!("./error_codes/E0751.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,
Expand Down
21 changes: 21 additions & 0 deletions src/librustc_error_codes/error_codes/E0226.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
More than one explicit lifetime bound was used on a trait object.

Example of erroneous code:

```compile_fail,E0226
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.

Only a single explicit lifetime bound is permitted on trait objects.
To fix this error, consider removing one of the lifetime bounds:

```
trait Foo {}

type T<'a> = dyn Foo + 'a;
```
Original file line number Diff line number Diff line change
Expand Up @@ -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`.