allow using tuple variant names as function handles in presence of NonZero optimizations

This commit is contained in:
Oliver Schneider
2016-12-19 17:49:51 +01:00
parent 04eadedb28
commit e22cceaceb
3 changed files with 21 additions and 1 deletions
+6 -1
View File
@@ -258,7 +258,12 @@ fn eval_fn_call(
discr_size,
)?;
},
// FIXME: raw nullable pointer constructors
Layout::StructWrappedNullablePointer { .. } |
Layout::RawNullablePointer { .. } => {
assert_eq!(args.len(), 1);
let (val, ty) = args.pop().unwrap();
self.write_value(val, lvalue, ty)?;
},
_ => bug!("bad layout for tuple struct constructor: {:?}", dest_layout),
}
self.goto_block(target);
@@ -0,0 +1,4 @@
fn main() {
let x = 5;
assert_eq!(Some(&x).map(Some), Some(Some(&x)));
}
@@ -0,0 +1,11 @@
#[derive(Copy, Clone, PartialEq, Debug)]
struct A<'a> {
x: i32,
y: &'a i32,
}
fn main() {
let x = 5;
let a = A { x: 99, y: &x };
assert_eq!(Some(a).map(Some), Some(Some(a)));
}