mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Fix explicit deref problems in closure capture
This commit is contained in:
parent
1ee88db412
commit
7cb4318331
4 changed files with 90 additions and 4 deletions
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue