about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2019-10-05 22:24:55 +0100
committerMatthew Jasper <mjjasper1@gmail.com>2019-10-05 22:24:55 +0100
commit1471f0bc1bc060922cf953250294e968b3e62c7f (patch)
tree9141714566fcb76e77138d55f5d95a5157ed5b61 /src/test
parent2e7244807a7878f6eca3eb7d97ae9b413aa49014 (diff)
downloadrust-1471f0bc1bc060922cf953250294e968b3e62c7f.tar.gz
rust-1471f0bc1bc060922cf953250294e968b3e62c7f.zip
Ensure that associated `async fn`s have unique fresh param names
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/async-await/async-assoc-fn-anon-lifetimes.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/ui/async-await/async-assoc-fn-anon-lifetimes.rs b/src/test/ui/async-await/async-assoc-fn-anon-lifetimes.rs
new file mode 100644
index 00000000000..8e08b82b9d3
--- /dev/null
+++ b/src/test/ui/async-await/async-assoc-fn-anon-lifetimes.rs
@@ -0,0 +1,23 @@
+// check-pass
+// Check that the anonymous lifetimes used here aren't considered to shadow one
+// another. Note that `async fn` is different to `fn` here because the lifetimes
+// are numbered by HIR lowering, rather than lifetime resolution.
+
+// edition:2018
+
+struct A<'a, 'b>(&'a &'b i32);
+struct B<'a>(&'a i32);
+
+impl A<'_, '_> {
+    async fn assoc(x: &u32, y: B<'_>) {
+        async fn nested(x: &u32, y: A<'_, '_>) {}
+    }
+
+    async fn assoc2(x: &u32, y: A<'_, '_>) {
+        impl A<'_, '_> {
+            async fn nested_assoc(x: &u32, y: B<'_>) {}
+        }
+    }
+}
+
+fn main() {}