fork/rust

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

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

master
2.3 KiB48 linesraw
1error[E0038]: the trait `Trait` cannot be made into an object
2  --> $DIR/wf-convert-unsafe-trait-obj-box.rs:16:33
3   |
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   |
10LL | trait Trait: Sized {}
11   |       -----  ^^^^^ ...because it requires `Self: Sized`
12   |       |
13   |       this trait cannot be made into an object...
14   = note: required for the cast from `Box<S>` to `Box<dyn Trait>`
15
16error[E0038]: the trait `Trait` cannot be made into an object
17  --> $DIR/wf-convert-unsafe-trait-obj-box.rs:17:15
18   |
19LL |     takes_box(Box::new(S));
20   |               ^^^^^^^^^^^ `Trait` cannot be made into an object
21   |
22note: 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>
23  --> $DIR/wf-convert-unsafe-trait-obj-box.rs:6:14
24   |
25LL | trait Trait: Sized {}
26   |       -----  ^^^^^ ...because it requires `Self: Sized`
27   |       |
28   |       this trait cannot be made into an object...
29   = note: required for the cast from `Box<S>` to `Box<(dyn Trait + 'static)>`
30
31error[E0038]: the trait `Trait` cannot be made into an object
32  --> $DIR/wf-convert-unsafe-trait-obj-box.rs:15:5
33   |
34LL |     Box::new(S) as Box<dyn Trait>;
35   |     ^^^^^^^^^^^ `Trait` cannot be made into an object
36   |
37note: 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>
38  --> $DIR/wf-convert-unsafe-trait-obj-box.rs:6:14
39   |
40LL | trait Trait: Sized {}
41   |       -----  ^^^^^ ...because it requires `Self: Sized`
42   |       |
43   |       this trait cannot be made into an object...
44   = note: required for the cast from `Box<S>` to `Box<dyn Trait>`
45
46error: aborting due to 3 previous errors
47
48For more information about this error, try `rustc --explain E0038`.