Skip to content

extern crate in local scope #42776

@aleksander

Description

@aleksander

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions