fork/rust

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

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

master
1.7 KiB35 linesraw
1error[E0038]: the trait `Trait` cannot be made into an object
2  --> $DIR/object-unsafe-trait-references-self.rs:6:12
3   |
4LL | fn bar(x: &dyn Trait) {}
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/object-unsafe-trait-references-self.rs:2:22
9   |
10LL | trait Trait {
11   |       ----- this trait cannot be made into an object...
12LL |     fn baz(&self, _: Self) {}
13   |                      ^^^^ ...because method `baz` references the `Self` type in this parameter
14LL |     fn bat(&self) -> Self {}
15   |                      ^^^^ ...because method `bat` references the `Self` type in its return type
16   = help: consider moving `baz` to another trait
17   = help: consider moving `bat` to another trait
18
19error[E0038]: the trait `Other` cannot be made into an object
20  --> $DIR/object-unsafe-trait-references-self.rs:10:12
21   |
22LL | fn foo(x: &dyn Other) {}
23   |            ^^^^^^^^^ `Other` cannot be made into an object
24   |
25note: 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>
26  --> $DIR/object-unsafe-trait-references-self.rs:8:14
27   |
28LL | trait Other: Sized {}
29   |       -----  ^^^^^ ...because it requires `Self: Sized`
30   |       |
31   |       this trait cannot be made into an object...
32
33error: aborting due to 2 previous errors
34
35For more information about this error, try `rustc --explain E0038`.