]> git.lizzy.rs Git - rust.git/blob - src/test/ui/wf/wf-convert-unsafe-trait-obj-box.stderr
7e055d746f67671f651b696beadd8ad1c6b3beb9
[rust.git] / src / test / ui / wf / wf-convert-unsafe-trait-obj-box.stderr
1 error[E0038]: the trait `Trait` cannot be made into an object
2   --> $DIR/wf-convert-unsafe-trait-obj-box.rs:16:33
3    |
4 LL | trait Trait: Sized {}
5    |              ----- traits that require `Self: Sized` cannot be made into an object
6 ...
7 LL |     let t_box: Box<dyn Trait> = Box::new(S);
8    |                                 ^^^^^^^^^^^ the trait `Trait` cannot be made into an object
9    |
10    = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<dyn Trait>>` for `std::boxed::Box<S>`
11    = note: required by cast to type `std::boxed::Box<dyn Trait>`
12
13 error[E0038]: the trait `Trait` cannot be made into an object
14   --> $DIR/wf-convert-unsafe-trait-obj-box.rs:17:15
15    |
16 LL | trait Trait: Sized {}
17    |              ----- traits that require `Self: Sized` cannot be made into an object
18 ...
19 LL |     takes_box(Box::new(S));
20    |               ^^^^^^^^^^^ the trait `Trait` cannot be made into an object
21    |
22    = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<dyn Trait>>` for `std::boxed::Box<S>`
23    = note: required by cast to type `std::boxed::Box<(dyn Trait + 'static)>`
24
25 error[E0038]: the trait `Trait` cannot be made into an object
26   --> $DIR/wf-convert-unsafe-trait-obj-box.rs:15:5
27    |
28 LL | trait Trait: Sized {}
29    |              ----- traits that require `Self: Sized` cannot be made into an object
30 ...
31 LL |     Box::new(S) as Box<dyn Trait>;
32    |     ^^^^^^^^^^^ the trait `Trait` cannot be made into an object
33    |
34    = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<dyn Trait>>` for `std::boxed::Box<S>`
35    = note: required by cast to type `std::boxed::Box<dyn Trait>`
36
37 error: aborting due to 3 previous errors
38
39 For more information about this error, try `rustc --explain E0038`.