forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
mod private { | ||
pub trait Trait { | ||
fn trait_method(&self) { | ||
} | ||
} | ||
pub trait TraitB { | ||
fn trait_method_b(&self) { | ||
} | ||
} | ||
} | ||
|
||
pub struct FooStruct; | ||
pub use crate::private::Trait; | ||
impl crate::private::Trait for FooStruct {} | ||
|
||
pub use crate::private::TraitB as TraitBRename; | ||
impl crate::private::TraitB for FooStruct {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// edition:2018 | ||
// aux-crate:reexported_trait=reexported-trait.rs | ||
|
||
fn main() { | ||
reexported_trait::FooStruct.trait_method(); | ||
//~^ ERROR | ||
reexported_trait::FooStruct.trait_method_b(); | ||
//~^ ERROR | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
error[E0599]: no method named `trait_method` found for struct `reexported_trait::FooStruct` in the current scope | ||
--> $DIR/issue-56175.rs:5:33 | ||
| | ||
LL | reexported_trait::FooStruct.trait_method(); | ||
| ^^^^^^^^^^^^ method not found in `reexported_trait::FooStruct` | ||
| | ||
= help: items from traits can only be used if the trait is in scope | ||
help: the following trait is implemented but not in scope; perhaps add a `use` for it: | ||
| | ||
LL | use reexported_trait::private::Trait; | ||
| | ||
|
||
error[E0599]: no method named `trait_method_b` found for struct `reexported_trait::FooStruct` in the current scope | ||
--> $DIR/issue-56175.rs:7:33 | ||
| | ||
LL | reexported_trait::FooStruct.trait_method_b(); | ||
| ^^^^^^^^^^^^^^ method not found in `reexported_trait::FooStruct` | ||
| | ||
= help: items from traits can only be used if the trait is in scope | ||
help: the following trait is implemented but not in scope; perhaps add a `use` for it: | ||
| | ||
LL | use reexported_trait::private::TraitB; | ||
| | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0599`. |