Skip to content

[WIP] remove Location::All #50938

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,19 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time
--> $DIR/mut-borrow-in-loop.rs:20:25
|
LL | (self.func)(arg) //~ ERROR cannot borrow
| ------------^^^-
| | |
| | mutable borrow starts here in previous iteration of loop
| borrow later used here
| ^^^ mutable borrow starts here in previous iteration of loop

error[E0499]: cannot borrow `*arg` as mutable more than once at a time
--> $DIR/mut-borrow-in-loop.rs:26:25
|
LL | (self.func)(arg) //~ ERROR cannot borrow
| ------------^^^-
| | |
| | mutable borrow starts here in previous iteration of loop
| borrow later used here
| ^^^ mutable borrow starts here in previous iteration of loop

error[E0499]: cannot borrow `*arg` as mutable more than once at a time
--> $DIR/mut-borrow-in-loop.rs:33:25
|
LL | (self.func)(arg) //~ ERROR cannot borrow
| ------------^^^-
| | |
| | mutable borrow starts here in previous iteration of loop
| borrow later used here
| ^^^ mutable borrow starts here in previous iteration of loop

error: aborting due to 3 previous errors

Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/issue-46471.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ LL | &x
...
LL | }
| - borrowed value only lives until here
|
= note: borrowed value must be valid for the static lifetime...

error: aborting due to 2 previous errors

Expand Down
6 changes: 0 additions & 6 deletions src/test/ui/issue-46472.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ LL | &mut 4
...
LL | }
| - temporary value only lives until here
|
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:1...
--> $DIR/issue-46472.rs:13:1
|
LL | fn bar<'a>() -> &'a mut u32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issue-46983.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#![feature(nll)]

fn foo(x: &u32) -> &'static u32 {
&*x
//~^ ERROR explicit lifetime required in the type of `x` [E0621]
&*x
}

fn main() {}
14 changes: 9 additions & 5 deletions src/test/ui/issue-46983.stderr
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/issue-46983.rs:14:5
--> $DIR/issue-46983.rs:13:1
|
LL | fn foo(x: &u32) -> &'static u32 {
| - consider changing the type of `x` to `&'static u32`
LL | &*x
| ^^^ lifetime `'static` required
LL | fn foo(x: &u32) -> &'static u32 {
| ^ - consider changing the type of `x` to `&'static u32`
| _|
| |
LL | | //~^ ERROR explicit lifetime required in the type of `x` [E0621]
LL | | &*x
LL | | }
| |_^ lifetime `'static` required

error: aborting due to previous error

Expand Down
6 changes: 0 additions & 6 deletions src/test/ui/nll/borrowed-universal-error-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ LL | &v
LL | //~^ ERROR `v` does not live long enough [E0597]
LL | }
| - borrowed value only lives until here
|
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 14:1...
--> $DIR/borrowed-universal-error-2.rs:14:1
|
LL | fn foo<'a>(x: &'a (u32,)) -> &'a u32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
// compile-flags:-Zborrowck=mir -Zverbose

fn foo(x: &u32) -> &'static u32 {
//~^ ERROR explicit lifetime required in the type of `x`
&*x
//~^ WARN not reporting region error due to nll
//~| ERROR explicit lifetime required in the type of `x`
}

fn main() { }
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
warning: not reporting region error due to nll
--> $DIR/region-lbr-anon-does-not-outlive-static.rs:19:5
--> $DIR/region-lbr-anon-does-not-outlive-static.rs:20:5
|
LL | &*x
| ^^^

error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/region-lbr-anon-does-not-outlive-static.rs:19:5
--> $DIR/region-lbr-anon-does-not-outlive-static.rs:18:1
|
LL | fn foo(x: &u32) -> &'static u32 {
| - consider changing the type of `x` to `&ReStatic u32`
LL | &*x
| ^^^ lifetime `ReStatic` required
LL | fn foo(x: &u32) -> &'static u32 {
| ^ - consider changing the type of `x` to `&ReStatic u32`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(this sort of thing is the reason I'm not really thrilled with ui/ tests that use -Z verbose ... though I guess seeing ReStatic in supposed user output is not as egregious as other potential leakage of internal details...)

| _|
| |
LL | | //~^ ERROR explicit lifetime required in the type of `x`
LL | | &*x
LL | | //~^ WARN not reporting region error due to nll
LL | | }
| |_^ lifetime `ReStatic` required

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
// compile-flags:-Zborrowck=mir -Zverbose

