|
| 1 | +error[E0038]: the trait `Foo` cannot be made into an object |
| 2 | + --> $DIR/span-bug-issue-121597.rs:14:23 |
| 3 | + | |
| 4 | +LL | let x: &dyn Foo = &(); |
| 5 | + | ^^^ `Foo` cannot be made into an object |
| 6 | + | |
| 7 | +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> |
| 8 | + --> $DIR/span-bug-issue-121597.rs:4:12 |
| 9 | + | |
| 10 | +LL | trait Foo: for<T> Bar<T> {} |
| 11 | + | --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables |
| 12 | + | | |
| 13 | + | this trait cannot be made into an object... |
| 14 | + = note: required for the cast from `&()` to `&dyn Foo` |
| 15 | + |
| 16 | +error[E0038]: the trait `Foo` cannot be made into an object |
| 17 | + --> $DIR/span-bug-issue-121597.rs:14:12 |
| 18 | + | |
| 19 | +LL | let x: &dyn Foo = &(); |
| 20 | + | ^^^^^^^^ `Foo` cannot be made into an object |
| 21 | + | |
| 22 | +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> |
| 23 | + --> $DIR/span-bug-issue-121597.rs:4:12 |
| 24 | + | |
| 25 | +LL | trait Foo: for<T> Bar<T> {} |
| 26 | + | --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables |
| 27 | + | | |
| 28 | + | this trait cannot be made into an object... |
| 29 | + |
| 30 | +error[E0308]: mismatched types |
| 31 | + --> $DIR/span-bug-issue-121597.rs:18:15 |
| 32 | + | |
| 33 | +LL | needs_bar(x); |
| 34 | + | --------- ^ types differ in mutability |
| 35 | + | | |
| 36 | + | arguments to this function are incorrect |
| 37 | + | |
| 38 | + = note: expected raw pointer `*mut Type2` |
| 39 | + found reference `&dyn Foo` |
| 40 | +note: function defined here |
| 41 | + --> $DIR/span-bug-issue-121597.rs:11:4 |
| 42 | + | |
| 43 | +LL | fn needs_bar(_: *mut Type2) {} |
| 44 | + | ^^^^^^^^^ ------------- |
| 45 | + |
| 46 | +error: aborting due to 3 previous errors |
| 47 | + |
| 48 | +Some errors have detailed explanations: E0038, E0308. |
| 49 | +For more information about an error, try `rustc --explain E0038`. |
0 commit comments