fork/rust

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

borsAuto merge of #71868 - Mark-Simulacrum:stable-1.43.1, r=pietroalbini8d69840ab92

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