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