about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/librustc/hir/map/def_collector.rs4
-rw-r--r--src/test/ui/async-await/issue-60518.rs12
2 files changed, 15 insertions, 1 deletions
diff --git a/src/librustc/hir/map/def_collector.rs b/src/librustc/hir/map/def_collector.rs
index 78de8539859..7f1352095d9 100644
--- a/src/librustc/hir/map/def_collector.rs
+++ b/src/librustc/hir/map/def_collector.rs
@@ -92,10 +92,12 @@ impl<'a> DefCollector<'a> {
             visit::walk_generics(this, generics);
 
             // Walk the generated arguments for the `async fn`.
-            for a in arguments {
+            for (i, a) in arguments.iter().enumerate() {
                 use visit::Visitor;
                 if let Some(arg) = &a.arg {
                     this.visit_ty(&arg.ty);
+                } else {
+                    this.visit_ty(&decl.inputs[i].ty);
                 }
             }
 
diff --git a/src/test/ui/async-await/issue-60518.rs b/src/test/ui/async-await/issue-60518.rs
new file mode 100644
index 00000000000..f603c5bd3f9
--- /dev/null
+++ b/src/test/ui/async-await/issue-60518.rs
@@ -0,0 +1,12 @@
+// compile-pass
+// edition:2018
+
+#![feature(async_await)]
+
+// This is a regression test to ensure that simple bindings (where replacement arguments aren't
+// created during async fn lowering) that have their DefId used during HIR lowering (such as impl
+// trait) are visited during def collection and thus have a DefId.
+
+async fn foo(ws: impl Iterator<Item = ()>) {}
+
+fn main() {}