Skip to content

Commit

Permalink
Rollup merge of rust-lang#72275 - marmeladema:fix-issue-71104-2, r=ec…
Browse files Browse the repository at this point in the history
…static-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 rust-lang#71104

r? @eddyb
  • Loading branch information
Dylan-DPC committed May 20, 2020
2 parents 5c52f9f + 4af04cb commit 68fd4e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/librustc_ast_lowering/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
"`async` generators are not yet supported"
)
.emit();
return hir::ExprKind::Err;
}
None => self.generator_kind = Some(hir::GeneratorKind::Gen),
}
Expand Down
17 changes: 7 additions & 10 deletions src/librustc_middle/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1114,16 +1114,13 @@ impl<'tcx> TyCtxt<'tcx> {

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 map = trait_map.entry(hir_id.owner).or_default();
let v = v
.into_iter()
.map(|tc| tc.map_import_ids(|id| definitions.node_id_to_hir_id(id)))
.collect();
map.insert(hir_id.local_id, StableVec::new(v));
}
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()
.map(|tc| tc.map_import_ids(|id| definitions.node_id_to_hir_id(id)))
.collect();
map.insert(hir_id.local_id, StableVec::new(v));
}

GlobalCtxt {
Expand Down

0 comments on commit 68fd4e0

Please sign in to comment.