Skip to content

Commit 4563abd

Browse files
committed
Sync from rust a240ccd
2 parents d459445 + 06bc64d commit 4563abd

File tree

7 files changed

+22
-22
lines changed

7 files changed

+22
-22
lines changed

src/abi/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ pub(crate) fn codegen_drop<'tcx>(
544544
let arg_value = drop_place.place_ref(
545545
fx,
546546
fx.layout_of(fx.tcx.mk_ref(
547-
&ty::RegionKind::ReErased,
547+
fx.tcx.lifetimes.re_erased,
548548
TypeAndMut { ty, mutbl: crate::rustc_hir::Mutability::Mut },
549549
)),
550550
);

src/base.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub(crate) fn codegen_fn<'tcx>(
8181
let arg_uninhabited = fx
8282
.mir
8383
.args_iter()
84-
.any(|arg| fx.layout_of(fx.monomorphize(&fx.mir.local_decls[arg].ty)).abi.is_uninhabited());
84+
.any(|arg| fx.layout_of(fx.monomorphize(fx.mir.local_decls[arg].ty)).abi.is_uninhabited());
8585

8686
if !crate::constant::check_constants(&mut fx) {
8787
fx.bcx.append_block_params_for_function_params(fx.block_map[START_BLOCK]);
@@ -692,7 +692,7 @@ fn codegen_stmt<'tcx>(
692692
let times = fx
693693
.monomorphize(times)
694694
.eval(fx.tcx, ParamEnv::reveal_all())
695-
.val
695+
.val()
696696
.try_to_bits(fx.tcx.data_layout.pointer_size)
697697
.unwrap();
698698
if operand.layout().size.bytes() == 0 {
@@ -842,16 +842,16 @@ pub(crate) fn codegen_place<'tcx>(
842842
match cplace.layout().ty.kind() {
843843
ty::Array(elem_ty, _len) => {
844844
assert!(!from_end, "array subslices are never `from_end`");
845-
let elem_layout = fx.layout_of(elem_ty);
845+
let elem_layout = fx.layout_of(*elem_ty);
846846
let ptr = cplace.to_ptr();
847847
cplace = CPlace::for_ptr(
848848
ptr.offset_i64(fx, elem_layout.size.bytes() as i64 * (from as i64)),
849-
fx.layout_of(fx.tcx.mk_array(elem_ty, to - from)),
849+
fx.layout_of(fx.tcx.mk_array(*elem_ty, to - from)),
850850
);
851851
}
852852
ty::Slice(elem_ty) => {
853853
assert!(from_end, "slice subslices should be `from_end`");
854-
let elem_layout = fx.layout_of(elem_ty);
854+
let elem_layout = fx.layout_of(*elem_ty);
855855
let (ptr, len) = cplace.to_ptr_maybe_unsized();
856856
let len = len.unwrap();
857857
cplace = CPlace::for_ptr_with_extra(

src/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn clif_type_from_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<types::Typ
6161
},
6262
ty::FnPtr(_) => pointer_ty(tcx),
6363
ty::RawPtr(TypeAndMut { ty: pointee_ty, mutbl: _ }) | ty::Ref(_, pointee_ty, _) => {
64-
if has_ptr_meta(tcx, pointee_ty) {
64+
if has_ptr_meta(tcx, *pointee_ty) {
6565
return None;
6666
} else {
6767
pointer_ty(tcx)
@@ -100,7 +100,7 @@ fn clif_pair_type_from_ty<'tcx>(
100100
(a, b)
101101
}
102102
ty::RawPtr(TypeAndMut { ty: pointee_ty, mutbl: _ }) | ty::Ref(_, pointee_ty, _) => {
103-
if has_ptr_meta(tcx, pointee_ty) {
103+
if has_ptr_meta(tcx, *pointee_ty) {
104104
(pointer_ty(tcx), pointer_ty(tcx))
105105
} else {
106106
return None;

src/constant.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub(crate) fn check_constants(fx: &mut FunctionCx<'_, '_, '_>) -> bool {
4646
ConstantKind::Ty(ct) => ct,
4747
ConstantKind::Val(..) => continue,
4848
};
49-
match const_.val {
49+
match const_.val() {
5050
ConstKind::Value(_) => {}
5151
ConstKind::Unevaluated(unevaluated) => {
5252
if let Err(err) =
@@ -127,15 +127,15 @@ pub(crate) fn codegen_constant<'tcx>(
127127
ConstantKind::Ty(ct) => ct,
128128
ConstantKind::Val(val, ty) => return codegen_const_value(fx, val, ty),
129129
};
130-
let const_val = match const_.val {
130+
let const_val = match const_.val() {
131131
ConstKind::Value(const_val) => const_val,
132132
ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted })
133133
if fx.tcx.is_static(def.did) =>
134134
{
135135
assert!(substs.is_empty());
136136
assert!(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, 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) {
@@ -152,7 +152,7 @@ pub(crate) fn codegen_constant<'tcx>(
152152
| ConstKind::Error(_) => unreachable!("{:?}", const_),
153153
};
154154

155-
codegen_const_value(fx, const_val, const_.ty)
155+
codegen_const_value(fx, const_val, const_.ty())
156156
}
157157

158158
pub(crate) fn codegen_const_value<'tcx>(
@@ -465,7 +465,7 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
465465
match operand {
466466
Operand::Constant(const_) => match const_.literal {
467467
ConstantKind::Ty(const_) => {
468-
fx.monomorphize(const_).eval(fx.tcx, ParamEnv::reveal_all()).val.try_to_value()
468+
fx.monomorphize(const_).eval(fx.tcx, ParamEnv::reveal_all()).val().try_to_value()
469469
}
470470
ConstantKind::Val(val, _) => Some(val),
471471
},
@@ -490,7 +490,7 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
490490
return None;
491491
}
492492
let const_val = mir_operand_get_const_val(fx, operand)?;
493-
if fx.layout_of(ty).size
493+
if fx.layout_of(*ty).size
494494
!= const_val.try_to_scalar_int()?.size()
495495
{
496496
return None;

src/debuginfo/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl<'tcx> DebugContext<'tcx> {
114114
}
115115

116116
fn dwarf_ty(&mut self, ty: Ty<'tcx>) -> UnitEntryId {
117-
if let Some(type_id) = self.types.get(ty) {
117+
if let Some(type_id) = self.types.get(&ty) {
118118
return *type_id;
119119
}
120120

@@ -143,7 +143,7 @@ impl<'tcx> DebugContext<'tcx> {
143143
// Ensure that type is inserted before recursing to avoid duplicates
144144
self.types.insert(ty, type_id);
145145

146-
let pointee = self.dwarf_ty(pointee_ty);
146+
let pointee = self.dwarf_ty(*pointee_ty);
147147

148148
let type_entry = self.dwarf.unit.get_mut(type_id);
149149

src/unsize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn unsize_ptr<'tcx>(
6666
(&ty::Ref(_, a, _), &ty::Ref(_, b, _))
6767
| (&ty::Ref(_, a, _), &ty::RawPtr(ty::TypeAndMut { ty: b, .. }))
6868
| (&ty::RawPtr(ty::TypeAndMut { ty: a, .. }), &ty::RawPtr(ty::TypeAndMut { ty: b, .. })) => {
69-
(src, unsized_info(fx, a, b, old_info))
69+
(src, unsized_info(fx, *a, *b, old_info))
7070
}
7171
(&ty::Adt(def_a, _), &ty::Adt(def_b, _)) if def_a.is_box() && def_b.is_box() => {
7272
let (a, b) = (src_layout.ty.boxed_ty(), dst_layout.ty.boxed_ty());

src/value_and_place.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ impl<'tcx> CPlace<'tcx> {
514514
// Can only happen for vector types
515515
let len =
516516
u16::try_from(len.eval_usize(fx.tcx, ParamEnv::reveal_all())).unwrap();
517-
let vector_ty = fx.clif_type(element).unwrap().by(len).unwrap();
517+
let vector_ty = fx.clif_type(*element).unwrap().by(len).unwrap();
518518

519519
let data = match from.0 {
520520
CValueInner::ByRef(ptr, None) => {
@@ -721,8 +721,8 @@ impl<'tcx> CPlace<'tcx> {
721721
index: Value,
722722
) -> CPlace<'tcx> {
723723
let (elem_layout, ptr) = match self.layout().ty.kind() {
724-
ty::Array(elem_ty, _) => (fx.layout_of(elem_ty), self.to_ptr()),
725-
ty::Slice(elem_ty) => (fx.layout_of(elem_ty), self.to_ptr_maybe_unsized().0),
724+
ty::Array(elem_ty, _) => (fx.layout_of(*elem_ty), self.to_ptr()),
725+
ty::Slice(elem_ty) => (fx.layout_of(*elem_ty), self.to_ptr_maybe_unsized().0),
726726
_ => bug!("place_index({:?})", self.layout().ty),
727727
};
728728

@@ -781,11 +781,11 @@ pub(crate) fn assert_assignable<'tcx>(
781781
ty::RawPtr(TypeAndMut { ty: a, mutbl: _ }),
782782
ty::RawPtr(TypeAndMut { ty: b, mutbl: _ }),
783783
) => {
784-
assert_assignable(fx, a, b);
784+
assert_assignable(fx, *a, *b);
785785
}
786786
(ty::Ref(_, a, _), ty::RawPtr(TypeAndMut { ty: b, mutbl: _ }))
787787
| (ty::RawPtr(TypeAndMut { ty: a, mutbl: _ }), ty::Ref(_, b, _)) => {
788-
assert_assignable(fx, a, b);
788+
assert_assignable(fx, *a, *b);
789789
}
790790
(ty::FnPtr(_), ty::FnPtr(_)) => {
791791
let from_sig = fx.tcx.normalize_erasing_late_bound_regions(

0 commit comments

Comments
 (0)