Created
January 26, 2017 22:28
-
-
Save Connicpu/9b4e72dfa512628816e31d025779f162 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn foo(_1: std::option::Option<&i32>) -> () { | |
let mut _0: (); // return pointer | |
scope 1 { | |
let _2: std::option::Option<&i32>; // "v" in scope 1 at <anon>:5:8: 5:9 | |
scope 2 { | |
let _3: &i32; // "x" in scope 2 at <anon>:8:14: 8:15 | |
} | |
} | |
let mut _4: i32; | |
bb0: { | |
StorageLive(_2); // scope 0 at <anon>:5:8: 5:9 | |
_2 = _1; // scope 0 at <anon>:5:8: 5:9 | |
switch(_2) -> [None: bb1, Some: bb2]; // scope 1 at <anon>:7:9: 7:13 | |
} | |
bb1: { | |
_0 = (); // scope 1 at <anon>:7:17: 7:19 | |
goto -> bb3; // scope 1 at <anon>:6:5: 9:6 | |
} | |
bb2: { | |
StorageLive(_3); // scope 1 at <anon>:8:14: 8:15 | |
_3 = ((_2 as Some).0: &i32); // scope 1 at <anon>:8:14: 8:15 | |
StorageLive(_4); // scope 2 at <anon>:8:24: 8:26 | |
_4 = (*_3); // scope 2 at <anon>:8:24: 8:26 | |
_0 = bar(_4) -> bb4; // scope 2 at <anon>:8:20: 8:27 | |
} | |
bb3: { | |
StorageDead(_3); // scope 1 at <anon>:9:6: 9:6 | |
StorageDead(_2); // scope 0 at <anon>:10:2: 10:2 | |
return; // scope 1 at <anon>:10:2: 10:2 | |
} | |
bb4: { | |
StorageDead(_4); // scope 2 at <anon>:8:27: 8:27 | |
goto -> bb3; // scope 1 at <anon>:6:5: 9:6 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn bar(i: i32) { | |
println!("{}", i); | |
} | |
fn foo(v: Option<&i32>) { | |
match v { | |
None => {}, | |
Some(x) => bar(*x), | |
} | |
} | |
fn main() { | |
foo(Some(&5)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment