mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-31 13:40:15 +03:00
allow using tuple variant names as function handles in presence of NonZero optimizations
This commit is contained in:
@@ -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)));
|
||||
}
|
||||
Reference in New Issue
Block a user