Skip to content
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

Reexport static trait methods on traits in the same module. #6432

Closed
wants to merge 3 commits into from

Conversation

thomaslee
Copy link
Contributor

My earlier fix for #4202 would not work correctly if the trait being exported was a top-level item relative to the module from which it was being exported. An example that would not work correctly with the original patch:

// foo.rs

pub use Foo = self::Bar;

pub trait Bar {
  pub fn bar() -> Self;
}

impl Bar for int {
  pub fn bar() -> int { 42 }
}

// bar.rs

fn main() {
  foo::Foo::bar()
}

This is now supported.

I believe this change will allow the GenericPath trait to be exported from core::path as Path in such a manner, which should allow #5389 to move forward.

@thomaslee
Copy link
Contributor Author

@catamorphism has offered to review this.

@catamorphism
Copy link
Contributor

@thomaslee Sorry for not getting to this right away. I will approve when you get a chance to add the comment :-)

@thomaslee
Copy link
Contributor Author

No worries Tim -- I'll sort this out later in the week

@thomaslee
Copy link
Contributor Author

@catamorphism all yours! let me know if you need more clarification here.

@catamorphism
Copy link
Contributor

@thomaslee Thanks for the comment, it's good! Unfortunately this needs a rebase :-( Will approve then.

@thomaslee
Copy link
Contributor Author

@catamorphism done!

bors added a commit that referenced this pull request May 20, 2013
My earlier fix for #4202 would not work correctly if the trait being exported was a top-level item relative to the module from which it was being exported. An example that would not work correctly with the original patch:

    // foo.rs

    pub use Foo = self::Bar;

    pub trait Bar {
      pub fn bar() -> Self;
    }

    impl Bar for int {
      pub fn bar() -> int { 42 }
    }

    // bar.rs

    fn main() {
      foo::Foo::bar()
    }

This is now supported.

I believe this change will allow the GenericPath trait to be exported from core::path as Path in such a manner, which should allow #5389 to move forward.
@bors bors closed this May 20, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Dec 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants