rust/tests/ui/suggestions/object-unsafe-trait-references-self.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
1.7 KiB
Plaintext
Raw Normal View History

2020-02-01 03:04:58 +00:00
error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/object-unsafe-trait-references-self.rs:6:12
2020-02-01 03:04:58 +00:00
|
LL | fn bar(x: &dyn Trait) {}
| ^^^^^^^^^ `Trait` cannot be made into an object
2020-02-01 03:04:58 +00:00
|
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>
--> $DIR/object-unsafe-trait-references-self.rs:2:22
|
LL | trait Trait {
| ----- this trait cannot be made into an object...
LL | fn baz(&self, _: Self) {}
| ^^^^ ...because method `baz` references the `Self` type in this parameter
LL | fn bat(&self) -> Self {}
| ^^^^ ...because method `bat` references the `Self` type in its return type
= help: consider moving `baz` to another trait
= help: consider moving `bat` to another trait
2020-02-01 03:04:58 +00:00
error[E0038]: the trait `Other` cannot be made into an object
--> $DIR/object-unsafe-trait-references-self.rs:10:12
2020-02-01 03:04:58 +00:00
|
LL | fn foo(x: &dyn Other) {}
| ^^^^^^^^^ `Other` cannot be made into an object
|
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>
--> $DIR/object-unsafe-trait-references-self.rs:8:14
|
2020-02-01 03:04:58 +00:00
LL | trait Other: Sized {}
| ----- ^^^^^ ...because it requires `Self: Sized`
2020-02-01 03:04:58 +00:00
| |
| this trait cannot be made into an object...
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0038`.