On 7/5/14 1:43 PM, Phil Dawes wrote:
Hello!
I was surprised to find the following compile and run without any bother:
#[deriving(Show)]
pub enum MyEnum {
Path
}
fn main() {
let p = Path::new("/filepath/");
let p2 = Path;
println!("{}",p.as_str());
println!("{}",p2);
}
% ./run
Some(/filepath)
Path
What is the name resolution rule that stops MyEnum's Path overriding the
posix Path struct? I'm interested because racer gets this wrong at the
moment.
Rust has two namespaces: a type namespace and a value namespace.
(Modules are in the type namespace.) Structs are in the type namespace
and enum variants are in the value namespace.
Patrick
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev