1
Fork 0

Implement use associated items of traits

This commit is contained in:
Frank King 2024-12-25 14:54:49 +08:00
parent 4e5fec2f1e
commit 5079acc060
21 changed files with 374 additions and 42 deletions

View file

@ -1,10 +1,10 @@
mod foo {
pub trait MyTrait {
fn do_something();
type SomeType;
}
}
use foo::MyTrait::do_something;
use foo::MyTrait::SomeType;
//~^ ERROR E0253
fn main() {}

View file

@ -1,8 +1,8 @@
error[E0253]: `do_something` is not directly importable
error[E0253]: `SomeType` is not directly importable
--> $DIR/E0253.rs:7:5
|
LL | use foo::MyTrait::do_something;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be imported directly
LL | use foo::MyTrait::SomeType;
| ^^^^^^^^^^^^^^^^^^^^^^ cannot be imported directly
error: aborting due to 1 previous error