fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
3.8 KiB84 linesraw
1error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
2  --> $DIR/test-2.rs:9:8
3   |
4LL |     10.dup::<i32>();
5   |        ^^^------- help: remove these generics
6   |        |
7   |        expected 0 generic arguments
8   |
9note: method defined here, with 0 generic parameters
10  --> $DIR/test-2.rs:4:16
11   |
12LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
13   |                ^^^
14
15error[E0107]: method takes 1 generic argument but 2 generic arguments were supplied
16  --> $DIR/test-2.rs:11:8
17   |
18LL |     10.blah::<i32, i32>();
19   |        ^^^^        --- help: remove this generic argument
20   |        |
21   |        expected 1 generic argument
22   |
23note: method defined here, with 1 generic parameter: `X`
24  --> $DIR/test-2.rs:4:39
25   |
26LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
27   |                                       ^^^^ -
28
29error[E0038]: the trait `bar` cannot be made into an object
30  --> $DIR/test-2.rs:13:22
31   |
32LL |     (Box::new(10) as Box<dyn bar>).dup();
33   |                      ^^^^^^^^^^^^ `bar` cannot be made into an object
34   |
35note: 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   |
38LL | 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
46error[E0038]: the trait `bar` cannot be made into an object
47  --> $DIR/test-2.rs:13:5
48   |
49LL |     (Box::new(10) as Box<dyn bar>).dup();
50   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `bar` cannot be made into an object
51   |
52note: 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   |
55LL | 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
63error[E0038]: the trait `bar` cannot be made into an object
64  --> $DIR/test-2.rs:13:6
65   |
66LL |     (Box::new(10) as Box<dyn bar>).dup();
67   |      ^^^^^^^^^^^^ `bar` cannot be made into an object
68   |
69note: 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   |
72LL | 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 for the cast from `Box<{integer}>` to `Box<dyn bar>`
80
81error: aborting due to 5 previous errors
82
83Some errors have detailed explanations: E0038, E0107.
84For more information about an error, try `rustc --explain E0038`.