fork/rust

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

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

master
3.1 KiB64 linesraw
1error[E0038]: the trait `Foo` cannot be made into an object
2  --> $DIR/object-safety.rs:17:33
3   |
4LL |     let i = Box::new(42_u32) as Box<dyn Foo>;
5   |                                 ^^^^^^^^^^^^ `Foo` 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/object-safety.rs:7:22
9   |
10LL | trait Foo {
11   |       --- this trait cannot be made into an object...
12LL |     fn baz(&self) -> impl Debug;
13   |                      ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
14   = help: consider moving `baz` to another trait
15
16error[E0038]: the trait `Foo` cannot be made into an object
17  --> $DIR/object-safety.rs:20:15
18   |
19LL |     let s = i.baz();
20   |               ^^^ `Foo` 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/object-safety.rs:7:22
24   |
25LL | trait Foo {
26   |       --- this trait cannot be made into an object...
27LL |     fn baz(&self) -> impl Debug;
28   |                      ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
29   = help: consider moving `baz` to another trait
30
31error[E0038]: the trait `Foo` cannot be made into an object
32  --> $DIR/object-safety.rs:20:13
33   |
34LL |     let s = i.baz();
35   |             ^^^^^^^ `Foo` 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/object-safety.rs:7:22
39   |
40LL | trait Foo {
41   |       --- this trait cannot be made into an object...
42LL |     fn baz(&self) -> impl Debug;
43   |                      ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
44   = help: consider moving `baz` to another trait
45
46error[E0038]: the trait `Foo` cannot be made into an object
47  --> $DIR/object-safety.rs:17:13
48   |
49LL |     let i = Box::new(42_u32) as Box<dyn Foo>;
50   |             ^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object
51   |
52note: 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>
53  --> $DIR/object-safety.rs:7:22
54   |
55LL | trait Foo {
56   |       --- this trait cannot be made into an object...
57LL |     fn baz(&self) -> impl Debug;
58   |                      ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
59   = help: consider moving `baz` to another trait
60   = note: required for the cast from `Box<u32>` to `Box<dyn Foo>`
61
62error: aborting due to 4 previous errors
63
64For more information about this error, try `rustc --explain E0038`.