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