mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
fix ICE in offset_of! error recovery
This commit is contained in:
@@ -806,6 +806,10 @@ fn make_mirror_unadjusted(&mut self, expr: &'tcx hir::Expr<'tcx>) -> Expr<'tcx>
|
||||
lit: ScalarInt::try_from_uint(val, Size::from_bits(32)).unwrap(),
|
||||
user_ty: None,
|
||||
};
|
||||
let mk_usize_kind = |val: u64| ExprKind::NonHirLiteral {
|
||||
lit: ScalarInt::try_from_uint(val, tcx.data_layout.pointer_size()).unwrap(),
|
||||
user_ty: None,
|
||||
};
|
||||
let mk_call =
|
||||
|thir: &mut Thir<'tcx>, ty: Ty<'tcx>, variant: VariantIdx, field: FieldIdx| {
|
||||
let fun_ty =
|
||||
@@ -842,7 +846,7 @@ fn make_mirror_unadjusted(&mut self, expr: &'tcx hir::Expr<'tcx>) -> Expr<'tcx>
|
||||
});
|
||||
}
|
||||
|
||||
expr.unwrap_or(mk_u32_kind(0))
|
||||
expr.unwrap_or_else(|| mk_usize_kind(0))
|
||||
}
|
||||
|
||||
hir::ExprKind::ConstBlock(ref anon_const) => {
|
||||
|
||||
Reference in New Issue
Block a user