Skip to content

Re-exporting through super doesn't work #7809

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

Closed
catamorphism opened this issue Jul 16, 2013 · 3 comments
Closed

Re-exporting through super doesn't work #7809

catamorphism opened this issue Jul 16, 2013 · 3 comments
Labels
A-resolve Area: Name/path resolution done by `rustc_resolve` specifically

Comments

@catamorphism
Copy link
Contributor

Test case:

pub mod bar {
    fn f() {}
}

mod foo {
    use super::bar;

    pub mod bar;
}

fn main() {}

Error:

rustc ~/Scratch/super-mod.rs
/Users/tjc/Scratch/super-mod.rs:8:12: 8:15 error: error opening /Users/tjc/Scratch/foo/bar.rs
/Users/tjc/Scratch/super-mod.rs:8     pub mod bar;
                                              ^~~
@catamorphism
Copy link
Contributor Author

Not sure if this should work.

@huonw
Copy link
Member

huonw commented Sep 16, 2013

Triage: I'm not quite sure what the example is meant to be demonstrating, but a re-export of a module defined elsewhere would be via pub use super::bar;, using mod will always add a file to the AST (mod foo currently searches for foo.rs and foo/mod.rs).

The following works:

pub mod bar {
    pub fn f() {}
}

mod foo {
    pub use super::bar;
}

fn main() {
    foo::bar::f();
    bar::f();
}

Closing, feel free to re-open if I'm misunderstanding some subtlety.

@huonw huonw closed this as completed Sep 16, 2013
@pnkfelix
Copy link
Member

We should address the FIXME's in the code that refer to this issue. Such as in libstd/std.rs

flip1995 pushed a commit to flip1995/rust that referenced this issue Mar 14, 2022
new lint: `missing-spin-loop`

This fixes rust-lang#7809. I went with the shorter name because the function is called `std::hint::spin_loop`. It doesn't yet detect `while let` loops. I left that for a follow-up PR.

---

changelog: new lint: [`missing_spin_loop`]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Name/path resolution done by `rustc_resolve` specifically
Projects
None yet
Development

No branches or pull requests

3 participants