mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Merge #6921
6921: Higher-ranked trait bounds for where clauses r=flodiebold a=Veykril There is a slight problem with this which is also noted in a FIXME now but `LifetimeParameters` of these ForLifetime where clauses allocate the lifetimes in the corresponding arena as if they were lifetimes of the item itself and not just the clause they belong to. I wasn't entirely sure what I could do about this but given nothing really uses lifetimes like that currently I figured it might be fine? Open to suggestions for that problem. Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
eefbae7ed4
5 changed files with 74 additions and 19 deletions
|
@ -1077,4 +1077,32 @@ fn foo<'foobar>(_: &'foobar ()) {
|
|||
}"#,
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore] // requires the HIR to somehow track these hrtb lifetimes
|
||||
fn goto_lifetime_hrtb() {
|
||||
check(
|
||||
r#"trait Foo<T> {}
|
||||
fn foo<T>() where for<'a> T: Foo<&'a<|> (u8, u16)>, {}
|
||||
//^^
|
||||
"#,
|
||||
);
|
||||
check(
|
||||
r#"trait Foo<T> {}
|
||||
fn foo<T>() where for<'a<|>> T: Foo<&'a (u8, u16)>, {}
|
||||
//^^
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore] // requires ForTypes to be implemented
|
||||
fn goto_lifetime_hrtb_for_type() {
|
||||
check(
|
||||
r#"trait Foo<T> {}
|
||||
fn foo<T>() where T: for<'a> Foo<&'a<|> (u8, u16)>, {}
|
||||
//^^
|
||||
"#,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue