Tweak Self: Sized restriction diagnostic output
This commit is contained in:
parent
d137b7ac11
commit
4b2f1db6e4
13 changed files with 68 additions and 61 deletions
|
|
@ -6,8 +6,6 @@ LL | trait NonObjectSafe1: Sized {}
|
|||
...
|
||||
LL | fn takes_non_object_safe_ref<T>(obj: &dyn NonObjectSafe1) {
|
||||
| ^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe1` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot require that `Self : Sized`
|
||||
|
||||
error[E0038]: the trait `NonObjectSafe2` cannot be made into an object
|
||||
--> $DIR/feature-gate-object_safe_for_dispatch.rs:22:36
|
||||
|
|
@ -44,8 +42,6 @@ LL | trait NonObjectSafe1: Sized {}
|
|||
...
|
||||
LL | impl Trait for dyn NonObjectSafe1 {}
|
||||
| ^^^^^ the trait `NonObjectSafe1` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot require that `Self : Sized`
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
trait Array: Sized {}
|
||||
trait Array: Sized + Copy {}
|
||||
|
||||
fn f<T: Array>(x: &T) {
|
||||
let _ = x
|
||||
|
|
|
|||
|
|
@ -1,24 +1,25 @@
|
|||
error[E0038]: the trait `Array` cannot be made into an object
|
||||
--> $DIR/issue-20692.rs:7:5
|
||||
|
|
||||
LL | trait Array: Sized {}
|
||||
| ----- the trait cannot require that `Self : Sized`
|
||||
LL | trait Array: Sized + Copy {}
|
||||
| ----- ---- the trait cannot require that `Self : Sized`
|
||||
| |
|
||||
| the trait cannot require that `Self : Sized`
|
||||
...
|
||||
LL | &dyn Array;
|
||||
| ^^^^^^^^^^ the trait `Array` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot require that `Self : Sized`
|
||||
|
||||
error[E0038]: the trait `Array` cannot be made into an object
|
||||
--> $DIR/issue-20692.rs:4:13
|
||||
|
|
||||
LL | trait Array: Sized {}
|
||||
| ----- the trait cannot require that `Self : Sized`
|
||||
LL | trait Array: Sized + Copy {}
|
||||
| ----- ---- the trait cannot require that `Self : Sized`
|
||||
| |
|
||||
| the trait cannot require that `Self : Sized`
|
||||
...
|
||||
LL | let _ = x
|
||||
| ^ the trait `Array` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot require that `Self : Sized`
|
||||
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Array>` for `&T`
|
||||
= note: required by cast to type `&dyn Array`
|
||||
|
||||
|
|
|
|||
|
|
@ -12,18 +12,21 @@ LL | take_param(&x);
|
|||
error[E0038]: the trait `Foo` 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`
|
||||
...
|
||||
LL | let z = &x as &dyn Foo;
|
||||
| ^^^^^^^^ the trait `Foo` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot require that `Self : Sized`
|
||||
|
||||
error[E0038]: 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`
|
||||
...
|
||||
LL | let z = &x as &dyn Foo;
|
||||
| ^^ the trait `Foo` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot require that `Self : Sized`
|
||||
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Foo>` for `&std::boxed::Box<{integer}>`
|
||||
= note: required by cast to type `&dyn Foo`
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,12 @@ LL | take_param(&x);
|
|||
error[E0038]: 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`
|
||||
...
|
||||
LL | let z = &x as &dyn Foo;
|
||||
| ^^ the trait `Foo` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot require that `Self : Sized`
|
||||
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Foo>` for `&std::boxed::Box<i32>`
|
||||
= note: required by cast to type `&dyn Foo`
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ LL | trait Bar : Sized {
|
|||
...
|
||||
LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
|
||||
| ^^^^^^^^ the trait `Bar` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot require that `Self : Sized`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ LL | trait Bar : Sized {
|
|||
LL | t
|
||||
| ^ the trait `Bar` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot require that `Self : Sized`
|
||||
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Bar>` for `&T`
|
||||
= note: required by cast to type `&dyn Bar`
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@ LL | trait A: Sized {
|
|||
| ----- the trait cannot require that `Self : Sized`
|
||||
LL | fn f(a: A) -> A;
|
||||
| ^ the trait `A` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot require that `Self : Sized`
|
||||
|
||||
error: associated item referring to unboxed trait object for its own trait
|
||||
--> $DIR/object-unsafe-trait-should-use-self.rs:8:13
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ LL | trait Trait: Sized {}
|
|||
LL | let t_box: Box<dyn Trait> = Box::new(S);
|
||||
| ^^^^^^^^^^^ the trait `Trait` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot require that `Self : Sized`
|
||||
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<dyn Trait>>` for `std::boxed::Box<S>`
|
||||
= note: required by cast to type `std::boxed::Box<dyn Trait>`
|
||||
|
||||
|
|
@ -20,7 +19,6 @@ LL | trait Trait: Sized {}
|
|||
LL | takes_box(Box::new(S));
|
||||
| ^^^^^^^^^^^ the trait `Trait` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot require that `Self : Sized`
|
||||
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<dyn Trait>>` for `std::boxed::Box<S>`
|
||||
= note: required by cast to type `std::boxed::Box<(dyn Trait + 'static)>`
|
||||
|
||||
|
|
@ -33,7 +31,6 @@ LL | trait Trait: Sized {}
|
|||
LL | Box::new(S) as Box<dyn Trait>;
|
||||
| ^^^^^^^^^^^ the trait `Trait` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot require that `Self : Sized`
|
||||
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<dyn Trait>>` for `std::boxed::Box<S>`
|
||||
= note: required by cast to type `std::boxed::Box<dyn Trait>`
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ LL | trait Trait: Sized {}
|
|||
LL | let t: &dyn Trait = &S;
|
||||
| ^^ the trait `Trait` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot require that `Self : Sized`
|
||||
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Trait>` for `&S`
|
||||
= note: required by cast to type `&dyn Trait`
|
||||
|
||||
|
|
@ -20,7 +19,6 @@ LL | trait Trait: Sized {}
|
|||
LL | takes_trait(&S);
|
||||
| ^^ the trait `Trait` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot require that `Self : Sized`
|
||||
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Trait>` for `&S`
|
||||
= note: required by cast to type `&dyn Trait`
|
||||
|
||||
|
|
@ -33,7 +31,6 @@ LL | trait Trait: Sized {}
|
|||
LL | &S as &dyn Trait;
|
||||
| ^^ the trait `Trait` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot require that `Self : Sized`
|
||||
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Trait>` for `&S`
|
||||
= note: required by cast to type `&dyn Trait`
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ LL | trait Trait: Sized {}
|
|||
LL | Some(()) => &S,
|
||||
| ^^ the trait `Trait` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot require that `Self : Sized`
|
||||
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Trait>` for `&S`
|
||||
= note: required by cast to type `&dyn Trait`
|
||||
|
||||
|
|
@ -34,7 +33,6 @@ LL | trait Trait: Sized {}
|
|||
LL | let t: &dyn Trait = match opt() {
|
||||
| ^^^^^^^^^^^ the trait `Trait` cannot be made into an object
|
||||
|
|
||||
= note: the trait cannot require that `Self : Sized`
|
||||
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Trait>` for `&R`
|
||||
= note: required by cast to type `&dyn Trait`
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue