diff options
Diffstat (limited to 'compiler/rustc_passes/src/dead.rs')
| -rw-r--r-- | compiler/rustc_passes/src/dead.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index b1db66fa52d..ecf8d34ad84 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -273,7 +273,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { data.get(expr.hir_id).expect("no offset_of_data for offset_of"); let body_did = self.typeck_results().hir_owner.to_def_id(); - let param_env = self.tcx.param_env(body_did); + let typing_env = ty::TypingEnv::non_body_analysis(self.tcx, body_did); let mut current_ty = container; @@ -285,13 +285,13 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { self.insert_def_id(field.did); let field_ty = field.ty(self.tcx, args); - current_ty = self.tcx.normalize_erasing_regions(param_env, field_ty); + current_ty = self.tcx.normalize_erasing_regions(typing_env, field_ty); } // we don't need to mark tuple fields as live, // but we may need to mark subfields ty::Tuple(tys) => { current_ty = - self.tcx.normalize_erasing_regions(param_env, tys[field.as_usize()]); + self.tcx.normalize_erasing_regions(typing_env, tys[field.as_usize()]); } _ => span_bug!(expr.span, "named field access on non-ADT"), } @@ -944,7 +944,10 @@ impl<'tcx> DeadVisitor<'tcx> { if is_positional && self .tcx - .layout_of(self.tcx.param_env(field.did).and(field_type)) + .layout_of( + ty::TypingEnv::non_body_analysis(self.tcx, field.did) + .as_query_input(field_type), + ) .map_or(true, |layout| layout.is_zst()) { return ShouldWarnAboutField::No; |
