]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/test-2.stderr
Auto merge of #87284 - Aaron1011:remove-paren-special, r=petrochenkov
[rust.git] / src / test / ui / traits / test-2.stderr
1 error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
2   --> $DIR/test-2.rs:9:8
3    |
4 LL |     10.dup::<i32>();
5    |        ^^^------- help: remove these generics
6    |        |
7    |        expected 0 generic arguments
8    |
9 note: associated function defined here, with 0 generic parameters
10   --> $DIR/test-2.rs:4:16
11    |
12 LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
13    |                ^^^
14
15 error[E0107]: this associated function takes 1 generic argument but 2 generic arguments were supplied
16   --> $DIR/test-2.rs:11:8
17    |
18 LL |     10.blah::<i32, i32>();
19    |        ^^^^        --- help: remove this generic argument
20    |        |
21    |        expected 1 generic argument
22    |
23 note: associated function defined here, with 1 generic parameter: `X`
24   --> $DIR/test-2.rs:4:39
25    |
26 LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
27    |                                       ^^^^ -
28
29 error[E0038]: the trait `bar` cannot be made into an object
30   --> $DIR/test-2.rs:13:16
31    |
32 LL |     (box 10 as Box<dyn bar>).dup();
33    |                ^^^^^^^^^^^^ `bar` cannot be made into an object
34    |
35    = help: consider moving `dup` to another trait
36    = help: consider moving `blah` to another trait
37 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>
38   --> $DIR/test-2.rs:4:30
39    |
40 LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
41    |       ---                    ^^^^     ^^^^ ...because method `blah` has generic type parameters
42    |       |                      |
43    |       |                      ...because method `dup` references the `Self` type in its return type
44    |       this trait cannot be made into an object...
45
46 error[E0038]: the trait `bar` cannot be made into an object
47   --> $DIR/test-2.rs:13:6
48    |
49 LL |     (box 10 as Box<dyn bar>).dup();
50    |      ^^^^^^ `bar` cannot be made into an object
51    |
52    = help: consider moving `dup` to another trait
53    = help: consider moving `blah` to another trait
54 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>
55   --> $DIR/test-2.rs:4:30
56    |
57 LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
58    |       ---                    ^^^^     ^^^^ ...because method `blah` has generic type parameters
59    |       |                      |
60    |       |                      ...because method `dup` references the `Self` type in its return type
61    |       this trait cannot be made into an object...
62    = note: required because of the requirements on the impl of `CoerceUnsized<Box<dyn bar>>` for `Box<{integer}>`
63    = note: required by cast to type `Box<dyn bar>`
64
65 error: aborting due to 4 previous errors
66
67 Some errors have detailed explanations: E0038, E0107.
68 For more information about an error, try `rustc --explain E0038`.