]> git.lizzy.rs Git - rust.git/blob - src/test/ui/bad/bad-sized.stderr
9565888dcc022a0a11a046b73474dffbcf6c0561
[rust.git] / src / test / ui / bad / bad-sized.stderr
1 error[E0225]: only auto traits can be used as additional traits in a trait object
2   --> $DIR/bad-sized.rs:4:24
3    |
4 LL |     let x: Vec<Trait + Sized> = Vec::new();
5    |                        ^^^^^ non-auto additional trait
6
7 error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
8   --> $DIR/bad-sized.rs:4:12
9    |
10 LL |     let x: Vec<Trait + Sized> = Vec::new();
11    |            ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
12    |
13    = help: the trait `std::marker::Sized` is not implemented for `dyn Trait`
14    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
15    = note: required by `std::vec::Vec`
16
17 error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
18   --> $DIR/bad-sized.rs:4:33
19    |
20 LL |     let x: Vec<Trait + Sized> = Vec::new();
21    |                                 ^^^^^^^^ doesn't have a size known at compile-time
22    |
23    = help: the trait `std::marker::Sized` is not implemented for `dyn Trait`
24    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
25    = note: required by `<std::vec::Vec<T>>::new`
26
27 error: aborting due to 3 previous errors
28
29 Some errors occurred: E0225, E0277.
30 For more information about an error, try `rustc --explain E0225`.