Skip to content

Commit

Permalink
Fix async fn lowering ICE with APIT.
Browse files Browse the repository at this point in the history
This commit fixes an ICE where simple bindings (which aren't replaced
with replacement arguments during async fn lowering) were not being
visited in the def collector and thus caused an ICE during HIR lowering
for types that use their `DefId` at that point - such as `impl Trait`.
  • Loading branch information
davidtwco committed May 3, 2019
1 parent 08bfe16 commit f346309
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/librustc/hir/map/def_collector.rs
Expand Up @@ -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);
}
}

Expand Down
12 changes: 12 additions & 0 deletions 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() {}

0 comments on commit f346309

Please sign in to comment.