Rollup merge of #72275 - marmeladema:fix-issue-71104-2, r=ecstatic-morse

Continue lowering for unsupported async generator instead of returning an error.

This way the hir is "valid" and we can remove one more call to
`opt_node_id_to_hir_id` but an error is still emitted.

This is another partial fix for #71104

r? @eddyb
This commit is contained in:
Dylan DPC 2020-05-20 14:21:07 +02:00 committed by GitHub
commit 68fd4e098c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 11 deletions

View File

@ -1322,7 +1322,6 @@ fn lower_expr_yield(&mut self, span: Span, opt_expr: Option<&Expr>) -> hir::Expr
"`async` generators are not yet supported"
)
.emit();
return hir::ExprKind::Err;
}
None => self.generator_kind = Some(hir::GeneratorKind::Gen),
}

View File

@ -1114,9 +1114,7 @@ pub fn create_global_ctxt(
let mut trait_map: FxHashMap<_, FxHashMap<_, _>> = FxHashMap::default();
for (k, v) in resolutions.trait_map {
// FIXME(#71104) Should really be using just `node_id_to_hir_id` but
// some `NodeId` do not seem to have a corresponding HirId.
if let Some(hir_id) = definitions.opt_node_id_to_hir_id(k) {
let hir_id = definitions.node_id_to_hir_id(k);
let map = trait_map.entry(hir_id.owner).or_default();
let v = v
.into_iter()
@ -1124,7 +1122,6 @@ pub fn create_global_ctxt(
.collect();
map.insert(hir_id.local_id, StableVec::new(v));
}
}
GlobalCtxt {
sess: s,