]> git.proxmox.com Git - rustc.git/blame - src/test/ui/bad/bad-sized.stderr
New upstream version 1.51.0+dfsg1
[rustc.git] / src / test / ui / bad / bad-sized.stderr
CommitLineData
b7449926 1error[E0225]: only auto traits can be used as additional traits in a trait object
dc9dc135 2 --> $DIR/bad-sized.rs:4:28
b7449926 3 |
dc9dc135 4LL | let x: Vec<dyn Trait + Sized> = Vec::new();
3dfed10e
XL
5 | ----- ^^^^^ additional non-auto trait
6 | |
dc9dc135 7 | first non-auto trait
3dfed10e 8 |
1b1a35ee 9 = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Trait + Sized {}`
3dfed10e 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>
b7449926
XL
11
12error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
0731742a 13 --> $DIR/bad-sized.rs:4:12
b7449926 14 |
dc9dc135
XL
15LL | let x: Vec<dyn Trait + Sized> = Vec::new();
16 | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
ba9703b0 17 |
5869c6ff 18 ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
ba9703b0 19 |
fc512014 20LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
1b1a35ee 21 | - required by this bound in `Vec`
b7449926 22 |
1b1a35ee 23 = help: the trait `Sized` is not implemented for `dyn Trait`
b7449926
XL
24
25error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
dc9dc135 26 --> $DIR/bad-sized.rs:4:37
b7449926 27 |
dc9dc135
XL
28LL | let x: Vec<dyn Trait + Sized> = Vec::new();
29 | ^^^^^^^^ doesn't have a size known at compile-time
b7449926 30 |
1b1a35ee
XL
31 = help: the trait `Sized` is not implemented for `dyn Trait`
32 = note: required by `Vec::<T>::new`
b7449926
XL
33
34error: aborting due to 3 previous errors
35
48663c56 36Some errors have detailed explanations: E0225, E0277.
b7449926 37For more information about an error, try `rustc --explain E0225`.