From a4b7ed7a42c716ab9f05e351f003d589124fd55d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:58 +0200 Subject: Adding upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../object-unsafe-trait-references-self.stderr | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/ui/suggestions/object-unsafe-trait-references-self.stderr (limited to 'tests/ui/suggestions/object-unsafe-trait-references-self.stderr') diff --git a/tests/ui/suggestions/object-unsafe-trait-references-self.stderr b/tests/ui/suggestions/object-unsafe-trait-references-self.stderr new file mode 100644 index 000000000..54f19fe9d --- /dev/null +++ b/tests/ui/suggestions/object-unsafe-trait-references-self.stderr @@ -0,0 +1,35 @@ +error[E0038]: the trait `Trait` cannot be made into an object + --> $DIR/object-unsafe-trait-references-self.rs:6:12 + | +LL | fn bar(x: &dyn Trait) {} + | ^^^^^^^^^ `Trait` 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 + --> $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 + +error[E0038]: the trait `Other` cannot be made into an object + --> $DIR/object-unsafe-trait-references-self.rs:10:12 + | +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 + --> $DIR/object-unsafe-trait-references-self.rs:8:14 + | +LL | trait Other: Sized {} + | ----- ^^^^^ ...because it requires `Self: Sized` + | | + | 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`. -- cgit v1.2.3