rust/tests/ui/impl-trait/rpit/equal-lifetime-params-ok.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
411 B
Rust
Raw Normal View History

2023-07-21 05:27:41 -05:00
// check-pass
// related to #113916, check that using RPITs in functions with lifetime params
// which are constrained to be equal compiles.
trait Trait<'a, 'b> {}
impl Trait<'_, '_> for () {}
fn pass<'a: 'b, 'b: 'a>() -> impl Trait<'a, 'b> {
(|| {})()
}
struct Foo<'a>(&'a ());
impl<'a> Foo<'a> {
fn bar<'b: 'a>(&'b self) -> impl Trait<'a, 'b> {
let _: &'a &'b &'a ();
}
}
fn main() {}