pub fn error_msg(&self) -> Cow<'static, str> {
match *self {
ObjectSafetyViolation::SizedSelf(_) => {
- "the trait cannot require that `Self : Sized`".into()
+ "traits that require `Self: Sized` cannot be made into an object".into()
}
ObjectSafetyViolation::SupertraitSelf => {
"the trait cannot use `Self` as a type parameter \
LL | let _: &Copy + 'static;
| ^^^^^ the trait `std::marker::Copy` cannot be made into an object
|
- = note: the trait cannot require that `Self : Sized`
+ = note: traits that require `Self: Sized` cannot be made into an object
error: aborting due to 3 previous errors
--> $DIR/feature-gate-object_safe_for_dispatch.rs:18:38
|
LL | trait NonObjectSafe1: Sized {}
- | ----- the trait cannot require that `Self : Sized`
+ | ----- traits that require `Self: Sized` cannot be made into an object
...
LL | fn takes_non_object_safe_ref<T>(obj: &dyn NonObjectSafe1) {
| ^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe1` cannot be made into an object
--> $DIR/feature-gate-object_safe_for_dispatch.rs:38:6
|
LL | trait NonObjectSafe1: Sized {}
- | ----- the trait cannot require that `Self : Sized`
+ | ----- traits that require `Self: Sized` cannot be made into an object
...
LL | impl Trait for dyn NonObjectSafe1 {}
| ^^^^^ the trait `NonObjectSafe1` cannot be made into an object
--> $DIR/issue-20692.rs:7:5
|
LL | trait Array: Sized + Copy {}
- | ----- ---- the trait cannot require that `Self : Sized`
+ | ----- ---- traits that require `Self: Sized` cannot be made into an object
| |
- | the trait cannot require that `Self : Sized`
+ | traits that require `Self: Sized` cannot be made into an object
...
LL | &dyn Array;
| ^^^^^^^^^^ the trait `Array` cannot be made into an object
--> $DIR/issue-20692.rs:4:13
|
LL | trait Array: Sized + Copy {}
- | ----- ---- the trait cannot require that `Self : Sized`
+ | ----- ---- traits that require `Self: Sized` cannot be made into an object
| |
- | the trait cannot require that `Self : Sized`
+ | traits that require `Self: Sized` cannot be made into an object
...
LL | let _ = x
| ^ the trait `Array` cannot be made into an object
--> $DIR/kindck-inherited-copy-bound.rs:28:19
|
LL | trait Foo : Copy {
- | ---- the trait cannot require that `Self : Sized`
+ | ---- traits that require `Self: Sized` cannot be made into an object
...
LL | let z = &x as &dyn Foo;
| ^^^^^^^^ the trait `Foo` cannot be made into an object
--> $DIR/kindck-inherited-copy-bound.rs:28:13
|
LL | trait Foo : Copy {
- | ---- the trait cannot require that `Self : Sized`
+ | ---- traits that require `Self: Sized` cannot be made into an object
...
LL | let z = &x as &dyn Foo;
| ^^ the trait `Foo` cannot be made into an object
--> $DIR/kindck-inherited-copy-bound.rs:28:13
|
LL | trait Foo : Copy {
- | ---- the trait cannot require that `Self : Sized`
+ | ---- traits that require `Self: Sized` cannot be made into an object
...
LL | let z = &x as &dyn Foo;
| ^^ the trait `Foo` cannot be made into an object
--> $DIR/object-safety-sized-2.rs:14:30
|
LL | where Self : Sized
- | ----- the trait cannot require that `Self : Sized`
+ | ----- traits that require `Self: Sized` cannot be made into an object
...
LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^ the trait `Bar` cannot be made into an object
--> $DIR/object-safety-sized-2.rs:16:5
|
LL | where Self : Sized
- | ----- the trait cannot require that `Self : Sized`
+ | ----- traits that require `Self: Sized` cannot be made into an object
...
LL | t
| ^ the trait `Bar` cannot be made into an object
--> $DIR/object-safety-sized.rs:12:30
|
LL | trait Bar : Sized {
- | ----- the trait cannot require that `Self : Sized`
+ | ----- traits that require `Self: Sized` cannot be made into an object
...
LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^ the trait `Bar` cannot be made into an object
--> $DIR/object-safety-sized.rs:14:5
|
LL | trait Bar : Sized {
- | ----- the trait cannot require that `Self : Sized`
+ | ----- traits that require `Self: Sized` cannot be made into an object
...
LL | t
| ^ the trait `Bar` cannot be made into an object
--> $DIR/object-unsafe-trait-should-use-self.rs:3:13
|
LL | trait A: Sized {
- | ----- the trait cannot require that `Self : Sized`
+ | ----- traits that require `Self: Sized` cannot be made into an object
LL | fn f(a: A) -> A;
| ^ the trait `A` cannot be made into an object
LL | m!(dyn Copy + Send + 'static);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` cannot be made into an object
|
- = note: the trait cannot require that `Self : Sized`
+ = note: traits that require `Self: Sized` cannot be made into an object
error: aborting due to 2 previous errors
--> $DIR/wf-convert-unsafe-trait-obj-box.rs:16:33
|
LL | trait Trait: Sized {}
- | ----- the trait cannot require that `Self : Sized`
+ | ----- traits that require `Self: Sized` cannot be made into an object
...
LL | let t_box: Box<dyn Trait> = Box::new(S);
| ^^^^^^^^^^^ the trait `Trait` cannot be made into an object
--> $DIR/wf-convert-unsafe-trait-obj-box.rs:17:15
|
LL | trait Trait: Sized {}
- | ----- the trait cannot require that `Self : Sized`
+ | ----- traits that require `Self: Sized` cannot be made into an object
...
LL | takes_box(Box::new(S));
| ^^^^^^^^^^^ the trait `Trait` cannot be made into an object
--> $DIR/wf-convert-unsafe-trait-obj-box.rs:15:5
|
LL | trait Trait: Sized {}
- | ----- the trait cannot require that `Self : Sized`
+ | ----- traits that require `Self: Sized` cannot be made into an object
...
LL | Box::new(S) as Box<dyn Trait>;
| ^^^^^^^^^^^ the trait `Trait` cannot be made into an object
--> $DIR/wf-convert-unsafe-trait-obj.rs:16:25
|
LL | trait Trait: Sized {}
- | ----- the trait cannot require that `Self : Sized`
+ | ----- traits that require `Self: Sized` cannot be made into an object
...
LL | let t: &dyn Trait = &S;
| ^^ the trait `Trait` cannot be made into an object
--> $DIR/wf-convert-unsafe-trait-obj.rs:17:17
|
LL | trait Trait: Sized {}
- | ----- the trait cannot require that `Self : Sized`
+ | ----- traits that require `Self: Sized` cannot be made into an object
...
LL | takes_trait(&S);
| ^^ the trait `Trait` cannot be made into an object
--> $DIR/wf-convert-unsafe-trait-obj.rs:15:5
|
LL | trait Trait: Sized {}
- | ----- the trait cannot require that `Self : Sized`
+ | ----- traits that require `Self: Sized` cannot be made into an object
...
LL | &S as &dyn Trait;
| ^^ the trait `Trait` cannot be made into an object
LL | fn bar() where Vec<dyn Copy>:, {}
| ^^^^^^^^^^^^^ the trait `std::marker::Copy` cannot be made into an object
|
- = note: the trait cannot require that `Self : Sized`
+ = note: traits that require `Self: Sized` cannot be made into an object
error: aborting due to 3 previous errors
--> $DIR/wf-unsafe-trait-obj-match.rs:26:21
|
LL | trait Trait: Sized {}
- | ----- the trait cannot require that `Self : Sized`
+ | ----- traits that require `Self: Sized` cannot be made into an object
...
LL | Some(()) => &S,
| ^^ the trait `Trait` cannot be made into an object
--> $DIR/wf-unsafe-trait-obj-match.rs:25:25
|
LL | trait Trait: Sized {}
- | ----- the trait cannot require that `Self : Sized`
+ | ----- traits that require `Self: Sized` cannot be made into an object
...
LL | let t: &dyn Trait = match opt() {
| ^^^^^^^^^^^ the trait `Trait` cannot be made into an object