2023-02-23 10:27:06 -07:00
|
|
|
error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
|
2021-02-08 23:15:45 +01:00
|
|
|
--> $DIR/test-2.rs:9:8
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | 10.dup::<i32>();
|
2024-07-22 22:51:53 +00:00
|
|
|
| ^^^------- help: remove the unnecessary generics
|
|
|
|
|
| |
|
|
|
|
|
| expected 0 generic arguments
|
2021-01-02 19:45:11 +01:00
|
|
|
|
|
2023-02-21 14:11:08 -07:00
|
|
|
note: method defined here, with 0 generic parameters
|
2021-02-08 23:15:45 +01:00
|
|
|
--> $DIR/test-2.rs:4:16
|
2021-01-02 19:45:11 +01:00
|
|
|
|
|
|
|
|
|
LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
|
|
|
|
|
| ^^^
|
2018-08-08 14:28:26 +02:00
|
|
|
|
2023-02-23 10:27:06 -07:00
|
|
|
error[E0107]: method takes 1 generic argument but 2 generic arguments were supplied
|
2021-02-08 23:15:45 +01:00
|
|
|
--> $DIR/test-2.rs:11:8
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | 10.blah::<i32, i32>();
|
2024-07-22 22:51:53 +00:00
|
|
|
| ^^^^ ----- help: remove the unnecessary generic argument
|
|
|
|
|
| |
|
|
|
|
|
| expected 1 generic argument
|
2021-01-02 19:45:11 +01:00
|
|
|
|
|
2023-02-21 14:11:08 -07:00
|
|
|
note: method defined here, with 1 generic parameter: `X`
|
2021-02-08 23:15:45 +01:00
|
|
|
--> $DIR/test-2.rs:4:39
|
2021-01-02 19:45:11 +01:00
|
|
|
|
|
|
|
|
|
LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
|
|
|
|
|
| ^^^^ -
|
2018-08-08 14:28:26 +02:00
|
|
|
|
2024-11-20 14:19:36 -08:00
|
|
|
error[E0038]: the trait `bar` is not dyn compatible
|
2021-08-25 02:39:40 +02:00
|
|
|
--> $DIR/test-2.rs:13:22
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
2021-08-25 02:39:40 +02:00
|
|
|
LL | (Box::new(10) as Box<dyn bar>).dup();
|
2024-11-20 14:19:36 -08:00
|
|
|
| ^^^^^^^^^^^^ `bar` is not dyn compatible
|
2021-08-25 02:39:40 +02:00
|
|
|
|
|
2024-11-20 14:19:36 -08:00
|
|
|
note: for a trait to be dyn compatible it needs to allow building a vtable
|
2025-01-22 05:14:07 +01:00
|
|
|
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
2021-08-25 02:39:40 +02:00
|
|
|
--> $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
|
2024-11-20 14:19:36 -08:00
|
|
|
| this trait is not dyn compatible...
|
2021-08-25 02:39:40 +02:00
|
|
|
= help: consider moving `dup` to another trait
|
|
|
|
|
= help: consider moving `blah` to another trait
|
2024-11-20 14:19:36 -08:00
|
|
|
= help: the following types implement `bar`:
|
2023-10-24 16:45:04 +00:00
|
|
|
i32
|
|
|
|
|
u32
|
2024-11-20 14:19:36 -08:00
|
|
|
consider defining an enum where each variant holds one of these types,
|
|
|
|
|
implementing `bar` for this new enum and using it instead
|
2021-08-25 02:39:40 +02:00
|
|
|
|
2024-11-20 14:19:36 -08:00
|
|
|
error[E0038]: the trait `bar` is not dyn compatible
|
2021-08-25 02:39:40 +02:00
|
|
|
--> $DIR/test-2.rs:13:5
|
|
|
|
|
|
|
|
|
|
|
LL | (Box::new(10) as Box<dyn bar>).dup();
|
2024-11-20 14:19:36 -08:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `bar` is not dyn compatible
|
2020-01-31 16:47:00 -08:00
|
|
|
|
|
2024-11-20 14:19:36 -08:00
|
|
|
note: for a trait to be dyn compatible it needs to allow building a vtable
|
2025-01-22 05:14:07 +01:00
|
|
|
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
2021-02-08 23:15:45 +01:00
|
|
|
--> $DIR/test-2.rs:4:30
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
2019-09-02 20:22:22 -07:00
|
|
|
LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
|
2020-10-15 17:23:45 -07:00
|
|
|
| --- ^^^^ ^^^^ ...because method `blah` has generic type parameters
|
2020-01-31 18:48:35 -08:00
|
|
|
| | |
|
|
|
|
|
| | ...because method `dup` references the `Self` type in its return type
|
2024-11-20 14:19:36 -08:00
|
|
|
| this trait is not dyn compatible...
|
2021-09-12 18:49:56 +00:00
|
|
|
= help: consider moving `dup` to another trait
|
|
|
|
|
= help: consider moving `blah` to another trait
|
2024-11-20 14:19:36 -08:00
|
|
|
= help: the following types implement `bar`:
|
2023-10-24 16:45:04 +00:00
|
|
|
i32
|
|
|
|
|
u32
|
2024-11-20 14:19:36 -08:00
|
|
|
consider defining an enum where each variant holds one of these types,
|
|
|
|
|
implementing `bar` for this new enum and using it instead
|
2020-10-15 17:23:45 -07:00
|
|
|
|
2024-11-20 14:19:36 -08:00
|
|
|
error[E0038]: the trait `bar` is not dyn compatible
|
2021-02-08 23:15:45 +01:00
|
|
|
--> $DIR/test-2.rs:13:6
|
2020-10-15 17:23:45 -07:00
|
|
|
|
|
2021-08-25 02:39:40 +02:00
|
|
|
LL | (Box::new(10) as Box<dyn bar>).dup();
|
2024-11-20 14:19:36 -08:00
|
|
|
| ^^^^^^^^^^^^ `bar` is not dyn compatible
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
2024-11-20 14:19:36 -08:00
|
|
|
note: for a trait to be dyn compatible it needs to allow building a vtable
|
2025-01-22 05:14:07 +01:00
|
|
|
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
2021-02-08 23:15:45 +01:00
|
|
|
--> $DIR/test-2.rs:4:30
|
2020-10-15 17:23:45 -07:00
|
|
|
|
|
|
|
|
|
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
|
2024-11-20 14:19:36 -08:00
|
|
|
| this trait is not dyn compatible...
|
2021-09-12 18:49:56 +00:00
|
|
|
= help: consider moving `dup` to another trait
|
|
|
|
|
= help: consider moving `blah` to another trait
|
2024-11-20 14:19:36 -08:00
|
|
|
= help: the following types implement `bar`:
|
2023-10-24 16:45:04 +00:00
|
|
|
i32
|
|
|
|
|
u32
|
2024-11-20 14:19:36 -08:00
|
|
|
consider defining an enum where each variant holds one of these types,
|
|
|
|
|
implementing `bar` for this new enum and using it instead
|
2023-05-11 02:10:56 +00:00
|
|
|
= note: required for the cast from `Box<{integer}>` to `Box<dyn bar>`
|
2018-08-08 14:28:26 +02:00
|
|
|
|
2022-04-06 21:27:46 -07:00
|
|
|
error: aborting due to 5 previous errors
|
2018-08-08 14:28:26 +02:00
|
|
|
|
2022-04-06 21:27:46 -07:00
|
|
|
Some errors have detailed explanations: E0038, E0107.
|
2018-08-08 14:28:26 +02:00
|
|
|
For more information about an error, try `rustc --explain E0038`.
|