Closed
Description
Compile this:
pub mod foo {
pub mod bar {
pub mod baz {
struct Qux;
impl Qux {
pub fn new() {}
}
}
}
}
fn main() {
type Ham = foo::bar::baz::Qux;
let Foo = foo::bar::baz::Qux::new(); // works fine
let Bar = Ham::new(); // oops!
}
$ rustc ty.rs
!!! (resolving module in lexical scope) module wasn't actually a module!
ty.rs:16:14: 16:22 error: unresolved name
ty.rs:16 let Bar = Ham::new();
^~~~~~~~
ty.rs:16:14: 16:22 error: use of undeclared module `Ham`
ty.rs:16 let Bar = Ham::new();
^~~~~~~~
!!! (resolving module in lexical scope) module wasn't actually a module!
ty.rs:16:14: 16:22 error: unresolved name `Ham::new`.
ty.rs:16 let Bar = Ham::new();
^~~~~~~~
error: aborting due to 3 previous errors
task 'rustc' failed at 'explicit failure', /root/catacombs/scrap/rust/src/libsyntax/diagnostic.rs:102
task '<main>' failed at 'explicit failure', /root/catacombs/scrap/rust/src/librustc/lib.rs:392
I can't imagine that this is intentional, as it greatly limits the utility of type aliases.