Skip to content

Commit 2922d41

Browse files
committed
Sync from rust 993deaa
2 parents d3e9e42 + 1cae701 commit 2922d41

File tree

8 files changed

+24
-20
lines changed

8 files changed

+24
-20
lines changed

src/abi/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,8 @@ pub(crate) fn codegen_drop<'tcx>(
670670

671671
let arg_value = drop_place.place_ref(
672672
fx,
673-
fx.layout_of(fx.tcx.mk_ref(
673+
fx.layout_of(Ty::new_ref(
674+
fx.tcx,
674675
fx.tcx.lifetimes.re_erased,
675676
TypeAndMut { ty, mutbl: crate::rustc_hir::Mutability::Mut },
676677
)),

src/base.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use rustc_ast::InlineAsmOptions;
44
use rustc_index::IndexVec;
5-
use rustc_middle::ty::adjustment::PointerCast;
5+
use rustc_middle::ty::adjustment::PointerCoercion;
66
use rustc_middle::ty::layout::FnAbiOf;
77
use rustc_middle::ty::print::with_no_trimmed_paths;
88

@@ -592,7 +592,7 @@ fn codegen_stmt<'tcx>(
592592
lval.write_cvalue(fx, res);
593593
}
594594
Rvalue::Cast(
595-
CastKind::Pointer(PointerCast::ReifyFnPointer),
595+
CastKind::PointerCoercion(PointerCoercion::ReifyFnPointer),
596596
ref operand,
597597
to_ty,
598598
) => {
@@ -617,17 +617,17 @@ fn codegen_stmt<'tcx>(
617617
}
618618
}
619619
Rvalue::Cast(
620-
CastKind::Pointer(PointerCast::UnsafeFnPointer),
620+
CastKind::PointerCoercion(PointerCoercion::UnsafeFnPointer),
621621
ref operand,
622622
to_ty,
623623
)
624624
| Rvalue::Cast(
625-
CastKind::Pointer(PointerCast::MutToConstPointer),
625+
CastKind::PointerCoercion(PointerCoercion::MutToConstPointer),
626626
ref operand,
627627
to_ty,
628628
)
629629
| Rvalue::Cast(
630-
CastKind::Pointer(PointerCast::ArrayToPointer),
630+
CastKind::PointerCoercion(PointerCoercion::ArrayToPointer),
631631
ref operand,
632632
to_ty,
633633
) => {
@@ -683,7 +683,7 @@ fn codegen_stmt<'tcx>(
683683
}
684684
}
685685
Rvalue::Cast(
686-
CastKind::Pointer(PointerCast::ClosureFnPointer(_)),
686+
CastKind::PointerCoercion(PointerCoercion::ClosureFnPointer(_)),
687687
ref operand,
688688
_to_ty,
689689
) => {
@@ -705,7 +705,11 @@ fn codegen_stmt<'tcx>(
705705
_ => bug!("{} cannot be cast to a fn ptr", operand.layout().ty),
706706
}
707707
}
708-
Rvalue::Cast(CastKind::Pointer(PointerCast::Unsize), ref operand, _to_ty) => {
708+
Rvalue::Cast(
709+
CastKind::PointerCoercion(PointerCoercion::Unsize),
710+
ref operand,
711+
_to_ty,
712+
) => {
709713
let operand = codegen_operand(fx, operand);
710714
crate::unsize::coerce_unsized_into(fx, operand, lval);
711715
}
@@ -727,7 +731,6 @@ fn codegen_stmt<'tcx>(
727731
let times = fx
728732
.monomorphize(times)
729733
.eval(fx.tcx, ParamEnv::reveal_all())
730-
.kind()
731734
.try_to_bits(fx.tcx.data_layout.pointer_size)
732735
.unwrap();
733736
if operand.layout().size.bytes() == 0 {
@@ -768,7 +771,7 @@ fn codegen_stmt<'tcx>(
768771
}
769772
Rvalue::ShallowInitBox(ref operand, content_ty) => {
770773
let content_ty = fx.monomorphize(content_ty);
771-
let box_layout = fx.layout_of(fx.tcx.mk_box(content_ty));
774+
let box_layout = fx.layout_of(Ty::new_box(fx.tcx, content_ty));
772775
let operand = codegen_operand(fx, operand);
773776
let operand = operand.load_scalar(fx);
774777
lval.write_cvalue(fx, CValue::by_val(operand, box_layout));
@@ -909,7 +912,7 @@ pub(crate) fn codegen_place<'tcx>(
909912
let ptr = cplace.to_ptr();
910913
cplace = CPlace::for_ptr(
911914
ptr.offset_i64(fx, elem_layout.size.bytes() as i64 * (from as i64)),
912-
fx.layout_of(fx.tcx.mk_array(*elem_ty, to - from)),
915+
fx.layout_of(Ty::new_array(fx.tcx, *elem_ty, to - from)),
913916
);
914917
}
915918
ty::Slice(elem_ty) => {

src/codegen_i128.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub(crate) fn maybe_codegen_checked<'tcx>(
9292
match bin_op {
9393
BinOp::BitAnd | BinOp::BitOr | BinOp::BitXor => unreachable!(),
9494
BinOp::Mul if is_signed => {
95-
let out_ty = fx.tcx.mk_tup(&[lhs.layout().ty, fx.tcx.types.bool]);
95+
let out_ty = Ty::new_tup(fx.tcx, &[lhs.layout().ty, fx.tcx.types.bool]);
9696
let oflow = CPlace::new_stack_slot(fx, fx.layout_of(fx.tcx.types.i32));
9797
let lhs = lhs.load_scalar(fx);
9898
let rhs = rhs.load_scalar(fx);
@@ -112,7 +112,7 @@ pub(crate) fn maybe_codegen_checked<'tcx>(
112112
Some(CValue::by_val_pair(res, oflow, fx.layout_of(out_ty)))
113113
}
114114
BinOp::Add | BinOp::Sub | BinOp::Mul => {
115-
let out_ty = fx.tcx.mk_tup(&[lhs.layout().ty, fx.tcx.types.bool]);
115+
let out_ty = Ty::new_tup(fx.tcx, &[lhs.layout().ty, fx.tcx.types.bool]);
116116
let out_place = CPlace::new_stack_slot(fx, fx.layout_of(out_ty));
117117
let param_types = vec![
118118
AbiParam::special(fx.pointer_type, ArgumentPurpose::StructReturn),

src/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn clif_pair_type_from_ty<'tcx>(
9999

100100
/// Is a pointer to this type a fat ptr?
101101
pub(crate) fn has_ptr_meta<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool {
102-
let ptr_ty = tcx.mk_ptr(TypeAndMut { ty, mutbl: rustc_hir::Mutability::Not });
102+
let ptr_ty = Ty::new_ptr(tcx, TypeAndMut { ty, mutbl: rustc_hir::Mutability::Not });
103103
match &tcx.layout_of(ParamEnv::reveal_all().and(ptr_ty)).unwrap().abi {
104104
Abi::Scalar(_) => false,
105105
Abi::ScalarPair(_, _) => true,

src/debuginfo/line_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl DebugContext {
8181

8282
match tcx.sess.source_map().lookup_line(span.lo()) {
8383
Ok(SourceFileAndLine { sf: file, line }) => {
84-
let line_pos = file.line_begin_pos(span.lo());
84+
let line_pos = file.lines(|lines| lines[line]);
8585

8686
(
8787
file,

src/num.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ pub(crate) fn codegen_checked_int_binop<'tcx>(
270270
_ => bug!("binop {:?} on checked int/uint lhs: {:?} rhs: {:?}", bin_op, in_lhs, in_rhs),
271271
};
272272

273-
let out_layout = fx.layout_of(fx.tcx.mk_tup(&[in_lhs.layout().ty, fx.tcx.types.bool]));
273+
let out_layout = fx.layout_of(Ty::new_tup(fx.tcx, &[in_lhs.layout().ty, fx.tcx.types.bool]));
274274
CValue::by_val_pair(res, has_overflow, out_layout)
275275
}
276276

src/pretty_clif.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,10 @@ pub(crate) fn write_ir_file(
225225
let res = std::fs::File::create(clif_file_name).and_then(|mut file| write(&mut file));
226226
if let Err(err) = res {
227227
// Using early_warn as no Session is available here
228-
rustc_session::early_warn(
228+
let handler = rustc_session::EarlyErrorHandler::new(
229229
rustc_session::config::ErrorOutputType::default(),
230-
format!("error writing ir file: {}", err),
231230
);
231+
handler.early_warn(format!("error writing ir file: {}", err));
232232
}
233233
}
234234

src/unsize.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
//! Codegen of the [`PointerCast::Unsize`] operation.
1+
//! Codegen of the [`PointerCoercion::Unsize`] operation.
22
//!
3-
//! [`PointerCast::Unsize`]: `rustc_middle::ty::adjustment::PointerCast::Unsize`
3+
//! [`PointerCoercion::Unsize`]: `rustc_middle::ty::adjustment::PointerCoercion::Unsize`
44
55
use crate::prelude::*;
66

0 commit comments

Comments
 (0)