2019-01-08 15:14:04 -06:00
|
|
|
error[E0038]: the trait `NonObjectSafe1` cannot be made into an object
|
2020-01-18 16:57:56 -06:00
|
|
|
--> $DIR/feature-gate-object_safe_for_dispatch.rs:18:38
|
2019-01-08 15:14:04 -06:00
|
|
|
|
|
2020-01-19 16:53:37 -06:00
|
|
|
LL | trait NonObjectSafe1: Sized {}
|
2020-01-31 18:47:00 -06:00
|
|
|
| -------------- ----- ...because it requires `Self: Sized`
|
|
|
|
| |
|
|
|
|
| this trait cannot be made into an object...
|
2020-01-19 16:53:37 -06:00
|
|
|
...
|
2019-01-08 15:14:04 -06:00
|
|
|
LL | fn takes_non_object_safe_ref<T>(obj: &dyn NonObjectSafe1) {
|
2020-01-18 16:57:56 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe1` cannot be made into an object
|
2019-01-08 15:14:04 -06:00
|
|
|
|
|
|
|
error[E0038]: the trait `NonObjectSafe2` cannot be made into an object
|
2020-01-18 16:57:56 -06:00
|
|
|
--> $DIR/feature-gate-object_safe_for_dispatch.rs:22:36
|
2019-01-08 15:14:04 -06:00
|
|
|
|
|
2020-01-31 18:47:00 -06:00
|
|
|
LL | trait NonObjectSafe2 {
|
|
|
|
| -------------- this trait cannot be made into an object...
|
2019-01-08 15:14:04 -06:00
|
|
|
LL | fn static_fn() {}
|
2020-01-31 18:47:00 -06:00
|
|
|
| --------- ...because associated function `static_fn` has no `self` parameter
|
2019-01-08 15:14:04 -06:00
|
|
|
...
|
|
|
|
LL | fn return_non_object_safe_ref() -> &'static dyn NonObjectSafe2 {
|
2020-01-18 16:57:56 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe2` cannot be made into an object
|
2020-01-31 18:47:00 -06:00
|
|
|
|
|
2020-01-31 20:48:35 -06:00
|
|
|
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 {}
|
|
|
|
| ^^^^^^^^^^^^^^^^^
|
2019-01-08 15:14:04 -06:00
|
|
|
|
|
|
|
error[E0038]: the trait `NonObjectSafe3` cannot be made into an object
|
2020-01-18 16:57:56 -06:00
|
|
|
--> $DIR/feature-gate-object_safe_for_dispatch.rs:27:35
|
2019-01-08 15:14:04 -06:00
|
|
|
|
|
2020-01-31 18:47:00 -06:00
|
|
|
LL | trait NonObjectSafe3 {
|
|
|
|
| -------------- this trait cannot be made into an object...
|
2019-01-08 15:14:04 -06:00
|
|
|
LL | fn foo<T>(&self);
|
2020-01-31 18:47:00 -06:00
|
|
|
| --- ...because method `foo` has generic type parameters
|
2019-01-08 15:14:04 -06:00
|
|
|
...
|
|
|
|
LL | fn takes_non_object_safe_box(obj: Box<dyn NonObjectSafe3>) {
|
2020-01-18 16:57:56 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe3` cannot be made into an object
|
2020-01-31 18:47:00 -06:00
|
|
|
|
|
|
|
|
= help: consider moving `foo` to another trait
|
2019-01-08 15:14:04 -06:00
|
|
|
|
|
|
|
error[E0038]: the trait `NonObjectSafe4` cannot be made into an object
|
2020-01-18 16:57:56 -06:00
|
|
|
--> $DIR/feature-gate-object_safe_for_dispatch.rs:31:35
|
2019-01-08 15:14:04 -06:00
|
|
|
|
|
2020-01-31 18:47:00 -06:00
|
|
|
LL | trait NonObjectSafe4 {
|
|
|
|
| -------------- this trait cannot be made into an object...
|
2019-01-08 15:14:04 -06:00
|
|
|
LL | fn foo(&self, &Self);
|
2020-01-31 20:48:35 -06:00
|
|
|
| ----- ...because method `foo` references the `Self` type in this parameter
|
2019-01-08 15:14:04 -06:00
|
|
|
...
|
|
|
|
LL | fn return_non_object_safe_rc() -> std::rc::Rc<dyn NonObjectSafe4> {
|
2020-01-18 16:57:56 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe4` cannot be made into an object
|
2020-01-31 18:47:00 -06:00
|
|
|
|
|
|
|
|
= help: consider moving `foo` to another trait
|
2019-01-08 15:14:04 -06:00
|
|
|
|
|
|
|
error[E0038]: the trait `NonObjectSafe1` cannot be made into an object
|
2020-07-25 01:05:19 -05:00
|
|
|
--> $DIR/feature-gate-object_safe_for_dispatch.rs:38:16
|
2019-01-08 15:14:04 -06:00
|
|
|
|
|
2020-01-19 16:53:37 -06:00
|
|
|
LL | trait NonObjectSafe1: Sized {}
|
2020-01-31 18:47:00 -06:00
|
|
|
| -------------- ----- ...because it requires `Self: Sized`
|
|
|
|
| |
|
|
|
|
| this trait cannot be made into an object...
|
2020-01-19 16:53:37 -06:00
|
|
|
...
|
2019-01-08 15:14:04 -06:00
|
|
|
LL | impl Trait for dyn NonObjectSafe1 {}
|
2020-07-25 01:05:19 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe1` cannot be made into an object
|
2019-01-08 15:14:04 -06:00
|
|
|
|
|
|
|
error: aborting due to 5 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0038`.
|