|
1 | 1 | error[E0261]: use of undeclared lifetime name `'a`
|
2 | 2 | --> $DIR/issue-67510.rs:7:21
|
3 | 3 | |
|
4 |
| -LL | fn f(x: Box<dyn X<Y<'a>=&'a ()>>) {} |
5 |
| - | - ^^ undeclared lifetime |
6 |
| - | | |
7 |
| - | help: consider introducing lifetime `'a` here: `<'a>` |
| 4 | +LL | fn f(x: Box<dyn X<Y<'a> = &'a ()>>) {} |
| 5 | + | ^^ undeclared lifetime |
| 6 | + | |
| 7 | + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html |
| 8 | +help: consider making the bound lifetime-generic with a new `'a` lifetime |
| 9 | + | |
| 10 | +LL | fn f(x: Box<dyn for<'a> X<Y<'a> = &'a ()>>) {} |
| 11 | + | +++++++ |
| 12 | +help: consider introducing lifetime `'a` here |
| 13 | + | |
| 14 | +LL | fn f<'a>(x: Box<dyn X<Y<'a> = &'a ()>>) {} |
| 15 | + | ++++ |
8 | 16 |
|
9 | 17 | error[E0261]: use of undeclared lifetime name `'a`
|
10 |
| - --> $DIR/issue-67510.rs:7:26 |
| 18 | + --> $DIR/issue-67510.rs:7:28 |
| 19 | + | |
| 20 | +LL | fn f(x: Box<dyn X<Y<'a> = &'a ()>>) {} |
| 21 | + | ^^ undeclared lifetime |
| 22 | + | |
| 23 | +help: consider making the bound lifetime-generic with a new `'a` lifetime |
| 24 | + | |
| 25 | +LL | fn f(x: Box<dyn for<'a> X<Y<'a> = &'a ()>>) {} |
| 26 | + | +++++++ |
| 27 | +help: consider introducing lifetime `'a` here |
| 28 | + | |
| 29 | +LL | fn f<'a>(x: Box<dyn X<Y<'a> = &'a ()>>) {} |
| 30 | + | ++++ |
| 31 | + |
| 32 | +error[E0038]: the trait `X` cannot be made into an object |
| 33 | + --> $DIR/issue-67510.rs:7:13 |
| 34 | + | |
| 35 | +LL | fn f(x: Box<dyn X<Y<'a> = &'a ()>>) {} |
| 36 | + | ^^^^^^^^^^^^^^^^^^^^^ `X` cannot be made into an object |
| 37 | + | |
| 38 | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> |
| 39 | + --> $DIR/issue-67510.rs:4:10 |
11 | 40 | |
|
12 |
| -LL | fn f(x: Box<dyn X<Y<'a>=&'a ()>>) {} |
13 |
| - | - ^^ undeclared lifetime |
14 |
| - | | |
15 |
| - | help: consider introducing lifetime `'a` here: `<'a>` |
| 41 | +LL | trait X { |
| 42 | + | - this trait cannot be made into an object... |
| 43 | +LL | type Y<'a>; |
| 44 | + | ^ ...because it contains the generic associated type `Y` |
| 45 | + = help: consider moving `Y` to another trait |
16 | 46 |
|
17 |
| -error: aborting due to 2 previous errors |
| 47 | +error: aborting due to 3 previous errors |
18 | 48 |
|
19 |
| -For more information about this error, try `rustc --explain E0261`. |
| 49 | +Some errors have detailed explanations: E0038, E0261. |
| 50 | +For more information about an error, try `rustc --explain E0038`. |
0 commit comments