Skip to content

Commit b7f109c

Browse files
committed
add test for layout optimizations
1 parent 87644d1 commit b7f109c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/run-pass/stacked-borrows/refcell.rs

+9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ fn main() {
44
basic();
55
ref_protector();
66
ref_mut_protector();
7+
rust_issue_68303();
78
}
89

910
fn basic() {
@@ -66,3 +67,11 @@ fn ref_mut_protector() {
6667
let rc = RefCell::new(0);
6768
break_it(&rc, rc.borrow_mut())
6869
}
70+
71+
/// Make sure we do not have bad enum layout optimizations.
72+
fn rust_issue_68303() {
73+
let optional=Some(RefCell::new(false));
74+
let mut handle=optional.as_ref().unwrap().borrow_mut();
75+
optional.is_some();
76+
*handle=true;
77+
}

0 commit comments

Comments
 (0)