summary refs log tree commit diff
path: root/src/test/ui/bad/bad-sized.stderr
blob: 5c169af4eb8ae33380ac6e6a6543b29516b851c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
error[E0225]: only auto traits can be used as additional traits in a trait object
  --> $DIR/bad-sized.rs:4:28
   |
LL |     let x: Vec<dyn Trait + Sized> = Vec::new();
   |                    -----   ^^^^^
   |                    |       |
   |                    |       additional non-auto trait
   |                    |       trait alias used in trait object type (additional use)
   |                    first non-auto trait
   |                    trait alias used in trait object type (first use)

error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
  --> $DIR/bad-sized.rs:4:12
   |
LL |     let x: Vec<dyn Trait + Sized> = Vec::new();
   |            ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
   | 
  ::: $SRC_DIR/liballoc/vec.rs:LL:COL
   |
LL | pub struct Vec<T> {
   |                - required by this bound in `std::vec::Vec`
   |
   = 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>

error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
  --> $DIR/bad-sized.rs:4:37
   |
LL |     let x: Vec<dyn 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>
   = note: required by `std::vec::Vec::<T>::new`

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0225, E0277.
For more information about an error, try `rustc --explain E0225`.