about summary refs log tree commit diff
path: root/example/std_example.rs
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2019-06-23 15:14:26 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2019-06-23 15:23:06 +0200
commitd7274ac5fdf84452cdfd09727e106bac2bf50e36 (patch)
tree6851bbf0442d565ad9295ec48f091c9a9bfa9f78 /example/std_example.rs
parent05307af6729a9df0375f063c4b2417366057e058 (diff)
downloadrust-d7274ac5fdf84452cdfd09727e106bac2bf50e36.tar.gz
rust-d7274ac5fdf84452cdfd09727e106bac2bf50e36.zip
Fix load and store for ByValPair values with differently sized components
Diffstat (limited to 'example/std_example.rs')
-rw-r--r--example/std_example.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/example/std_example.rs b/example/std_example.rs
index ce74efee8a8..805a51ec219 100644
--- a/example/std_example.rs
+++ b/example/std_example.rs
@@ -17,6 +17,9 @@ fn main() {
     ONCE.call_once(|| {});
 
     LoopState::Continue(()) == LoopState::Break(());
+
+    // Make sure ByValPair values with differently sized components are correctly passed
+    map(None::<(u8, Box<Instruction>)>);
 }
 
 #[derive(PartialEq)]
@@ -24,3 +27,15 @@ enum LoopState {
     Continue(()),
     Break(())
 }
+
+pub enum Instruction {
+    Increment,
+    Loop,
+}
+
+fn map(a: Option<(u8, Box<Instruction>)>) -> Option<Box<Instruction>> {
+    match a {
+        None => None,
+        Some((_, instr)) => Some(instr),
+    }
+}