]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/issue-67510.stderr
Rollup merge of #104024 - noeddl:unused-must-use, r=compiler-errors
[rust.git] / src / test / ui / generic-associated-types / issue-67510.stderr
1 error[E0261]: use of undeclared lifetime name `'a`
2   --> $DIR/issue-67510.rs:5:21
3    |
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    |     ++++
16
17 error[E0261]: use of undeclared lifetime name `'a`
18   --> $DIR/issue-67510.rs:5: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:5: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:2:10
40    |
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
46
47 error: aborting due to 3 previous errors
48
49 Some errors have detailed explanations: E0038, E0261.
50 For more information about an error, try `rustc --explain E0038`.