fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.0 KiB45 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   |                    -----   ^^^^^ additional non-auto trait
6   |                    |
7   |                    first non-auto trait
8   |
9   = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Trait + Sized {}`
10   = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
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   = help: the trait `Sized` is not implemented for `dyn Trait`
19note: required by a bound in `Vec`
20  --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
21
22error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
23  --> $DIR/bad-sized.rs:4:37
24   |
25LL |     let x: Vec<dyn Trait + Sized> = Vec::new();
26   |                                     ^^^^^^^^ doesn't have a size known at compile-time
27   |
28   = help: the trait `Sized` is not implemented for `dyn Trait`
29note: required by a bound in `Vec::<T>::new`
30  --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
31
32error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
33  --> $DIR/bad-sized.rs:4:37
34   |
35LL |     let x: Vec<dyn Trait + Sized> = Vec::new();
36   |                                     ^^^ doesn't have a size known at compile-time
37   |
38   = help: the trait `Sized` is not implemented for `dyn Trait`
39note: required by a bound in `Vec`
40  --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
41
42error: aborting due to 4 previous errors
43
44Some errors have detailed explanations: E0225, E0277.
45For more information about an error, try `rustc --explain E0225`.