allow using tuple variant names as function handles in presence of NonZero optimizations
This commit is contained in:
parent
04eadedb28
commit
e22cceaceb
3 changed files with 21 additions and 1 deletions
|
|
@ -258,7 +258,12 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
|||
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)));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue