Closed
Description
openedon Oct 29, 2012
It seems that a type definition will not introduce an implicit module for static methods defined in the thing being typedef'd. Consider the example below: one would expect Shaper::new()
to resolve correctly.
Testcase:
mod foo {
pub struct FooShaper {
dummy: int
}
pub impl FooShaper {
static pub fn new() -> FooShaper {
FooShaper { dummy: 1337 }
}
}
}
fn main() {
type Shaper/& = foo::FooShaper;
let sh = Shaper::new();
assert 1 + sh.dummy == 1338;
}
Compiler errors:
[burg@host-7-150 Desktop]# rustc test.rs
test.rs:16:13: 16:24 error: unresolved name
test.rs:16 let sh = Shaper::new();
^~~~~~~~~~~
test.rs:16:13: 16:24 error: use of undeclared module `Shaper`
test.rs:16 let sh = Shaper::new();
^~~~~~~~~~~
test.rs:16:13: 16:24 error: unresolved name: Shaper::new
test.rs:16 let sh = Shaper::new();
^~~~~~~~~~~
error: aborting due to 3 previous errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment