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

Inconsistent behavior when importing type implementation from local crate vs. cross-crate #15664

Closed
edwardw opened this issue Jul 14, 2014 · 2 comments

Comments

@edwardw
Copy link
Contributor

edwardw commented Jul 14, 2014

Consider the following:

mod a {
    pub struct Foo;
    impl Foo { pub fn bar() {} }
}

fn main() {
    use std::io::File::open;
    use a::Foo::bar;
}

Only the import from non-std module is reported as "error: Cannot import from a trait or type implementation". It is inconsistent and both should be recognized as error.

Some of the rustc internal code actually presume that is the case. Failing to do that leads to bug such as #15528.

@ghost
Copy link

ghost commented Jul 14, 2014

This is probably a general cross-crate vs local crate problem, not specific to std.

@edwardw edwardw changed the title Inconsistent behavior when importing type implementation from std and non-std modules Inconsistent behavior when importing type implementation from local crate vs. cross-crate Jul 14, 2014
@edwardw
Copy link
Contributor Author

edwardw commented Jul 14, 2014

Great point, the title has been changed as such.

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 a pull request may close this issue.

2 participants