rust/src/test/ui/bad/bad-sized.stderr

31 lines
1.4 KiB
Plaintext
Raw Normal View History

2018-08-08 12:28:26 +00:00
error[E0225]: only auto traits can be used as additional traits in a trait object
2018-12-25 15:56:47 +00:00
--> $DIR/bad-sized.rs:4:24
2018-08-08 12:28:26 +00:00
|
LL | let x: Vec<Trait + Sized> = Vec::new();
| ^^^^^ non-auto additional trait
error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
2018-12-25 15:56:47 +00:00
--> $DIR/bad-sized.rs:4:12
2018-08-08 12:28:26 +00:00
|
LL | let x: Vec<Trait + Sized> = Vec::new();
| ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `dyn Trait`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
2018-08-08 12:28:26 +00:00
= note: required by `std::vec::Vec`
error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
2018-12-25 15:56:47 +00:00
--> $DIR/bad-sized.rs:4:33
2018-08-08 12:28:26 +00:00
|
LL | let x: Vec<Trait + Sized> = Vec::new();
| ^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `dyn Trait`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
2018-08-08 12:28:26 +00:00
= note: required by `<std::vec::Vec<T>>::new`
error: aborting due to 3 previous errors
Some errors occurred: E0225, E0277.
For more information about an error, try `rustc --explain E0225`.