Skip to content

Instantly share code, notes, and snippets.

@alexcrichton
Last active December 12, 2015 09:28
Show Gist options
  • Save alexcrichton/4751343 to your computer and use it in GitHub Desktop.
Save alexcrichton/4751343 to your computer and use it in GitHub Desktop.
struct Foo { f: int }
impl Foo {
fn bar(&self) {}
}
fn foo(_: &Foo) {
}
fn main() {
let s : &~Foo = &~Foo{ f: 2 };
s.bar(); // ok, cast to '&Foo' happens
foo(s); // error: mismatched types: expected `&Foo` but found `&~Foo`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment