summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_error_codes/src/error_codes/E0226.md
blob: 4e65132ff0d69742126a1a74c708163925067d00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
```