-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #53088 - matthewjasper:closure-region-spans, r=nikomats…
…akis [NLL] Use span of the closure args in free region errors Also adds a note when one of the free regions is BrEnv. In a future PR I'll change these messages to say "return requires", which should improve them a bit more. r? @nikomatsakis
- Loading branch information
Showing
6 changed files
with
112 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
error: unsatisfied lifetime constraints | ||
--> $DIR/issue-40510-1.rs:18:9 | ||
| | ||
LL | || { | ||
| _____- | ||
| |_____| | ||
| || | ||
LL | || &mut x | ||
| || ^^^^^^ return requires that `'1` must outlive `'2` | ||
LL | || }; | ||
| || - | ||
| ||_____| | ||
| |______lifetime `'1` represents the closure body | ||
| lifetime `'2` appears in return type | ||
LL | || { | ||
| -- | ||
| || | ||
| |return type of closure is &'2 mut std::boxed::Box<()> | ||
| lifetime `'1` represents this closure's body | ||
LL | &mut x | ||
| ^^^^^^ return requires that `'1` must outlive `'2` | ||
| | ||
= note: closure implements `FnMut`, so references to captured variables can't escape the closure | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
error: unsatisfied lifetime constraints | ||
--> $DIR/issue-40510-3.rs:18:9 | ||
| | ||
LL | || { | ||
| _____- | ||
| |_____| | ||
| || | ||
LL | || || { | ||
| ||_________^ | ||
LL | ||| x.push(()) | ||
LL | ||| } | ||
| |||_________^ requires that `'1` must outlive `'2` | ||
LL | || }; | ||
| || - | ||
| ||_____| | ||
| |______lifetime `'1` represents the closure body | ||
| lifetime `'2` appears in return type | ||
LL | || { | ||
| -- | ||
| || | ||
| |return type of closure is [closure@$DIR/issue-40510-3.rs:18:9: 20:10 x:&'2 mut std::vec::Vec<()>] | ||
| lifetime `'1` represents this closure's body | ||
LL | / || { | ||
LL | | x.push(()) | ||
LL | | } | ||
| |_________^ requires that `'1` must outlive `'2` | ||
| | ||
= note: closure implements `FnMut`, so references to captured variables can't escape the closure | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
error: unsatisfied lifetime constraints | ||
--> $DIR/issue-49824.rs:22:9 | ||
| | ||
LL | || { | ||
| _____- | ||
| |_____| | ||
| || | ||
LL | || || { | ||
| ||_________^ | ||
LL | ||| let _y = &mut x; | ||
LL | ||| } | ||
| |||_________^ requires that `'1` must outlive `'2` | ||
LL | || }; | ||
| || - | ||
| ||_____| | ||
| |______lifetime `'1` represents the closure body | ||
| lifetime `'2` appears in return type | ||
LL | || { | ||
| -- | ||
| || | ||
| |return type of closure is [closure@$DIR/issue-49824.rs:22:9: 24:10 x:&'2 mut i32] | ||
| lifetime `'1` represents this closure's body | ||
LL | / || { | ||
LL | | let _y = &mut x; | ||
LL | | } | ||
| |_________^ requires that `'1` must outlive `'2` | ||
| | ||
= note: closure implements `FnMut`, so references to captured variables can't escape the closure | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters