Thanks Patrick, that makes sense. I need to think about how to code this into Racer. Can I assume that anything preceding a :: in a path is from the type namespace?
(Is there somewhere other than the rustc source where I should be reading about this?) Thanks, Phil On Sat, Jul 5, 2014 at 9:44 PM, Patrick Walton <pcwal...@mozilla.com> wrote: > 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 >
_______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev