rustc: collect upvars from HIR, instead of during name resolution.
This commit is contained in:
parent
648b4d884d
commit
f7a4c9d7b5
12 changed files with 143 additions and 97 deletions
|
|
@ -4,7 +4,7 @@ error[E0502]: cannot borrow `*ptr` as immutable because it is also borrowed as m
|
|||
LL | let mut test = |foo: &Foo| {
|
||||
| ----------- mutable borrow occurs here
|
||||
LL | ptr = box Foo { x: ptr.x + 1 };
|
||||
| --- first borrow occurs due to use of `ptr` in closure
|
||||
| --- first borrow occurs due to use of `ptr` in closure
|
||||
LL | };
|
||||
LL | test(&*ptr);
|
||||
| ---- ^^^^^ immutable borrow occurs here
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ LL | let mut test = |foo: &Foo| {
|
|||
| ----------- mutable borrow occurs here
|
||||
LL | println!("access {}", foo.x);
|
||||
LL | ptr = box Foo { x: ptr.x + 1 };
|
||||
| --- first borrow occurs due to use of `ptr` in closure
|
||||
| --- first borrow occurs due to use of `ptr` in closure
|
||||
...
|
||||
LL | test(&*ptr);
|
||||
| ---- ^^^^^ immutable borrow occurs here
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ LL | let mut closure1 = || p = &y;
|
|||
= note: defining type: DefId(0:14 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]::{{closure}}[0]) with closure substs [
|
||||
i16,
|
||||
extern "rust-call" fn(()),
|
||||
&'_#1r mut &'_#2r i32,
|
||||
&'_#3r i32,
|
||||
&'_#1r i32,
|
||||
&'_#2r mut &'_#3r i32,
|
||||
]
|
||||
= note: number of external vids: 4
|
||||
= note: where '_#3r: '_#2r
|
||||
= note: where '_#1r: '_#3r
|
||||
|
||||
note: External requirements
|
||||
--> $DIR/escape-upvar-nested.rs:20:27
|
||||
|
|
@ -26,11 +26,11 @@ LL | | };
|
|||
= note: defining type: DefId(0:13 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]) with closure substs [
|
||||
i16,
|
||||
extern "rust-call" fn(()),
|
||||
&'_#1r mut &'_#2r i32,
|
||||
&'_#3r i32,
|
||||
&'_#1r i32,
|
||||
&'_#2r mut &'_#3r i32,
|
||||
]
|
||||
= note: number of external vids: 4
|
||||
= note: where '_#3r: '_#2r
|
||||
= note: where '_#1r: '_#3r
|
||||
|
||||
note: No external requirements
|
||||
--> $DIR/escape-upvar-nested.rs:13:1
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ LL | let mut closure = || p = &y;
|
|||
= note: defining type: DefId(0:13 ~ escape_upvar_ref[317d]::test[0]::{{closure}}[0]) with closure substs [
|
||||
i16,
|
||||
extern "rust-call" fn(()),
|
||||
&'_#1r mut &'_#2r i32,
|
||||
&'_#3r i32,
|
||||
&'_#1r i32,
|
||||
&'_#2r mut &'_#3r i32,
|
||||
]
|
||||
= note: number of external vids: 4
|
||||
= note: where '_#3r: '_#2r
|
||||
= note: where '_#1r: '_#3r
|
||||
|
||||
note: No external requirements
|
||||
--> $DIR/escape-upvar-ref.rs:17:1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue