|
| 1 | +error[E0038]: the trait `Qux` cannot be made into an object |
| 2 | + --> $DIR/taint-const-eval.rs:11:15 |
| 3 | + | |
| 4 | +LL | static FOO: &(dyn Qux + Sync) = "desc"; |
| 5 | + | ^^^^^^^^^^^^^^ `Qux` cannot be made into an object |
| 6 | + | |
| 7 | +note: for a trait to be "dyn-compatible" 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/taint-const-eval.rs:8:8 |
| 9 | + | |
| 10 | +LL | trait Qux { |
| 11 | + | --- this trait cannot be made into an object... |
| 12 | +LL | fn bar(); |
| 13 | + | ^^^ ...because associated function `bar` has no `self` parameter |
| 14 | +help: consider turning `bar` into a method by giving it a `&self` argument |
| 15 | + | |
| 16 | +LL | fn bar(&self); |
| 17 | + | +++++ |
| 18 | +help: alternatively, consider constraining `bar` so it does not apply to trait objects |
| 19 | + | |
| 20 | +LL | fn bar() where Self: Sized; |
| 21 | + | +++++++++++++++++ |
| 22 | + |
| 23 | +error[E0038]: the trait `Qux` cannot be made into an object |
| 24 | + --> $DIR/taint-const-eval.rs:11:33 |
| 25 | + | |
| 26 | +LL | static FOO: &(dyn Qux + Sync) = "desc"; |
| 27 | + | ^^^^^^ `Qux` cannot be made into an object |
| 28 | + | |
| 29 | +note: for a trait to be "dyn-compatible" 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> |
| 30 | + --> $DIR/taint-const-eval.rs:8:8 |
| 31 | + | |
| 32 | +LL | trait Qux { |
| 33 | + | --- this trait cannot be made into an object... |
| 34 | +LL | fn bar(); |
| 35 | + | ^^^ ...because associated function `bar` has no `self` parameter |
| 36 | + = note: required for the cast from `&'static str` to `&'static (dyn Qux + Sync + 'static)` |
| 37 | +help: consider turning `bar` into a method by giving it a `&self` argument |
| 38 | + | |
| 39 | +LL | fn bar(&self); |
| 40 | + | +++++ |
| 41 | +help: alternatively, consider constraining `bar` so it does not apply to trait objects |
| 42 | + | |
| 43 | +LL | fn bar() where Self: Sized; |
| 44 | + | +++++++++++++++++ |
| 45 | + |
| 46 | +error[E0038]: the trait `Qux` cannot be made into an object |
| 47 | + --> $DIR/taint-const-eval.rs:11:15 |
| 48 | + | |
| 49 | +LL | static FOO: &(dyn Qux + Sync) = "desc"; |
| 50 | + | ^^^^^^^^^^^^^^ `Qux` cannot be made into an object |
| 51 | + | |
| 52 | +note: for a trait to be "dyn-compatible" 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> |
| 53 | + --> $DIR/taint-const-eval.rs:8:8 |
| 54 | + | |
| 55 | +LL | trait Qux { |
| 56 | + | --- this trait cannot be made into an object... |
| 57 | +LL | fn bar(); |
| 58 | + | ^^^ ...because associated function `bar` has no `self` parameter |
| 59 | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 60 | +help: consider turning `bar` into a method by giving it a `&self` argument |
| 61 | + | |
| 62 | +LL | fn bar(&self); |
| 63 | + | +++++ |
| 64 | +help: alternatively, consider constraining `bar` so it does not apply to trait objects |
| 65 | + | |
| 66 | +LL | fn bar() where Self: Sized; |
| 67 | + | +++++++++++++++++ |
| 68 | + |
| 69 | +error: aborting due to 3 previous errors |
| 70 | + |
| 71 | +For more information about this error, try `rustc --explain E0038`. |
0 commit comments