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>
This commit is contained in:
parent
05630b06fd
commit
996bc9abb5
1 changed files with 1 additions and 2 deletions
|
@ -124,8 +124,7 @@ impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
|
||||||
let base_ty = self.fx.monomorphize(&base_ty);
|
let base_ty = self.fx.monomorphize(&base_ty);
|
||||||
|
|
||||||
// ZSTs don't require any actual memory access.
|
// ZSTs don't require any actual memory access.
|
||||||
let elem_ty = base_ty.projection_ty(cx.tcx(), elem).ty;
|
let elem_ty = base_ty.projection_ty(cx.tcx(), self.fx.monomorphize(&elem)).ty;
|
||||||
let elem_ty = self.fx.monomorphize(&elem_ty);
|
|
||||||
let span = self.fx.mir.local_decls[place_ref.local].source_info.span;
|
let span = self.fx.mir.local_decls[place_ref.local].source_info.span;
|
||||||
if cx.spanned_layout_of(elem_ty, span).is_zst() {
|
if cx.spanned_layout_of(elem_ty, span).is_zst() {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue