-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)NLL-diagnosticsWorking towards the "diagnostic parity" goalWorking towards the "diagnostic parity" goal
Description
trait Foo<'a> {}
impl<'a, T> Foo<'a> for T {}
fn baz<'a, 'b, T>(x: &mut Vec<&'a T>, y: &T)
where i32: Foo<'a>,
u32: Foo<'b>
{
x.push(y); //~ ERROR explicit lifetime required
}
fn main() {
let x = baz;
}
its expected error output is (https://github.com/rust-lang/rust/blob/master/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr)
error[E0621]: explicit lifetime required in the type of `y`
--> $DIR/ex2a-push-one-existing-name-early-bound.rs:17:12
|
LL | fn baz<'a, 'b, T>(x: &mut Vec<&'a T>, y: &T)
| - consider changing the type of `y` to `&'a T`
...
LL | x.push(y); //~ ERROR explicit lifetime required
| ^ lifetime `'a` required
but under NLL it yields (https://github.com/rust-lang/rust/blob/master/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr):
warning: not reporting region error due to nll
--> $DIR/ex2a-push-one-existing-name-early-bound.rs:17:12
|
LL | x.push(y); //~ ERROR explicit lifetime required
| ^
error[E0282]: type annotations needed
--> $DIR/ex2a-push-one-existing-name-early-bound.rs:20:9
|
LL | let x = baz;
| - ^^^ cannot infer type for `T`
| |
| consider giving `x` a type
error: aborting due to previous error
The latter is amazingly different from the former.
Metadata
Metadata
Assignees
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)NLL-diagnosticsWorking towards the "diagnostic parity" goalWorking towards the "diagnostic parity" goal