diff options
| author | bors <bors@rust-lang.org> | 2018-08-08 12:48:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-08-08 12:48:32 +0000 |
| commit | 63fe441db8a441bc68c754c33a04f57f0f8a8b77 (patch) | |
| tree | 2039c5acbf5b0eca0a47052debfe762e12eb79b6 /src/test | |
| parent | ebe8df41d70d8763e0a15aefe078b035d3519214 (diff) | |
| parent | b13e3f87709031be5c599ff23d73f981d04416fd (diff) | |
| download | rust-63fe441db8a441bc68c754c33a04f57f0f8a8b77.tar.gz rust-63fe441db8a441bc68c754c33a04f57f0f8a8b77.zip | |
Auto merge of #53088 - matthewjasper:closure-region-spans, r=nikomatsakis
[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
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr | 9 | ||||
| -rw-r--r-- | src/test/ui/issue-40510-1.nll.stderr | 20 | ||||
| -rw-r--r-- | src/test/ui/issue-40510-3.nll.stderr | 25 | ||||
| -rw-r--r-- | src/test/ui/issue-49824.nll.stderr | 25 | ||||
| -rw-r--r-- | src/test/ui/nll/issue-48238.stderr | 11 |
5 files changed, 41 insertions, 49 deletions
diff --git a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr index 0ac295c54bc..3f9104373d6 100644 --- a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr +++ b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr @@ -8,11 +8,10 @@ error: unsatisfied lifetime constraints --> $DIR/E0621-does-not-trigger-for-closures.rs:25:26 | LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 - | ----------^^^^^----------------- - | | | | - | | | requires that `'1` must outlive `'2` - | | has type `&'1 i32` - | lifetime `'2` appears in return type + | -- ^^^^^ requires that `'1` must outlive `'2` + | || + | |return type of closure is &'2 i32 + | has type `&'1 i32` error: aborting due to previous error diff --git a/src/test/ui/issue-40510-1.nll.stderr b/src/test/ui/issue-40510-1.nll.stderr index 312ec6e742e..6c77bcb2757 100644 --- a/src/test/ui/issue-40510-1.nll.stderr +++ b/src/test/ui/issue-40510-1.nll.stderr @@ -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 diff --git a/src/test/ui/issue-40510-3.nll.stderr b/src/test/ui/issue-40510-3.nll.stderr index eb44850e639..8aeef86c2e8 100644 --- a/src/test/ui/issue-40510-3.nll.stderr +++ b/src/test/ui/issue-40510-3.nll.stderr @@ -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 diff --git a/src/test/ui/issue-49824.nll.stderr b/src/test/ui/issue-49824.nll.stderr index 59345754e9f..fb4bed76a71 100644 --- a/src/test/ui/issue-49824.nll.stderr +++ b/src/test/ui/issue-49824.nll.stderr @@ -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 diff --git a/src/test/ui/nll/issue-48238.stderr b/src/test/ui/nll/issue-48238.stderr index 7bdac345e90..84d0730025a 100644 --- a/src/test/ui/nll/issue-48238.stderr +++ b/src/test/ui/nll/issue-48238.stderr @@ -2,11 +2,12 @@ error: unsatisfied lifetime constraints --> $DIR/issue-48238.rs:21:13 | LL | move || use_val(&orig); //~ ERROR - | --------^^^^^^^^^^^^^^ - | | | - | | argument requires that `'1` must outlive `'2` - | lifetime `'1` represents the closure body - | lifetime `'2` appears in return type + | ------- ^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` + | | | + | | return type of closure is &'2 u8 + | lifetime `'1` represents this closure's body + | + = note: closure implements `Fn`, so references to captured variables can't escape the closure error: aborting due to previous error |