fn foo<'a>(x: &'a u32) -> &'static u32 {
//~^ ERROR does not outlive free region
&*x
//~^ WARN not reporting region error due to nll
//~| ERROR does not outlive free region
}

fn main() { }
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
warning: not reporting region error due to nll
--> $DIR/region-lbr-named-does-not-outlive-static.rs:19:5
--> $DIR/region-lbr-named-does-not-outlive-static.rs:20:5
|
LL | &*x
| ^^^

error: free region `ReFree(DefId(0/0:3 ~ region_lbr_named_does_not_outlive_static[317d]::foo[0]), BrNamed(crate0:DefIndex(1:9), 'a))` does not outlive free region `ReStatic`
--> $DIR/region-lbr-named-does-not-outlive-static.rs:19:5
--> $DIR/region-lbr-named-does-not-outlive-static.rs:18:1
|
LL | &*x
| ^^^
LL | / fn foo<'a>(x: &'a u32) -> &'static u32 {
LL | | //~^ ERROR does not outlive free region
LL | | &*x
LL | | //~^ WARN not reporting region error due to nll
LL | | }
| |_^

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
// compile-flags:-Zborrowck=mir -Zverbose

fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 {
//~^ ERROR lifetime mismatch
&*x
//~^ WARN not reporting region error due to nll
//~| ERROR lifetime mismatch
}

fn main() { }
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
warning: not reporting region error due to nll
--> $DIR/region-lbr1-does-not-outlive-ebr2.rs:19:5
--> $DIR/region-lbr1-does-not-outlive-ebr2.rs:20:5
|
LL | &*x
| ^^^

error[E0623]: lifetime mismatch
--> $DIR/region-lbr1-does-not-outlive-ebr2.rs:19:5
--> $DIR/region-lbr1-does-not-outlive-ebr2.rs:18:1
|
LL | fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 {
| ------- -------
| |
| this parameter and the return type are declared with different lifetimes...
LL | &*x
| ^^^ ...but data from `x` is returned here
LL | fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 {
| ^ ------- -------
| | |
| _| this parameter and the return type are declared with different lifetimes...
| |
LL | | //~^ ERROR lifetime mismatch
LL | | &*x
LL | | //~^ WARN not reporting region error due to nll
LL | | }
| |_^ ...but data from `x` is returned here

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ LL | expect_sig(|a, b| b); // ought to return `a`
| ^

error: free region `ReFree(DefId(0/1:9 ~ return_wrong_bound_region[317d]::test[0]::{{closure}}[0]), BrAnon(2))` does not outlive free region `ReFree(DefId(0/1:9 ~ return_wrong_bound_region[317d]::test[0]::{{closure}}[0]), BrAnon(1))`
--> $DIR/return-wrong-bound-region.rs:21:23
--> $DIR/return-wrong-bound-region.rs:21:16
|
LL | expect_sig(|a, b| b); // ought to return `a`
| ^
| ^^^^^^^^

note: No external requirements
--> $DIR/return-wrong-bound-region.rs:21:16
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/nll/guarantor-issue-46974.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ fn foo(s: &mut (i32,)) -> i32 {
*x
}

fn bar(s: &Box<(i32,)>) -> &'static i32 {
fn bar(s: &Box<(i32,)>) -> &'static i32 { //~ ERROR explicit lifetime required
// FIXME(#46983): error message should be better
&s.0 //~ ERROR explicit lifetime required in the type of `s` [E0621]
&s.0
}

fn main() {
Expand Down
15 changes: 9 additions & 6 deletions src/test/ui/nll/guarantor-issue-46974.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ LL | *x
| -- borrow later used here

error[E0621]: explicit lifetime required in the type of `s`
--> $DIR/guarantor-issue-46974.rs:25:5
--> $DIR/guarantor-issue-46974.rs:23:1
|
LL | fn bar(s: &Box<(i32,)>) -> &'static i32 {
| - consider changing the type of `s` to `&'static std::boxed::Box<(i32,)>`
LL | // FIXME(#46983): error message should be better
LL | &s.0 //~ ERROR explicit lifetime required in the type of `s` [E0621]
| ^^^^ lifetime `'static` required
LL | fn bar(s: &Box<(i32,)>) -> &'static i32 { //~ ERROR explicit lifetime required
| ^ - consider changing the type of `s` to `&'static std::boxed::Box<(i32,)>`
| _|
| |
LL | | // FIXME(#46983): error message should be better
LL | | &s.0
LL | | }
| |_^ lifetime `'static` required

error: aborting due to 2 previous errors

