Skip to content

Commit 0ff530e

Browse files
committed
Sync from rust 3ed6c1d
2 parents e9eac6b + 39e16da commit 0ff530e

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

src/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ pub(crate) struct FunctionCx<'m, 'clif, 'tcx: 'm> {
256256
pub(crate) inline_asm_index: u32,
257257
}
258258

259-
impl<'tcx> LayoutOf for FunctionCx<'_, '_, 'tcx> {
259+
impl<'tcx> LayoutOf<'tcx> for FunctionCx<'_, '_, 'tcx> {
260260
type Ty = Ty<'tcx>;
261261
type TyAndLayout = TyAndLayout<'tcx>;
262262

@@ -364,7 +364,7 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
364364

365365
pub(crate) struct RevealAllLayoutCx<'tcx>(pub(crate) TyCtxt<'tcx>);
366366

367-
impl<'tcx> LayoutOf for RevealAllLayoutCx<'tcx> {
367+
impl<'tcx> LayoutOf<'tcx> for RevealAllLayoutCx<'tcx> {
368368
type Ty = Ty<'tcx>;
369369
type TyAndLayout = TyAndLayout<'tcx>;
370370

src/constant.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ pub(crate) fn codegen_constant<'tcx>(
129129
};
130130
let const_val = match const_.val {
131131
ConstKind::Value(const_val) => const_val,
132-
ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted })
133-
if fx.tcx.is_static(def.did) =>
132+
ConstKind::Unevaluated(uv)
133+
if fx.tcx.is_static(uv.def.did) =>
134134
{
135-
assert!(substs.is_empty());
136-
assert!(promoted.is_none());
135+
assert!(uv.substs(fx.tcx).is_empty());
136+
assert!(uv.promoted.is_none());
137137

138-
return codegen_static_ref(fx, def.did, fx.layout_of(const_.ty)).to_cvalue(fx);
138+
return codegen_static_ref(fx, uv.def.did, fx.layout_of(const_.ty)).to_cvalue(fx);
139139
}
140140
ConstKind::Unevaluated(unevaluated) => {
141141
match fx.tcx.const_eval_resolve(ParamEnv::reveal_all(), unevaluated, None) {

src/debuginfo/mod.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,10 @@ impl<'tcx> DebugContext<'tcx> {
161161

162162
for (field_idx, field_def) in variant.fields.iter().enumerate() {
163163
let field_offset = layout.fields.offset(field_idx);
164-
let field_layout = layout
165-
.field(
166-
&layout::LayoutCx { tcx: self.tcx, param_env: ParamEnv::reveal_all() },
167-
field_idx,
168-
)
169-
.unwrap();
164+
let field_layout = layout.field(
165+
&layout::LayoutCx { tcx: self.tcx, param_env: ParamEnv::reveal_all() },
166+
field_idx,
167+
);
170168

171169
let field_type = self.dwarf_ty(field_layout.ty);
172170

src/intrinsics/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
789789
return;
790790
}
791791

792-
if intrinsic == sym::assert_zero_valid && !layout.might_permit_raw_init(fx, /*zero:*/ true).unwrap() {
792+
if intrinsic == sym::assert_zero_valid && !layout.might_permit_raw_init(fx, /*zero:*/ true) {
793793
with_no_trimmed_paths(|| crate::base::codegen_panic(
794794
fx,
795795
&format!("attempted to zero-initialize type `{}`, which is invalid", T),
@@ -798,7 +798,7 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
798798
return;
799799
}
800800

801-
if intrinsic == sym::assert_uninit_valid && !layout.might_permit_raw_init(fx, /*zero:*/ false).unwrap() {
801+
if intrinsic == sym::assert_uninit_valid && !layout.might_permit_raw_init(fx, /*zero:*/ false) {
802802
with_no_trimmed_paths(|| crate::base::codegen_panic(
803803
fx,
804804
&format!("attempted to leave type `{}` uninitialized, which is invalid", T),

0 commit comments

Comments
 (0)