Implement use
associated items of traits
This commit is contained in:
parent
4e5fec2f1e
commit
5079acc060
21 changed files with 374 additions and 42 deletions
|
@ -1,19 +1,19 @@
|
|||
Attempt was made to import an unimportable value. This can happen when trying
|
||||
to import a method from a trait.
|
||||
Attempt was made to import an unimportable type. This can happen when trying
|
||||
to import a type from a trait.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0253
|
||||
mod foo {
|
||||
pub trait MyTrait {
|
||||
fn do_something();
|
||||
type SomeType;
|
||||
}
|
||||
}
|
||||
|
||||
use foo::MyTrait::do_something;
|
||||
// error: `do_something` is not directly importable
|
||||
use foo::MyTrait::SomeType;
|
||||
// error: `SomeType` is not directly importable
|
||||
|
||||
fn main() {}
|
||||
```
|
||||
|
||||
It's invalid to directly import methods belonging to a trait or concrete type.
|
||||
It's invalid to directly import types belonging to a trait.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue