mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 14:10:03 +03:00
add test for layout optimizations
This commit is contained in:
@@ -4,6 +4,7 @@ fn main() {
|
||||
basic();
|
||||
ref_protector();
|
||||
ref_mut_protector();
|
||||
rust_issue_68303();
|
||||
}
|
||||
|
||||
fn basic() {
|
||||
@@ -66,3 +67,11 @@ fn break_it(rc: &RefCell<i32>, r: RefMut<'_, i32>) {
|
||||
let rc = RefCell::new(0);
|
||||
break_it(&rc, rc.borrow_mut())
|
||||
}
|
||||
|
||||
/// Make sure we do not have bad enum layout optimizations.
|
||||
fn rust_issue_68303() {
|
||||
let optional=Some(RefCell::new(false));
|
||||
let mut handle=optional.as_ref().unwrap().borrow_mut();
|
||||
assert!(optional.is_some());
|
||||
*handle=true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user