Closed
Description
Code
trait Has {
fn has() {}
}
trait HasNot {}
fn main() {
HasNot::has();
}
Current output
error[E0782]: trait objects must include the `dyn` keyword
--> src/main.rs:8:5
|
8 | HasNot::has();
| ^^^^^^
|
help: add `dyn` keyword before this trait
|
8 | <dyn HasNot>::has();
| ++++ +
error[E0599]: no function or associated item named `has` found for trait object `dyn HasNot` in the current scope
--> src/main.rs:8:13
|
8 | HasNot::has();
| ^^^ function or associated item not found in `dyn HasNot`
|
= help: items from traits can only be used if the trait is implemented and in scope
note: `Has` defines an item `has`, perhaps you need to implement it
--> src/main.rs:1:1
|
1 | trait Has {
| ^^^^^^^^^
Some errors have detailed explanations: E0599, E0782.
For more information about an error, try `rustc --explain E0599`.
error: could not compile `playground` due to 2 previous errors
code snippet by @WaffleLapkin. (this is from December 2022)