Auto merge of #120558 - oli-obk:missing_impl_item_ice, r=estebank
Stop bailing out from compilation just because there were incoherent traits fixes #120343 but also has a lot of "type annotations needed" fallout. Some are fixed in the second commit.
This commit is contained in:
commit
870a01a30e
50 changed files with 490 additions and 146 deletions
|
@ -1,4 +1,5 @@
|
|||
impl Drop for u32 {} //~ ERROR E0117
|
||||
//~| ERROR the `Drop` trait may only be implemented for local structs, enums, and unions
|
||||
//~| ERROR not all trait items implemented
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -15,7 +15,15 @@ error[E0120]: the `Drop` trait may only be implemented for local structs, enums,
|
|||
LL | impl Drop for u32 {}
|
||||
| ^^^ must be a struct, enum, or union in the current crate
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error[E0046]: not all trait items implemented, missing: `drop`
|
||||
--> $DIR/E0117.rs:1:1
|
||||
|
|
||||
LL | impl Drop for u32 {}
|
||||
| ^^^^^^^^^^^^^^^^^ missing `drop` in implementation
|
||||
|
|
||||
= help: implement the missing item: `fn drop(&mut self) { todo!() }`
|
||||
|
||||
Some errors have detailed explanations: E0117, E0120.
|
||||
For more information about an error, try `rustc --explain E0117`.
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0046, E0117, E0120.
|
||||
For more information about an error, try `rustc --explain E0046`.
|
||||
|
|
|
@ -3,6 +3,7 @@ trait MyTrait { fn foo() {} }
|
|||
impl Drop for dyn MyTrait {
|
||||
//~^ ERROR E0120
|
||||
fn drop(&mut self) {}
|
||||
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(coerce_unsized)]
|
||||
use std::ops::CoerceUnsized;
|
||||
|
||||
struct Foo<T: ?Sized> {
|
||||
struct Foo<T: ?Sized> { //~ ERROR `T` is never used
|
||||
a: i32,
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,15 @@ LL | | where T: CoerceUnsized<U> {}
|
|||
|
|
||||
= note: expected a single field to be coerced, none found
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error[E0392]: type parameter `T` is never used
|
||||
--> $DIR/E0374.rs:4:12
|
||||
|
|
||||
LL | struct Foo<T: ?Sized> {
|
||||
| ^ unused type parameter
|
||||
|
|
||||
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
|
||||
|
||||
For more information about this error, try `rustc --explain E0374`.
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0374, E0392.
|
||||
For more information about an error, try `rustc --explain E0374`.
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::ops::CoerceUnsized;
|
|||
|
||||
struct Foo<T: ?Sized, U: ?Sized> {
|
||||
a: i32,
|
||||
b: T,
|
||||
b: T, //~ ERROR E0277
|
||||
c: U,
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,32 @@ LL | impl<T, U> CoerceUnsized<Foo<U, T>> for Foo<T, U> {}
|
|||
= note: `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced
|
||||
= note: currently, 2 fields need coercions: `b` (`T` to `U`), `c` (`U` to `T`)
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error[E0277]: the size for values of type `T` cannot be known at compilation time
|
||||
--> $DIR/E0375.rs:6:8
|
||||
|
|
||||
LL | struct Foo<T: ?Sized, U: ?Sized> {
|
||||
| - this type parameter needs to be `Sized`
|
||||
LL | a: i32,
|
||||
LL | b: T,
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
|
||||
= note: only the last field of a struct may have a dynamically sized type
|
||||
= help: change the field's type to have a statically known size
|
||||
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
||||
|
|
||||
LL - struct Foo<T: ?Sized, U: ?Sized> {
|
||||
LL + struct Foo<T, U: ?Sized> {
|
||||
|
|
||||
help: borrowed types always have a statically known size
|
||||
|
|
||||
LL | b: &T,
|
||||
| +
|
||||
help: the `Box` type always has a statically known size and allocates its contents in the heap
|
||||
|
|
||||
LL | b: Box<T>,
|
||||
| ++++ +
|
||||
|
||||
For more information about this error, try `rustc --explain E0375`.
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0375.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue