rust/tests/ui/traits/test-2.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

85 lines
3.8 KiB
Plaintext
Raw Normal View History

error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
2021-02-08 22:15:45 +00:00
--> $DIR/test-2.rs:9:8
2018-08-08 12:28:26 +00:00
|
2019-03-09 12:03:44 +00:00
LL | 10.dup::<i32>();
| ^^^------- help: remove these generics
| |
2021-02-18 20:01:44 +00:00
| expected 0 generic arguments
|
note: method defined here, with 0 generic parameters
2021-02-08 22:15:45 +00:00
--> $DIR/test-2.rs:4:16
|
LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
| ^^^
2018-08-08 12:28:26 +00:00
error[E0107]: method takes 1 generic argument but 2 generic arguments were supplied
2021-02-08 22:15:45 +00:00
--> $DIR/test-2.rs:11:8
2018-08-08 12:28:26 +00:00
|
2019-03-09 12:03:44 +00:00
LL | 10.blah::<i32, i32>();
2021-02-18 20:01:44 +00:00
| ^^^^ --- help: remove this generic argument
| |
2021-02-18 20:01:44 +00:00
| expected 1 generic argument
|
note: method defined here, with 1 generic parameter: `X`
2021-02-08 22:15:45 +00:00
--> $DIR/test-2.rs:4:39
|
LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
| ^^^^ -
2018-08-08 12:28:26 +00:00
error[E0038]: the trait `bar` cannot be made into an object
--> $DIR/test-2.rs:13:22
2018-08-08 12:28:26 +00:00
|
LL | (Box::new(10) as Box<dyn bar>).dup();
| ^^^^^^^^^^^^ `bar` cannot be made into an object
|
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...
= help: consider moving `dup` to another trait
= help: consider moving `blah` to another trait
error[E0038]: the trait `bar` cannot be made into an object
--> $DIR/test-2.rs:13:5
|
LL | (Box::new(10) as Box<dyn bar>).dup();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `bar` cannot be made into an object
|
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>
2021-02-08 22:15:45 +00:00
--> $DIR/test-2.rs:4:30
2018-08-08 12:28:26 +00: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
| this trait cannot be made into an object...
= help: consider moving `dup` to another trait
= help: consider moving `blah` to another trait
error[E0038]: the trait `bar` cannot be made into an object
2021-02-08 22:15:45 +00:00
--> $DIR/test-2.rs:13:6
|
LL | (Box::new(10) as Box<dyn bar>).dup();
| ^^^^^^^^^^^^ `bar` cannot be made into an object
2018-08-08 12:28:26 +00:00
|
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>
2021-02-08 22:15:45 +00: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
| this trait cannot be made into an object...
= help: consider moving `dup` to another trait
= help: consider moving `blah` to another trait
2023-05-11 02:10:56 +00:00
= note: required for the cast from `Box<{integer}>` to `Box<dyn bar>`
2018-08-08 12:28:26 +00:00
error: aborting due to 5 previous errors
2018-08-08 12:28:26 +00:00
Some errors have detailed explanations: E0038, E0107.
2018-08-08 12:28:26 +00:00
For more information about an error, try `rustc --explain E0038`.