typeck: Ensure proper bound vars passed to add_bounds.

Fixes the ICE in #88586.
This commit is contained in:
Ben Reeves 2021-11-27 23:10:18 -06:00
parent 4919988fe1
commit 9155f672bf
3 changed files with 37 additions and 9 deletions

View file

@ -0,0 +1,11 @@
// Regression test for #88586: a higher-ranked outlives bound on Self in a trait
// definition caused an ICE when debug_assertions were enabled.
//
// The error output is incidentally unhelpful; this should be improved.
trait A where for<'a> Self: 'a
//~^ ERROR the parameter type `Self` may not live long enough
{
}
fn main() {}

View file

@ -0,0 +1,19 @@
error[E0311]: the parameter type `Self` may not live long enough
--> $DIR/issue-88586-hr-self-outlives-in-trait-def.rs:6:1
|
LL | / trait A where for<'a> Self: 'a
LL | |
LL | | {
LL | | }
| |_^
|
= help: consider adding an explicit lifetime bound `Self: 'a`...
= note: ...so that the type `Self` will meet its required lifetime bounds...
note: ...that is required by this bound
--> $DIR/issue-88586-hr-self-outlives-in-trait-def.rs:6:29
|
LL | trait A where for<'a> Self: 'a
| ^^
error: aborting due to previous error