do not introduce *false* results from lifetime resolution

This commit is contained in:
Niko Matsakis 2018-06-21 15:26:44 -04:00
parent b36917b331
commit a2a019a28a
3 changed files with 34 additions and 6 deletions

View file

@ -19,7 +19,7 @@ fn free_fn_capture_hrtb_in_impl_trait()
-> Box<for<'a> Id<impl Lt<'a>>>
//~^ ERROR `impl Trait` can only capture lifetimes bound at the fn or impl level [E0657]
{
()
() //~ ERROR mismatched types
}
struct Foo;
@ -28,7 +28,7 @@ impl Foo {
-> Box<for<'a> Id<impl Lt<'a>>>
//~^ ERROR `impl Trait` can only capture lifetimes bound at the fn or impl level
{
()
() //~ ERROR mismatched types
}
}

View file

@ -10,6 +10,25 @@ error[E0657]: `impl Trait` can only capture lifetimes bound at the fn or impl le
LL | -> Box<for<'a> Id<impl Lt<'a>>>
| ^^
error: aborting due to 2 previous errors
error[E0308]: mismatched types
--> $DIR/E0657.rs:22:5
|
LL | () //~ ERROR mismatched types
| ^^ expected struct `std::boxed::Box`, found ()
|
= note: expected type `std::boxed::Box<Id<_> + 'static>`
found type `()`
For more information about this error, try `rustc --explain E0657`.
error[E0308]: mismatched types
--> $DIR/E0657.rs:31:9
|
LL | () //~ ERROR mismatched types
| ^^ expected struct `std::boxed::Box`, found ()
|
= note: expected type `std::boxed::Box<Id<_> + 'static>`
found type `()`
error: aborting due to 4 previous errors
Some errors occurred: E0308, E0657.
For more information about an error, try `rustc --explain E0308`.