Closed
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.