Skip to content

Make "use" statements shadow "extern mod" and require "extern mod" to come first #4824

@dpc

Description

@dpc

See the following example:

[mutex:rust/rg]% cat main.rs
extern mod sdl;

use core::io;
use sdl::sdl;
use sdl::video;
use sdl::video::{DoubleBuf, HWSurface, Surface};

fn main() {
    io::print("Hi!\n");
    sdl::init(&[sdl::sdl::InitEverything]);
    video::set_video_mode(640,480,32,&[],&[sdl::video::DoubleBuf]);

    while !io::stdin().eof() {
        io::print("Hi!\n");
    }
}
[mutex:rust/rg]% make       
rustc -o rg main.rs
main.rs:10:1: 10:10 error: unresolved name: sdl::init
main.rs:10  sdl::init(&[sdl::sdl::InitEverything]);
            ^~~~~~~~~
error: aborting due to previous error
make: *** [rg] Błąd 101

The video::set_video_mode works just fine, but sdl::init does not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions