Skip to content

Commit 68fd4e0

Browse files
authored
Rollup merge of rust-lang#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 rust-lang#71104 r? @eddyb
2 parents 5c52f9f + 4af04cb commit 68fd4e0

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/librustc_ast_lowering/expr.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
13221322
"`async` generators are not yet supported"
13231323
)
13241324
.emit();
1325-
return hir::ExprKind::Err;
13261325
}
13271326
None => self.generator_kind = Some(hir::GeneratorKind::Gen),
13281327
}

src/librustc_middle/ty/context.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -1114,16 +1114,13 @@ impl<'tcx> TyCtxt<'tcx> {
11141114

11151115
let mut trait_map: FxHashMap<_, FxHashMap<_, _>> = FxHashMap::default();
11161116
for (k, v) in resolutions.trait_map {
1117-
// FIXME(#71104) Should really be using just `node_id_to_hir_id` but
1118-
// some `NodeId` do not seem to have a corresponding HirId.
1119-
if let Some(hir_id) = definitions.opt_node_id_to_hir_id(k) {
1120-
let map = trait_map.entry(hir_id.owner).or_default();
1121-
let v = v
1122-
.into_iter()
1123-
.map(|tc| tc.map_import_ids(|id| definitions.node_id_to_hir_id(id)))
1124-
.collect();
1125-
map.insert(hir_id.local_id, StableVec::new(v));
1126-
}
1117+
let hir_id = definitions.node_id_to_hir_id(k);
1118+
let map = trait_map.entry(hir_id.owner).or_default();
1119+
let v = v
1120+
.into_iter()
1121+
.map(|tc| tc.map_import_ids(|id| definitions.node_id_to_hir_id(id)))
1122+
.collect();
1123+
map.insert(hir_id.local_id, StableVec::new(v));
11271124
}
11281125

11291126
GlobalCtxt {

0 commit comments

Comments
 (0)