Skip to content

Instantly share code, notes, and snippets.

@arielb1
Created May 10, 2016 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arielb1/0cfee392fba82cb86ae0c0c821f46b1e to your computer and use it in GitHub Desktop.
Save arielb1/0cfee392fba82cb86ae0c0c821f46b1e to your computer and use it in GitHub Desktop.
struct Foo {
a: Box<u32>,
b: Box<u32>,
c: Box<u32>,
d: Box<u32>
}
fn star() -> u32 { 0 }
fn main() {
let f = Foo {
a: Box::new(0),
b: Box::new(0),
c: Box::new(0),
d: Box::new(0),
};
match star() {
0 => drop(f),
_ => {}
};
star();
let mut g = Foo {
a: Box::new(0),
b: Box::new(0),
c: Box::new(0),
d: Box::new(0),
};
match star() {
0 => drop(g),
1 => drop(g.b),
2 => drop(g.c),
_ => {}
};
g.b = Box::new(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment