rust/src/test/ui/feature-gates/feature-gate-object_safe_for_dispatch.stderr

68 lines
3.0 KiB
Plaintext
Raw Normal View History

error[E0038]: the trait `NonObjectSafe1` cannot be made into an object
--> $DIR/feature-gate-object_safe_for_dispatch.rs:18:38
|
2020-01-19 16:53:37 -06:00
LL | trait NonObjectSafe1: Sized {}
| -------------- ----- ...because it requires `Self: Sized`
| |
| this trait cannot be made into an object...
2020-01-19 16:53:37 -06:00
...
LL | fn takes_non_object_safe_ref<T>(obj: &dyn NonObjectSafe1) {
| ^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe1` cannot be made into an object
error[E0038]: the trait `NonObjectSafe2` cannot be made into an object
--> $DIR/feature-gate-object_safe_for_dispatch.rs:22:36
|
LL | trait NonObjectSafe2 {
| -------------- this trait cannot be made into an object...
LL | fn static_fn() {}
| --------- ...because associated function `static_fn` has no `self` parameter
...
LL | fn return_non_object_safe_ref() -> &'static dyn NonObjectSafe2 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe2` cannot be made into an object
|
help: consider turning `static_fn` into a method by giving it a `&self` argument or constraining it so it does not apply to trait objects
|
LL | fn static_fn() where Self: Sized {}
| ^^^^^^^^^^^^^^^^^
error[E0038]: the trait `NonObjectSafe3` cannot be made into an object
--> $DIR/feature-gate-object_safe_for_dispatch.rs:27:35
|
LL | trait NonObjectSafe3 {
| -------------- this trait cannot be made into an object...
LL | fn foo<T>(&self);
| --- ...because method `foo` has generic type parameters
...
LL | fn takes_non_object_safe_box(obj: Box<dyn NonObjectSafe3>) {
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe3` cannot be made into an object
|
= help: consider moving `foo` to another trait
error[E0038]: the trait `NonObjectSafe4` cannot be made into an object
--> $DIR/feature-gate-object_safe_for_dispatch.rs:31:35
|
LL | trait NonObjectSafe4 {
| -------------- this trait cannot be made into an object...
LL | fn foo(&self, &Self);
| ----- ...because method `foo` references the `Self` type in this parameter
...
LL | fn return_non_object_safe_rc() -> std::rc::Rc<dyn NonObjectSafe4> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe4` cannot be made into an object
|
= help: consider moving `foo` to another trait
error[E0038]: the trait `NonObjectSafe1` cannot be made into an object
--> $DIR/feature-gate-object_safe_for_dispatch.rs:38:16
|
2020-01-19 16:53:37 -06:00
LL | trait NonObjectSafe1: Sized {}
| -------------- ----- ...because it requires `Self: Sized`
| |
| this trait cannot be made into an object...
2020-01-19 16:53:37 -06:00
...
LL | impl Trait for dyn NonObjectSafe1 {}
| ^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe1` cannot be made into an object
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0038`.