Expand Down
6 changes: 0 additions & 6 deletions src/test/ui/nll/issue-47470.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ LL | &local //~ ERROR `local` does not live long enough
| ^^^^^^ borrowed value does not live long enough
LL | }
| - borrowed value only lives until here
|
note: borrowed value must be valid for the lifetime 'a as defined on the impl at 23:1...
--> $DIR/issue-47470.rs:23:1
|
LL | impl<'a> Bar for Foo<'a> {
| ^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/nll/issue-48238.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: free region `` does not outlive free region `'_#1r`
--> $DIR/issue-48238.rs:21:21
--> $DIR/issue-48238.rs:21:5
|
LL | move || use_val(&orig); //~ ERROR free region `` does not outlive free region `'_#1r`
| ^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

2 changes: 1 addition & 1 deletion src/test/ui/nll/ty-outlives/impl-trait-captures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ trait Foo<'a> {
impl<'a, T> Foo<'a> for T { }

fn foo<'a, T>(x: &T) -> impl Foo<'a> {
//~^ ERROR explicit lifetime required in the type of `x` [E0621]
x
//~^ WARNING not reporting region error due to nll
//~| ERROR explicit lifetime required in the type of `x` [E0621]
}

fn main() {}
17 changes: 11 additions & 6 deletions src/test/ui/nll/ty-outlives/impl-trait-captures.stderr
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
warning: not reporting region error due to nll
--> $DIR/impl-trait-captures.rs:21:5
--> $DIR/impl-trait-captures.rs:22:5
|
LL | x
| ^

error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/impl-trait-captures.rs:21:5
--> $DIR/impl-trait-captures.rs:20:1
|
LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> {
| - consider changing the type of `x` to `&ReEarlyBound(0, 'a) T`
LL | x
| ^ lifetime `ReEarlyBound(0, 'a)` required
LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> {
| ^ - consider changing the type of `x` to `&ReEarlyBound(0, 'a) T`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like a similar comment elsewhere: this sort of thing is the reason I'm not really thrilled with ui/ tests that use -Z verbose

I recognize its a pre-existing issue with the test, but I think it would clean things up if you took the -Z verbose out the test file. (Unless you think the output is serving a useful purpose here? Provides hint to compiler devs about the internal region structure in play?)

| _|
| |
LL | | //~^ ERROR explicit lifetime required in the type of `x` [E0621]
LL | | x
LL | | //~^ WARNING not reporting region error due to nll
LL | | }
| |_^ lifetime `ReEarlyBound(0, 'a)` required

error: aborting due to previous error

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/nll/ty-outlives/impl-trait-outlives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ use std::fmt::Debug;

fn no_region<'a, T>(x: Box<T>) -> impl Debug + 'a
//~^ WARNING not reporting region error due to nll
//~| ERROR the parameter type `T` may not live long enough [E0309]
where
T: Debug,
{
x
//~^ ERROR the parameter type `T` may not live long enough [E0309]
}

fn correct_region<'a, T>(x: Box<T>) -> impl Debug + 'a
Expand All @@ -32,11 +32,11 @@ where

fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
//~^ WARNING not reporting region error due to nll
//~| ERROR the parameter type `T` may not live long enough [E0309]
where
T: 'b + Debug,
{
x
//~^ ERROR the parameter type `T` may not live long enough [E0309]
}

fn outlives_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
Expand Down
24 changes: 18 additions & 6 deletions src/test/ui/nll/ty-outlives/impl-trait-outlives.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,30 @@ LL | fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
| ^^^^^^^^^^^^^^^

error[E0309]: the parameter type `T` may not live long enough
--> $DIR/impl-trait-outlives.rs:22:5
--> $DIR/impl-trait-outlives.rs:17:1
|
LL | x
| ^
LL | / fn no_region<'a, T>(x: Box<T>) -> impl Debug + 'a
LL | | //~^ WARNING not reporting region error due to nll
LL | | //~| ERROR the parameter type `T` may not live long enough [E0309]
LL | | where
... |
LL | | x
LL | | }
| |_^
|
= help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`...

error[E0309]: the parameter type `T` may not live long enough
--> $DIR/impl-trait-outlives.rs:38:5
--> $DIR/impl-trait-outlives.rs:33:1
|
LL | x
| ^
LL | / fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
LL | | //~^ WARNING not reporting region error due to nll
LL | | //~| ERROR the parameter type `T` may not live long enough [E0309]
LL | | where
... |
LL | | x
LL | | }
| |_^
|
= help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`...

Expand Down