This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +53
-0
lines changed Expand file tree Collapse file tree 3 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ mod private {
2+ pub trait Trait {
3+ fn trait_method ( & self ) {
4+ }
5+ }
6+ pub trait TraitB {
7+ fn trait_method_b ( & self ) {
8+ }
9+ }
10+ }
11+
12+ pub struct FooStruct ;
13+ pub use crate :: private:: Trait ;
14+ impl crate :: private:: Trait for FooStruct { }
15+
16+ pub use crate :: private:: TraitB as TraitBRename ;
17+ impl crate :: private:: TraitB for FooStruct { }
Original file line number Diff line number Diff line change 1+ // edition:2018
2+ // aux-crate:reexported_trait=reexported-trait.rs
3+
4+ fn main ( ) {
5+ reexported_trait:: FooStruct . trait_method ( ) ;
6+ //~^ ERROR
7+ reexported_trait:: FooStruct . trait_method_b ( ) ;
8+ //~^ ERROR
9+ }
Original file line number Diff line number Diff line change 1+ error[E0599]: no method named `trait_method` found for struct `reexported_trait::FooStruct` in the current scope
2+ --> $DIR/issue-56175.rs:5:33
3+ |
4+ LL | reexported_trait::FooStruct.trait_method();
5+ | ^^^^^^^^^^^^ method not found in `reexported_trait::FooStruct`
6+ |
7+ = help: items from traits can only be used if the trait is in scope
8+ help: the following trait is implemented but not in scope; perhaps add a `use` for it:
9+ |
10+ LL | use reexported_trait::private::Trait;
11+ |
12+
13+ error[E0599]: no method named `trait_method_b` found for struct `reexported_trait::FooStruct` in the current scope
14+ --> $DIR/issue-56175.rs:7:33
15+ |
16+ LL | reexported_trait::FooStruct.trait_method_b();
17+ | ^^^^^^^^^^^^^^ method not found in `reexported_trait::FooStruct`
18+ |
19+ = help: items from traits can only be used if the trait is in scope
20+ help: the following trait is implemented but not in scope; perhaps add a `use` for it:
21+ |
22+ LL | use reexported_trait::private::TraitB;
23+ |
24+
25+ error: aborting due to 2 previous errors
26+
27+ For more information about this error, try `rustc --explain E0599`.
You can’t perform that action at this time.
0 commit comments