fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
1.8 KiB39 linesraw
1error[E0225]: only auto traits can be used as additional traits in a trait object
2  --> $DIR/bad-sized.rs:4:28
3   |
4LL |     let x: Vec<dyn Trait + Sized> = Vec::new();
5   |                    -----   ^^^^^
6   |                    |       |
7   |                    |       additional non-auto trait
8   |                    |       trait alias used in trait object type (additional use)
9   |                    first non-auto trait
10   |                    trait alias used in trait object type (first use)
11
12error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
13  --> $DIR/bad-sized.rs:4:12
14   |
15LL |     let x: Vec<dyn Trait + Sized> = Vec::new();
16   |            ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
17   | 
18  ::: $SRC_DIR/liballoc/vec.rs:LL:COL
19   |
20LL | pub struct Vec<T> {
21   |                - required by this bound in `std::vec::Vec`
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
26error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
27  --> $DIR/bad-sized.rs:4:37
28   |
29LL |     let x: Vec<dyn Trait + Sized> = Vec::new();
30   |                                     ^^^^^^^^ doesn't have a size known at compile-time
31   |
32   = help: the trait `std::marker::Sized` is not implemented for `dyn Trait`
33   = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
34   = note: required by `std::vec::Vec::<T>::new`
35
36error: aborting due to 3 previous errors
37
38Some errors have detailed explanations: E0225, E0277.
39For more information about an error, try `rustc --explain E0225`.