summaryrefslogtreecommitdiffstats
path: root/tests/ui/impl-trait/rpit/equal-lifetime-params-ok.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/impl-trait/rpit/equal-lifetime-params-ok.rs')
-rw-r--r--tests/ui/impl-trait/rpit/equal-lifetime-params-ok.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/rpit/equal-lifetime-params-ok.rs b/tests/ui/impl-trait/rpit/equal-lifetime-params-ok.rs
new file mode 100644
index 000000000..6207381c7
--- /dev/null
+++ b/tests/ui/impl-trait/rpit/equal-lifetime-params-ok.rs
@@ -0,0 +1,19 @@
+// 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() {}