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

extern crate in local scope #42776

Closed
aleksander opened this issue Jun 20, 2017 · 3 comments
Closed

extern crate in local scope #42776

aleksander opened this issue Jun 20, 2017 · 3 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-resolve Area: Name resolution C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@aleksander
Copy link

This code

fn main() {
    extern crate libc;
    println!("Hello, world!");
}

compiled without any errors or warnings, but it's not possible to use any libc's items inside main. Should compiler warn about wrong place for extern crate? Or this is legal to use extern crate in local scope?

@kennytm
Copy link
Member

kennytm commented Jun 20, 2017

#24219rust-lang/rfcs#959.

@Mark-Simulacrum
Copy link
Member

Perhaps we should give a diagnostic message here though.. tagging A-diagnostics.

@Mark-Simulacrum Mark-Simulacrum added A-diagnostics Area: Messages for errors, warnings, and lints A-resolve Area: Name resolution labels Jun 20, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jul 26, 2017
@steveklabnik
Copy link
Member

Triage: now that most code will not use extern crate, and given that it's been over two years with no other people running into this, I'm going to give this a close. If someone wanted to work up a diagnostic, I don't think it would be denied, but I don't think this is ever realistically going to be fixed. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-resolve Area: Name resolution C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

4 participants