-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
super trait and trait object error with "source trait is inaccessible", but source trait is in scope (via a reexport) #16264
Comments
This now gives "expected function, found usize" :/ |
I've updated the top comment code to rust nightly, and at least now we are getting a more consistent answer from the compiler; all the uses of the What I'm not sure about is if the Maybe @alexcrichton can confirm if that's the intended behaviour? |
This definitely seems like suspicious behavior to me, I would expect no errors from the code above. I suspect that the privacy checks for traits is a little wonky and not seeing the reexport. |
Still an issue. |
I have a similar example: use core::Check;
fn main() {
let x = Value;
x.check();
}
struct Value;
impl Check for Value {
fn check(&self) -> bool {
true
}
}
pub mod core {
pub use self::private::Check;
mod private {
pub trait Check {
fn check(&self) -> bool;
}
}
} Only acceptable fix for me is to move the |
Still an issue with stable |
Ran into this issue today and noticed something odd, this only seems to happen when trying to use the "private" trait internally. Created a small test repo to demonstrate: Eljay/trait_privacy_test@6a9fc6a The However, the inline test in inner\src\lib.rs fails with the error:
Tested on stable 1.0.0 and latest nightly. |
Same issue here. Any solutions? Is this intended behavior? I'd prefer not making my submodules containing traits public, as that is an implementation detail. I'd rather re-export the trait from the |
I also would be grateful for an update on the issue. Thanks! Regards, |
Still a problem in |
One workaround is calling using explicit Trait::method syntax. |
…gate-trait, r=Veykril internal: clean and enhance readability for `generate_delegate_trait` Continue from rust-lang#16112 This PR primarily involves some cleanup and simple refactoring work, including: - Adding numerous comments to layer the code and explain the behavior of each step. - Renaming some variables to make them more sensible. - Simplify certain operations using a more elegant approach. The goal is to make this intricate implementation clearer and facilitate future maintenance. In addition to this, the PR also removes redundant `path_transform` operations for `type_gen_args`. Taking the example of `impl Trait<T1> for S<S1>`, where `S1` is considered. The struct `S` must be in the file where the user triggers code actions, so there's no need for the `path_transform`. Furthermore, before performing the transform, we've already renamed `S1`, ensuring it won't clash with existing generics parameters. Therefore, there's no need to transform it.
STR
Version
Original issue
STR
Output:
I'm no longer sure if this is a bug or is intended? The
impl
block works, but the super trait and the trait object don't. Do the latter two have different scoping/privacy rules?Version:
The text was updated successfully, but these errors were encountered: