Skip to content

Instantly share code, notes, and snippets.

@zokier
Created October 13, 2013 21:15
Show Gist options
  • Save zokier/6967504 to your computer and use it in GitHub Desktop.
Save zokier/6967504 to your computer and use it in GitHub Desktop.
trait_nameresolution.rs:16:21: 16:29 error: unresolved name `Bar::foo`.
trait_nameresolution.rs:16 println!("{:?}", Bar::foo()); // does not work
^~~~~~~~
note: in expansion of format_args!
<std-macros>:222:8: 222:50 note: expansion site
<std-macros>:221:4: 223:6 note: in expansion of format!
<std-macros>:239:45: 239:63 note: expansion site
<std-macros>:238:4: 240:5 note: in expansion of println!
trait_nameresolution.rs:16:4: 16:33 note: expansion site
error: aborting due to previous error
task '<unnamed>' failed at 'explicit failure', /build/rust-git/src/rust/src/libsyntax/diagnostic.rs:98
task '<unnamed>' failed at 'explicit failure', /build/rust-git/src/rust/src/librustc/rustc.rs:391
trait Foo {
fn foo() -> uint;
}
struct Bar;
impl Foo for Bar {
fn foo() -> uint { 42 }
}
impl Bar {
fn bar() -> uint { 37 }
}
fn main() {
println!("{:?}", Bar::foo()); // does not work
println!("{:?}", Bar::bar()); // works
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment