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