Skip to content

Instantly share code, notes, and snippets.

@ezyang
Created December 18, 2013 04:13
Show Gist options
  • Select an option

  • Save ezyang/8017174 to your computer and use it in GitHub Desktop.

Select an option

Save ezyang/8017174 to your computer and use it in GitHub Desktop.
enum Bar {
Z(int),
S(~Bar)
}
fn foo<'a>(x: &'a mut Bar) -> &'a int {
match x {
&Z(_) => {
fail!()
},
&S(~ref mut z) => {
let r = foo(z);
let x = &mut *z;
r
},
}
}
fn main() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment