Created
December 9, 2016 15:01
-
-
Save bluss/d1814bcae5938d796e55cd671c38dfb8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#![crate_type="lib"] | |
#[no_mangle] | |
pub fn id_option(a: Option<u32>) -> Option<u32> { | |
match a { | |
Some(x) => Some(x), | |
None => None, | |
} | |
} | |
#[no_mangle] | |
pub fn id_result(a: Result<u32, i32>) -> Result<u32, i32> { | |
match a { | |
Ok(x) => Ok(x), | |
Err(y) => Err(y), | |
} | |
} |
This file contains hidden or 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
// MIR for `id_result` | |
// node_id = 22 | |
// pass_name = Deaggregator | |
// disambiguator = after | |
fn id_result(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i32> { | |
let mut _0: std::result::Result<u32, i32>; // return pointer | |
scope 1 { | |
let _2: std::result::Result<u32, i32>; // "a" in scope 1 at id.rs:12:18: 12:19 | |
scope 2 { | |
let _3: u32; // "x" in scope 2 at id.rs:14:12: 14:13 | |
} | |
scope 3 { | |
let _4: i32; // "y" in scope 3 at id.rs:15:13: 15:14 | |
} | |
} | |
let mut _5: u32; | |
let mut _6: i32; | |
bb0: { | |
StorageLive(_2); // scope 0 at id.rs:12:18: 12:19 | |
_2 = _1; // scope 0 at id.rs:12:18: 12:19 | |
switch(_2) -> [Ok: bb1, Err: bb2]; // scope 1 at id.rs:14:9: 14:14 | |
} | |
bb1: { | |
StorageLive(_3); // scope 1 at id.rs:14:12: 14:13 | |
_3 = ((_2 as Ok).0: u32); // scope 1 at id.rs:14:12: 14:13 | |
StorageLive(_5); // scope 2 at id.rs:14:21: 14:22 | |
_5 = _3; // scope 2 at id.rs:14:21: 14:22 | |
((_0 as Ok).0: u32) = _5; // scope 2 at id.rs:14:18: 14:23 | |
discriminant(_0) = 0; // scope 2 at id.rs:14:18: 14:23 | |
StorageDead(_5); // scope 2 at id.rs:14:23: 14:23 | |
goto -> bb3; // scope 1 at id.rs:13:5: 16:6 | |
} | |
bb2: { | |
StorageLive(_4); // scope 1 at id.rs:15:13: 15:14 | |
_4 = ((_2 as Err).0: i32); // scope 1 at id.rs:15:13: 15:14 | |
StorageLive(_6); // scope 3 at id.rs:15:23: 15:24 | |
_6 = _4; // scope 3 at id.rs:15:23: 15:24 | |
_0 = std::result::Result<u32, i32>::Err(_6,); // scope 3 at id.rs:15:19: 15:25 | |
StorageDead(_6); // scope 3 at id.rs:15:25: 15:25 | |
goto -> bb3; // scope 1 at id.rs:13:5: 16:6 | |
} | |
bb3: { | |
StorageDead(_4); // scope 1 at id.rs:16:6: 16:6 | |
StorageDead(_3); // scope 1 at id.rs:16:6: 16:6 | |
StorageDead(_2); // scope 0 at id.rs:17:2: 17:2 | |
return; // scope 1 at id.rs:17:2: 17:2 | |
} | |
} |
This file contains hidden or 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
// MIR for `id_result` | |
// node_id = 22 | |
// pass_name = Deaggregator | |
// disambiguator = before | |
fn id_result(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i32> { | |
let mut _0: std::result::Result<u32, i32>; // return pointer | |
scope 1 { | |
let _2: std::result::Result<u32, i32>; // "a" in scope 1 at id.rs:12:18: 12:19 | |
scope 2 { | |
let _3: u32; // "x" in scope 2 at id.rs:14:12: 14:13 | |
} | |
scope 3 { | |
let _4: i32; // "y" in scope 3 at id.rs:15:13: 15:14 | |
} | |
} | |
let mut _5: u32; | |
let mut _6: i32; | |
bb0: { | |
StorageLive(_2); // scope 0 at id.rs:12:18: 12:19 | |
_2 = _1; // scope 0 at id.rs:12:18: 12:19 | |
switch(_2) -> [Ok: bb1, Err: bb2]; // scope 1 at id.rs:14:9: 14:14 | |
} | |
bb1: { | |
StorageLive(_3); // scope 1 at id.rs:14:12: 14:13 | |
_3 = ((_2 as Ok).0: u32); // scope 1 at id.rs:14:12: 14:13 | |
StorageLive(_5); // scope 2 at id.rs:14:21: 14:22 | |
_5 = _3; // scope 2 at id.rs:14:21: 14:22 | |
_0 = std::result::Result<u32, i32>::Ok(_5,); // scope 2 at id.rs:14:18: 14:23 | |
StorageDead(_5); // scope 2 at id.rs:14:23: 14:23 | |
goto -> bb3; // scope 1 at id.rs:13:5: 16:6 | |
} | |
bb2: { | |
StorageLive(_4); // scope 1 at id.rs:15:13: 15:14 | |
_4 = ((_2 as Err).0: i32); // scope 1 at id.rs:15:13: 15:14 | |
StorageLive(_6); // scope 3 at id.rs:15:23: 15:24 | |
_6 = _4; // scope 3 at id.rs:15:23: 15:24 | |
_0 = std::result::Result<u32, i32>::Err(_6,); // scope 3 at id.rs:15:19: 15:25 | |
StorageDead(_6); // scope 3 at id.rs:15:25: 15:25 | |
goto -> bb3; // scope 1 at id.rs:13:5: 16:6 | |
} | |
bb3: { | |
StorageDead(_4); // scope 1 at id.rs:16:6: 16:6 | |
StorageDead(_3); // scope 1 at id.rs:16:6: 16:6 | |
StorageDead(_2); // scope 0 at id.rs:17:2: 17:2 | |
return; // scope 1 at id.rs:17:2: 17:2 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment