]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/test-2.stderr
Add regression test for #82830
[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:22
31    |
32 LL |     (Box::new(10) as Box<dyn bar>).dup();
33    |                      ^^^^^^^^^^^^ `bar` cannot be made into an object
34    |
35 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>
36   --> $DIR/test-2.rs:4:30
37    |
38 LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
39    |       ---                    ^^^^     ^^^^ ...because method `blah` has generic type parameters
40    |       |                      |
41    |       |                      ...because method `dup` references the `Self` type in its return type
42    |       this trait cannot be made into an object...
43    = help: consider moving `dup` to another trait
44    = help: consider moving `blah` to another trait
45
46 error[E0038]: the trait `bar` cannot be made into an object
47   --> $DIR/test-2.rs:13:5
48    |
49 LL |     (Box::new(10) as Box<dyn bar>).dup();
50    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `bar` cannot be made into an object
51    |
52 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>
53   --> $DIR/test-2.rs:4:30
54    |
55 LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
56    |       ---                    ^^^^     ^^^^ ...because method `blah` has generic type parameters
57    |       |                      |
58    |       |                      ...because method `dup` references the `Self` type in its return type
59    |       this trait cannot be made into an object...
60    = help: consider moving `dup` to another trait
61    = help: consider moving `blah` to another trait
62
63 error[E0038]: the trait `bar` cannot be made into an object
64   --> $DIR/test-2.rs:13:6
65    |
66 LL |     (Box::new(10) as Box<dyn bar>).dup();
67    |      ^^^^^^^^^^^^ `bar` cannot be made into an object
68    |
69 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>
70   --> $DIR/test-2.rs:4:30
71    |
72 LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
73    |       ---                    ^^^^     ^^^^ ...because method `blah` has generic type parameters
74    |       |                      |
75    |       |                      ...because method `dup` references the `Self` type in its return type
76    |       this trait cannot be made into an object...
77    = help: consider moving `dup` to another trait
78    = help: consider moving `blah` to another trait
79    = note: required because of the requirements on the impl of `CoerceUnsized<Box<dyn bar>>` for `Box<{integer}>`
80    = note: required by cast to type `Box<dyn bar>`
81
82 error: aborting due to 5 previous errors
83
84 Some errors have detailed explanations: E0038, E0107.
85 For more information about an error, try `rustc --explain E0038`.