Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 4af04cb

Browse files
committed
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
1 parent 31add7e commit 4af04cb

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/librustc_ast_lowering/expr.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
10211021
"`async` generators are not yet supported"
10221022
)
10231023
.emit();
1024-
return hir::ExprKind::Err;
10251024
}
10261025
None => self.generator_kind = Some(hir::GeneratorKind::Gen),
10271026
}

src/librustc_middle/ty/context.rs

Lines changed: 7 additions & 10 deletions
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)