diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-05-20 14:21:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-20 14:21:07 +0200 |
| commit | 68fd4e098c0629528ba9da81ad752b43d32e7d6c (patch) | |
| tree | 7d8b767be4d2ca2a8b8c2f0499ea6f02a9294553 | |
| parent | 5c52f9f9167730cf48c387366be289d53a485754 (diff) | |
| parent | 4af04cb5cbe19cc3658584c005180da9a38c1530 (diff) | |
| download | rust-68fd4e098c0629528ba9da81ad752b43d32e7d6c.tar.gz rust-68fd4e098c0629528ba9da81ad752b43d32e7d6c.zip | |
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
| -rw-r--r-- | src/librustc_ast_lowering/expr.rs | 1 | ||||
| -rw-r--r-- | src/librustc_middle/ty/context.rs | 17 |
2 files changed, 7 insertions, 11 deletions
diff --git a/src/librustc_ast_lowering/expr.rs b/src/librustc_ast_lowering/expr.rs index 856387421d9..5bcd111706f 100644 --- a/src/librustc_ast_lowering/expr.rs +++ b/src/librustc_ast_lowering/expr.rs @@ -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), } diff --git a/src/librustc_middle/ty/context.rs b/src/librustc_middle/ty/context.rs index c005455a3aa..d2e53facf5e 100644 --- a/src/librustc_middle/ty/context.rs +++ b/src/librustc_middle/ty/context.rs @@ -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 { |
