Fix explicit deref problems in closure capture

This commit is contained in:
hkalbasi 2023-04-14 15:32:40 +03:30
parent 1ee88db412
commit 7cb4318331
4 changed files with 90 additions and 4 deletions

View file

@ -40,6 +40,15 @@ fn ref_simple() {
y
}
}
size_and_align_expr! {
minicore: copy, deref_mut;
stmts: [
let y: &mut i32 = &mut 5;
]
|x: i32| {
*y += x;
}
}
size_and_align_expr! {
minicore: copy;
stmts: [
@ -50,6 +59,16 @@ fn ref_simple() {
x
}
}
size_and_align_expr! {
minicore: copy, deref_mut;
stmts: [
struct X(i32, i64);
let x: &mut X = &mut X(2, 6);
]
|| {
(*x).0 as i64 + x.1
}
}
}
#[test]