]> git.proxmox.com Git - rustc.git/blame - src/test/ui/wf/wf-convert-unsafe-trait-obj-box.stderr
New upstream version 1.65.0+dfsg1
[rustc.git] / src / test / ui / wf / wf-convert-unsafe-trait-obj-box.stderr
CommitLineData
e74abb32
XL
1error[E0038]: the trait `Trait` cannot be made into an object
2 --> $DIR/wf-convert-unsafe-trait-obj-box.rs:16:33
3 |
29967ef6
XL
4LL | let t_box: Box<dyn Trait> = Box::new(S);
5 | ^^^^^^^^^^^ `Trait` cannot be made into an object
6 |
7note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
8 --> $DIR/wf-convert-unsafe-trait-obj-box.rs:6:14
9 |
74b04a01 10LL | trait Trait: Sized {}
29967ef6 11 | ----- ^^^^^ ...because it requires `Self: Sized`
74b04a01
XL
12 | |
13 | this trait cannot be made into an object...
f2b60f7d 14 = note: required for `Box<S>` to implement `CoerceUnsized<Box<dyn Trait>>`
1b1a35ee 15 = note: required by cast to type `Box<dyn Trait>`
e74abb32
XL
16
17error[E0038]: the trait `Trait` cannot be made into an object
18 --> $DIR/wf-convert-unsafe-trait-obj-box.rs:17:15
19 |
29967ef6
XL
20LL | takes_box(Box::new(S));
21 | ^^^^^^^^^^^ `Trait` cannot be made into an object
22 |
23note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
24 --> $DIR/wf-convert-unsafe-trait-obj-box.rs:6:14
25 |
74b04a01 26LL | trait Trait: Sized {}
29967ef6 27 | ----- ^^^^^ ...because it requires `Self: Sized`
74b04a01
XL
28 | |
29 | this trait cannot be made into an object...
f2b60f7d 30 = note: required for `Box<S>` to implement `CoerceUnsized<Box<dyn Trait>>`
1b1a35ee 31 = note: required by cast to type `Box<(dyn Trait + 'static)>`
e74abb32
XL
32
33error[E0038]: the trait `Trait` cannot be made into an object
34 --> $DIR/wf-convert-unsafe-trait-obj-box.rs:15:5
35 |
29967ef6
XL
36LL | Box::new(S) as Box<dyn Trait>;
37 | ^^^^^^^^^^^ `Trait` cannot be made into an object
38 |
39note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
40 --> $DIR/wf-convert-unsafe-trait-obj-box.rs:6:14
41 |
74b04a01 42LL | trait Trait: Sized {}
29967ef6 43 | ----- ^^^^^ ...because it requires `Self: Sized`
74b04a01
XL
44 | |
45 | this trait cannot be made into an object...
f2b60f7d 46 = note: required for `Box<S>` to implement `CoerceUnsized<Box<dyn Trait>>`
1b1a35ee 47 = note: required by cast to type `Box<dyn Trait>`
e74abb32
XL
48
49error: aborting due to 3 previous errors
50
51For more information about this error, try `rustc --explain E0038`.