diff options
| author | David Wood <david@davidtw.co> | 2020-06-22 12:53:40 +0100 |
|---|---|---|
| committer | David Wood <david@davidtw.co> | 2020-07-20 11:23:22 +0100 |
| commit | 996bc9abb53fca2c55ecd77b60d200687ad82da4 (patch) | |
| tree | c16194a9c5941f8032525da0d75fbd3eac8c94c5 /src/librustc_codegen_ssa | |
| parent | 05630b06fdf76c25c6ccf2e9ac3567592eae6c67 (diff) | |
| download | rust-996bc9abb53fca2c55ecd77b60d200687ad82da4.tar.gz rust-996bc9abb53fca2c55ecd77b60d200687ad82da4.zip | |
mir: avoid double substitution
This commit avoids a natural, free-range double substitution error by monomorphizing the projection element before getting the type. Signed-off-by: David Wood <david@davidtw.co>
Diffstat (limited to 'src/librustc_codegen_ssa')
| -rw-r--r-- | src/librustc_codegen_ssa/mir/analyze.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/librustc_codegen_ssa/mir/analyze.rs b/src/librustc_codegen_ssa/mir/analyze.rs index db935c2b3e2..2e386c1e594 100644 --- a/src/librustc_codegen_ssa/mir/analyze.rs +++ b/src/librustc_codegen_ssa/mir/analyze.rs @@ -124,8 +124,7 @@ impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> { let base_ty = self.fx.monomorphize(&base_ty); // ZSTs don't require any actual memory access. - let elem_ty = base_ty.projection_ty(cx.tcx(), elem).ty; - let elem_ty = self.fx.monomorphize(&elem_ty); + let elem_ty = base_ty.projection_ty(cx.tcx(), self.fx.monomorphize(&elem)).ty; let span = self.fx.mir.local_decls[place_ref.local].source_info.span; if cx.spanned_layout_of(elem_ty, span).is_zst() { return; |
