mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 09:23:05 +00:00
Rustup to rustc 1.40.0-nightly (084beb83e
2019-09-27)
This commit is contained in:
parent
cbd65b24d5
commit
44792f1089
@ -11,7 +11,7 @@ diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
|
||||
index 810a98e..4fdde0e 100644
|
||||
--- a/src/libtest/lib.rs
|
||||
+++ b/src/libtest/lib.rs
|
||||
@@ -1441,11 +1441,11 @@ pub fn run_test(
|
||||
@@ -1441,12 +1441,12 @@ pub fn run_test(
|
||||
return;
|
||||
}
|
||||
|
||||
@ -20,18 +20,26 @@ index 810a98e..4fdde0e 100644
|
||||
desc: TestDesc,
|
||||
monitor_ch: Sender<MonitorMsg>,
|
||||
nocapture: bool,
|
||||
report_time: bool,
|
||||
- testfn: Box<dyn FnOnce() + Send>,
|
||||
+ testfn: F,
|
||||
concurrency: Concurrent,
|
||||
) {
|
||||
// Buffer for capturing standard I/O
|
||||
@@ -1500,15 +1500,14 @@ pub fn run_test(
|
||||
@@ -1500,23 +1500,15 @@ pub fn run_test(
|
||||
(benchfn.clone())(harness)
|
||||
});
|
||||
}
|
||||
- DynTestFn(f) => {
|
||||
- let cb = move || __rust_begin_short_backtrace(f);
|
||||
- run_test_inner(desc, monitor_ch, opts.nocapture, Box::new(cb), concurrency)
|
||||
- run_test_inner(
|
||||
- desc,
|
||||
- monitor_ch,
|
||||
- opts.nocapture,
|
||||
- opts.report_time,
|
||||
- Box::new(cb),
|
||||
- concurrency,
|
||||
- )
|
||||
+ DynTestFn(_f) => {
|
||||
+ unimplemented!();
|
||||
}
|
||||
@ -39,6 +47,7 @@ index 810a98e..4fdde0e 100644
|
||||
desc,
|
||||
monitor_ch,
|
||||
opts.nocapture,
|
||||
opts.report_time,
|
||||
- Box::new(move || __rust_begin_short_backtrace(f)),
|
||||
+ move || __rust_begin_short_backtrace(f),
|
||||
concurrency,
|
||||
@ -46,4 +55,3 @@ index 810a98e..4fdde0e 100644
|
||||
}
|
||||
--
|
||||
2.11.0
|
||||
|
||||
|
@ -30,7 +30,7 @@ fn clif_sig_from_fn_sig<'tcx>(
|
||||
Abi::C => (CallConv::SystemV, sig.inputs().to_vec(), sig.output()),
|
||||
Abi::RustCall => {
|
||||
assert_eq!(sig.inputs().len(), 2);
|
||||
let extra_args = match sig.inputs().last().unwrap().sty {
|
||||
let extra_args = match sig.inputs().last().unwrap().kind {
|
||||
ty::Tuple(ref tupled_arguments) => tupled_arguments,
|
||||
_ => bug!("argument to function with \"rust-call\" ABI is not a tuple"),
|
||||
};
|
||||
@ -177,7 +177,7 @@ impl<'tcx, B: Backend + 'static> FunctionCx<'_, 'tcx, B> {
|
||||
})
|
||||
.unzip();
|
||||
let return_layout = self.layout_of(return_ty);
|
||||
let return_tys = if let ty::Tuple(tup) = return_ty.sty {
|
||||
let return_tys = if let ty::Tuple(tup) = return_ty.kind {
|
||||
tup.types().map(|ty| self.clif_type(ty).unwrap()).collect()
|
||||
} else {
|
||||
vec![self.clif_type(return_ty).unwrap()]
|
||||
@ -255,7 +255,7 @@ pub fn codegen_fn_prelude(fx: &mut FunctionCx<'_, '_, impl Backend>, start_ebb:
|
||||
// to reconstruct it into a tuple local variable, from multiple
|
||||
// individual function arguments.
|
||||
|
||||
let tupled_arg_tys = match arg_ty.sty {
|
||||
let tupled_arg_tys = match arg_ty.kind {
|
||||
ty::Tuple(ref tys) => tys,
|
||||
_ => bug!("spread argument isn't a tuple?! but {:?}", arg_ty),
|
||||
};
|
||||
@ -367,7 +367,7 @@ pub fn codegen_terminator_call<'tcx>(
|
||||
.as_ref()
|
||||
.map(|&(ref place, bb)| (trans_place(fx, place), bb));
|
||||
|
||||
if let ty::FnDef(def_id, substs) = fn_ty.sty {
|
||||
if let ty::FnDef(def_id, substs) = fn_ty.kind {
|
||||
let instance =
|
||||
ty::Instance::resolve(fx.tcx, ty::ParamEnv::reveal_all(), def_id, substs).unwrap();
|
||||
|
||||
@ -405,7 +405,7 @@ pub fn codegen_terminator_call<'tcx>(
|
||||
let pack_arg = trans_operand(fx, &args[1]);
|
||||
let mut args = Vec::new();
|
||||
args.push(self_arg);
|
||||
match pack_arg.layout().ty.sty {
|
||||
match pack_arg.layout().ty.kind {
|
||||
ty::Tuple(ref tupled_arguments) => {
|
||||
for (i, _) in tupled_arguments.iter().enumerate() {
|
||||
args.push(pack_arg.value_field(fx, mir::Field::new(i)));
|
||||
@ -447,7 +447,7 @@ fn codegen_call_inner<'tcx>(
|
||||
.tcx
|
||||
.normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), &fn_ty.fn_sig(fx.tcx));
|
||||
|
||||
let instance = match fn_ty.sty {
|
||||
let instance = match fn_ty.kind {
|
||||
ty::FnDef(def_id, substs) => {
|
||||
Some(Instance::resolve(fx.tcx, ParamEnv::reveal_all(), def_id, substs).unwrap())
|
||||
}
|
||||
@ -562,7 +562,7 @@ pub fn codegen_drop<'tcx>(fx: &mut FunctionCx<'_, 'tcx, impl Backend>, drop_plac
|
||||
// we don't actually need to drop anything
|
||||
} else {
|
||||
let drop_fn_ty = drop_fn.ty(fx.tcx);
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Dynamic(..) => {
|
||||
let (ptr, vtable) = drop_place.to_addr_maybe_unsized(fx);
|
||||
let drop_fn = crate::vtable::drop_fn_of_obj(fx, vtable.unwrap());
|
||||
|
@ -13,14 +13,14 @@ use crate::prelude::*;
|
||||
use syntax::ext::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS};
|
||||
|
||||
/// Returns whether an allocator shim was created
|
||||
pub fn codegen(sess: &Session, module: &mut Module<impl Backend + 'static>) -> bool {
|
||||
let any_dynamic_crate = sess.dependency_formats.borrow().iter().any(|(_, list)| {
|
||||
pub fn codegen(tcx: TyCtxt<'_>, module: &mut Module<impl Backend + 'static>) -> bool {
|
||||
let any_dynamic_crate = tcx.dependency_formats(LOCAL_CRATE).iter().any(|(_, list)| {
|
||||
use rustc::middle::dependency_format::Linkage;
|
||||
list.iter().any(|&linkage| linkage == Linkage::Dynamic)
|
||||
});
|
||||
if any_dynamic_crate {
|
||||
false
|
||||
} else if let Some(kind) = *sess.allocator_kind.get() {
|
||||
} else if let Some(kind) = *tcx.sess.allocator_kind.get() {
|
||||
codegen_inner(module, kind);
|
||||
true
|
||||
} else {
|
||||
|
16
src/base.rs
16
src/base.rs
@ -307,7 +307,7 @@ fn trans_stmt<'tcx>(
|
||||
let val = operand.load_scalar(fx);
|
||||
let res = match un_op {
|
||||
UnOp::Not => {
|
||||
match layout.ty.sty {
|
||||
match layout.ty.kind {
|
||||
ty::Bool => {
|
||||
let val = fx.bcx.ins().uextend(types::I32, val); // WORKAROUND for CraneStation/cranelift#466
|
||||
let res = fx.bcx.ins().icmp_imm(IntCC::Equal, val, 0);
|
||||
@ -317,7 +317,7 @@ fn trans_stmt<'tcx>(
|
||||
_ => unimplemented!("un op Not for {:?}", layout.ty),
|
||||
}
|
||||
}
|
||||
UnOp::Neg => match layout.ty.sty {
|
||||
UnOp::Neg => match layout.ty.kind {
|
||||
ty::Int(_) => {
|
||||
let clif_ty = fx.clif_type(layout.ty).unwrap();
|
||||
if clif_ty == types::I128 {
|
||||
@ -343,7 +343,7 @@ fn trans_stmt<'tcx>(
|
||||
let layout = fx.layout_of(ty);
|
||||
match fx
|
||||
.monomorphize(&operand.ty(&fx.mir.local_decls, fx.tcx))
|
||||
.sty
|
||||
.kind
|
||||
{
|
||||
ty::FnDef(def_id, substs) => {
|
||||
let func_ref = fx.get_function_ref(
|
||||
@ -390,10 +390,10 @@ fn trans_stmt<'tcx>(
|
||||
let (ptr, _extra) = operand.load_scalar_pair(fx);
|
||||
lval.write_cvalue(fx, CValue::by_val(ptr, dest_layout))
|
||||
}
|
||||
} else if let ty::Adt(adt_def, _substs) = from_ty.sty {
|
||||
} else if let ty::Adt(adt_def, _substs) = from_ty.kind {
|
||||
// enum -> discriminant value
|
||||
assert!(adt_def.is_enum());
|
||||
match to_ty.sty {
|
||||
match to_ty.kind {
|
||||
ty::Uint(_) | ty::Int(_) => {}
|
||||
_ => unreachable!("cast adt {} -> {}", from_ty, to_ty),
|
||||
}
|
||||
@ -420,7 +420,7 @@ fn trans_stmt<'tcx>(
|
||||
}
|
||||
Rvalue::Cast(CastKind::Pointer(PointerCast::ClosureFnPointer(_)), operand, _ty) => {
|
||||
let operand = trans_operand(fx, operand);
|
||||
match operand.layout().ty.sty {
|
||||
match operand.layout().ty.kind {
|
||||
ty::Closure(def_id, substs) => {
|
||||
let instance = Instance::resolve_closure(
|
||||
fx.tcx,
|
||||
@ -587,7 +587,7 @@ fn codegen_array_len<'tcx>(
|
||||
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
|
||||
place: CPlace<'tcx>,
|
||||
) -> Value {
|
||||
match place.layout().ty.sty {
|
||||
match place.layout().ty.kind {
|
||||
ty::Array(_elem_ty, len) => {
|
||||
let len = crate::constant::force_eval_const(fx, len)
|
||||
.eval_usize(fx.tcx, ParamEnv::reveal_all()) as i64;
|
||||
@ -647,7 +647,7 @@ pub fn trans_place<'tcx>(
|
||||
// These indices are generated by slice patterns.
|
||||
// slice[from:-to] in Python terms.
|
||||
|
||||
match cplace.layout().ty.sty {
|
||||
match cplace.layout().ty.kind {
|
||||
ty::Array(elem_ty, len) => {
|
||||
let elem_layout = fx.layout_of(elem_ty);
|
||||
let ptr = cplace.to_addr(fx);
|
||||
|
@ -36,7 +36,7 @@ pub fn scalar_to_clif_type(tcx: TyCtxt, scalar: Scalar) -> Type {
|
||||
}
|
||||
|
||||
pub fn clif_type_from_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<types::Type> {
|
||||
Some(match ty.sty {
|
||||
Some(match ty.kind {
|
||||
ty::Bool => types::I8,
|
||||
ty::Uint(size) => match size {
|
||||
UintTy::U8 => types::I8,
|
||||
@ -262,7 +262,7 @@ pub fn type_min_max_value(ty: Type, signed: bool) -> (i64, i64) {
|
||||
}
|
||||
|
||||
pub fn type_sign(ty: Ty<'_>) -> bool {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Ref(..) | ty::RawPtr(..) | ty::FnPtr(..) | ty::Char | ty::Uint(..) | ty::Bool => false,
|
||||
ty::Int(..) => true,
|
||||
ty::Float(..) => false, // `signed` is unused for floats
|
||||
|
@ -103,7 +103,7 @@ pub fn trans_const_value<'tcx>(
|
||||
) -> CValue<'tcx> {
|
||||
let ty = fx.monomorphize(&const_.ty);
|
||||
let layout = fx.layout_of(ty);
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Bool | ty::Uint(_) => {
|
||||
let bits = const_.val.try_to_bits(layout.size).unwrap();
|
||||
CValue::const_val(fx, ty, bits)
|
||||
@ -230,7 +230,7 @@ fn data_id_for_static(
|
||||
.unwrap();
|
||||
|
||||
if linkage == Linkage::Preemptible {
|
||||
if let ty::RawPtr(_) = ty.sty {
|
||||
if let ty::RawPtr(_) = ty.kind {
|
||||
} else {
|
||||
tcx.sess.span_fatal(
|
||||
tcx.def_span(def_id),
|
||||
|
@ -68,7 +68,7 @@ fn run_jit(tcx: TyCtxt<'_>, log: &mut Option<File>) -> ! {
|
||||
.unwrap();
|
||||
|
||||
codegen_cgus(tcx, &mut jit_module, &mut None, log);
|
||||
crate::allocator::codegen(tcx.sess, &mut jit_module);
|
||||
crate::allocator::codegen(tcx, &mut jit_module);
|
||||
jit_module.finalize_definitions();
|
||||
|
||||
tcx.sess.abort_if_errors();
|
||||
@ -101,8 +101,12 @@ fn load_imported_symbols_for_jit(tcx: TyCtxt<'_>) -> Vec<(String, *const u8)> {
|
||||
let mut dylib_paths = Vec::new();
|
||||
|
||||
let crate_info = CrateInfo::new(tcx);
|
||||
let formats = tcx.sess.dependency_formats.borrow();
|
||||
let data = formats.get(&CrateType::Executable).unwrap();
|
||||
let formats = tcx.dependency_formats(LOCAL_CRATE);
|
||||
let data = &formats
|
||||
.iter()
|
||||
.find(|(crate_type, _data)| *crate_type == CrateType::Executable)
|
||||
.unwrap()
|
||||
.1;
|
||||
for &(cnum, _) in &crate_info.used_crates_dynamic {
|
||||
let src = &crate_info.used_crate_source[&cnum];
|
||||
match data[cnum.as_usize() - 1] {
|
||||
@ -167,26 +171,26 @@ fn run_aot(
|
||||
let emit_module = |kind: ModuleKind,
|
||||
mut module: Module<FaerieBackend>,
|
||||
debug: Option<DebugContext>| {
|
||||
module.finalize_definitions();
|
||||
let mut artifact = module.finish().artifact;
|
||||
module.finalize_definitions();
|
||||
let mut artifact = module.finish().artifact;
|
||||
|
||||
if let Some(mut debug) = debug {
|
||||
debug.emit(&mut artifact);
|
||||
}
|
||||
if let Some(mut debug) = debug {
|
||||
debug.emit(&mut artifact);
|
||||
}
|
||||
|
||||
let tmp_file = tcx
|
||||
.output_filenames(LOCAL_CRATE)
|
||||
.temp_path(OutputType::Object, Some(&artifact.name));
|
||||
let obj = artifact.emit().unwrap();
|
||||
std::fs::write(&tmp_file, obj).unwrap();
|
||||
CompiledModule {
|
||||
name: artifact.name,
|
||||
kind,
|
||||
object: Some(tmp_file),
|
||||
bytecode: None,
|
||||
bytecode_compressed: None,
|
||||
}
|
||||
};
|
||||
let tmp_file = tcx
|
||||
.output_filenames(LOCAL_CRATE)
|
||||
.temp_path(OutputType::Object, Some(&artifact.name));
|
||||
let obj = artifact.emit().unwrap();
|
||||
std::fs::write(&tmp_file, obj).unwrap();
|
||||
CompiledModule {
|
||||
name: artifact.name,
|
||||
kind,
|
||||
object: Some(tmp_file),
|
||||
bytecode: None,
|
||||
bytecode_compressed: None,
|
||||
}
|
||||
};
|
||||
|
||||
let mut faerie_module = new_module("some_file".to_string());
|
||||
|
||||
@ -208,7 +212,7 @@ fn run_aot(
|
||||
tcx.sess.abort_if_errors();
|
||||
|
||||
let mut allocator_module = new_module("allocator_shim".to_string());
|
||||
let created_alloc_shim = crate::allocator::codegen(tcx.sess, &mut allocator_module);
|
||||
let created_alloc_shim = crate::allocator::codegen(tcx, &mut allocator_module);
|
||||
|
||||
rustc_incremental::assert_dep_graph(tcx);
|
||||
rustc_incremental::save_dep_graph(tcx);
|
||||
|
@ -213,7 +213,7 @@ macro_rules! simd_cmp {
|
||||
$y,
|
||||
$ret,
|
||||
|fx, lane_layout, res_lane_layout, x_lane, y_lane| {
|
||||
let res_lane = match lane_layout.ty.sty {
|
||||
let res_lane = match lane_layout.ty.kind {
|
||||
ty::Uint(_) | ty::Int(_) => codegen_icmp(fx, IntCC::$cc, x_lane, y_lane),
|
||||
_ => unreachable!("{:?}", lane_layout.ty),
|
||||
};
|
||||
@ -229,7 +229,7 @@ macro_rules! simd_cmp {
|
||||
$y,
|
||||
$ret,
|
||||
|fx, lane_layout, res_lane_layout, x_lane, y_lane| {
|
||||
let res_lane = match lane_layout.ty.sty {
|
||||
let res_lane = match lane_layout.ty.kind {
|
||||
ty::Uint(_) => codegen_icmp(fx, IntCC::$cc_u, x_lane, y_lane),
|
||||
ty::Int(_) => codegen_icmp(fx, IntCC::$cc_s, x_lane, y_lane),
|
||||
_ => unreachable!("{:?}", lane_layout.ty),
|
||||
@ -249,7 +249,7 @@ macro_rules! simd_int_binop {
|
||||
$y,
|
||||
$ret,
|
||||
|fx, lane_layout, ret_lane_layout, x_lane, y_lane| {
|
||||
let res_lane = match lane_layout.ty.sty {
|
||||
let res_lane = match lane_layout.ty.kind {
|
||||
ty::Uint(_) | ty::Int(_) => fx.bcx.ins().$op(x_lane, y_lane),
|
||||
_ => unreachable!("{:?}", lane_layout.ty),
|
||||
};
|
||||
@ -265,7 +265,7 @@ macro_rules! simd_int_binop {
|
||||
$y,
|
||||
$ret,
|
||||
|fx, lane_layout, ret_lane_layout, x_lane, y_lane| {
|
||||
let res_lane = match lane_layout.ty.sty {
|
||||
let res_lane = match lane_layout.ty.kind {
|
||||
ty::Uint(_) => fx.bcx.ins().$op_u(x_lane, y_lane),
|
||||
ty::Int(_) => fx.bcx.ins().$op_s(x_lane, y_lane),
|
||||
_ => unreachable!("{:?}", lane_layout.ty),
|
||||
@ -285,7 +285,7 @@ macro_rules! simd_int_flt_binop {
|
||||
$y,
|
||||
$ret,
|
||||
|fx, lane_layout, ret_lane_layout, x_lane, y_lane| {
|
||||
let res_lane = match lane_layout.ty.sty {
|
||||
let res_lane = match lane_layout.ty.kind {
|
||||
ty::Uint(_) | ty::Int(_) => fx.bcx.ins().$op(x_lane, y_lane),
|
||||
ty::Float(_) => fx.bcx.ins().$op_f(x_lane, y_lane),
|
||||
_ => unreachable!("{:?}", lane_layout.ty),
|
||||
@ -302,7 +302,7 @@ macro_rules! simd_int_flt_binop {
|
||||
$y,
|
||||
$ret,
|
||||
|fx, lane_layout, ret_lane_layout, x_lane, y_lane| {
|
||||
let res_lane = match lane_layout.ty.sty {
|
||||
let res_lane = match lane_layout.ty.kind {
|
||||
ty::Uint(_) => fx.bcx.ins().$op_u(x_lane, y_lane),
|
||||
ty::Int(_) => fx.bcx.ins().$op_s(x_lane, y_lane),
|
||||
ty::Float(_) => fx.bcx.ins().$op_f(x_lane, y_lane),
|
||||
@ -323,7 +323,7 @@ macro_rules! simd_flt_binop {
|
||||
$y,
|
||||
$ret,
|
||||
|fx, lane_layout, ret_lane_layout, x_lane, y_lane| {
|
||||
let res_lane = match lane_layout.ty.sty {
|
||||
let res_lane = match lane_layout.ty.kind {
|
||||
ty::Float(_) => fx.bcx.ins().$op(x_lane, y_lane),
|
||||
_ => unreachable!("{:?}", lane_layout.ty),
|
||||
};
|
||||
|
@ -15,7 +15,6 @@ extern crate rustc_target;
|
||||
extern crate syntax;
|
||||
|
||||
use std::any::Any;
|
||||
use std::sync::mpsc;
|
||||
|
||||
use rustc::dep_graph::DepGraph;
|
||||
use rustc::middle::cstore::{EncodedMetadata, MetadataLoader};
|
||||
@ -200,7 +199,6 @@ impl CodegenBackend for CraneliftCodegenBackend {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
metadata: EncodedMetadata,
|
||||
need_metadata_module: bool,
|
||||
_rx: mpsc::Receiver<Box<dyn Any + Send>>,
|
||||
) -> Box<dyn Any> {
|
||||
rustc_codegen_utils::check_for_rustc_errors_attr(tcx);
|
||||
|
||||
|
@ -87,7 +87,7 @@ pub fn codegen_llvm_intrinsic_call<'tcx>(
|
||||
};
|
||||
|
||||
simd_for_each_lane(fx, intrinsic, x, y, ret, |fx, lane_layout, res_lane_layout, x_lane, y_lane| {
|
||||
let res_lane = match lane_layout.ty.sty {
|
||||
let res_lane = match lane_layout.ty.kind {
|
||||
ty::Float(_) => fx.bcx.ins().fcmp(flt_cc, x_lane, y_lane),
|
||||
_ => unreachable!("{:?}", lane_layout.ty),
|
||||
};
|
||||
|
10
src/num.rs
10
src/num.rs
@ -59,15 +59,15 @@ pub fn codegen_binop<'tcx>(
|
||||
) -> CValue<'tcx> {
|
||||
match bin_op {
|
||||
BinOp::Eq | BinOp::Lt | BinOp::Le | BinOp::Ne | BinOp::Ge | BinOp::Gt => {
|
||||
match in_lhs.layout().ty.sty {
|
||||
match in_lhs.layout().ty.kind {
|
||||
ty::Bool | ty::Uint(_) | ty::Int(_) | ty::Char => {
|
||||
let signed = type_sign(in_lhs.layout().ty);
|
||||
let lhs = in_lhs.load_scalar(fx);
|
||||
let rhs = in_rhs.load_scalar(fx);
|
||||
|
||||
let (lhs, rhs) = if (bin_op == BinOp::Eq || bin_op == BinOp::Ne)
|
||||
&& (in_lhs.layout().ty.sty == fx.tcx.types.i8.sty
|
||||
|| in_lhs.layout().ty.sty == fx.tcx.types.i16.sty)
|
||||
&& (in_lhs.layout().ty.kind == fx.tcx.types.i8.kind
|
||||
|| in_lhs.layout().ty.kind == fx.tcx.types.i16.kind)
|
||||
{
|
||||
// FIXME(CraneStation/cranelift#896) icmp_imm.i8/i16 with eq/ne for signed ints is implemented wrong.
|
||||
(
|
||||
@ -86,7 +86,7 @@ pub fn codegen_binop<'tcx>(
|
||||
_ => {}
|
||||
}
|
||||
|
||||
match in_lhs.layout().ty.sty {
|
||||
match in_lhs.layout().ty.kind {
|
||||
ty::Bool => crate::num::trans_bool_binop(fx, bin_op, in_lhs, in_rhs),
|
||||
ty::Uint(_) | ty::Int(_) => crate::num::trans_int_binop(fx, bin_op, in_lhs, in_rhs),
|
||||
ty::Float(_) => crate::num::trans_float_binop(fx, bin_op, in_lhs, in_rhs),
|
||||
@ -314,7 +314,7 @@ pub fn trans_float_binop<'tcx>(
|
||||
BinOp::Mul => b.fmul(lhs, rhs),
|
||||
BinOp::Div => b.fdiv(lhs, rhs),
|
||||
BinOp::Rem => {
|
||||
let name = match in_lhs.layout().ty.sty {
|
||||
let name = match in_lhs.layout().ty.kind {
|
||||
ty::Float(FloatTy::F32) => "fmodf",
|
||||
ty::Float(FloatTy::F64) => "fmod",
|
||||
_ => bug!(),
|
||||
|
@ -17,7 +17,7 @@ pub fn unsized_info<'tcx>(
|
||||
let (source, target) =
|
||||
fx.tcx
|
||||
.struct_lockstep_tails_erasing_lifetimes(source, target, ParamEnv::reveal_all());
|
||||
match (&source.sty, &target.sty) {
|
||||
match (&source.kind, &target.kind) {
|
||||
(&ty::Array(_, len), &ty::Slice(_)) => fx.bcx.ins().iconst(
|
||||
fx.pointer_type,
|
||||
len.eval_usize(fx.tcx, ParamEnv::reveal_all()) as i64,
|
||||
@ -44,7 +44,7 @@ pub fn unsize_thin_ptr<'tcx>(
|
||||
src_ty: Ty<'tcx>,
|
||||
dst_ty: Ty<'tcx>,
|
||||
) -> (Value, Value) {
|
||||
match (&src_ty.sty, &dst_ty.sty) {
|
||||
match (&src_ty.kind, &dst_ty.kind) {
|
||||
(&ty::Ref(_, a, _), &ty::Ref(_, b, _))
|
||||
| (&ty::Ref(_, a, _), &ty::RawPtr(ty::TypeAndMut { ty: b, .. }))
|
||||
| (&ty::RawPtr(ty::TypeAndMut { ty: a, .. }), &ty::RawPtr(ty::TypeAndMut { ty: b, .. })) => {
|
||||
@ -105,7 +105,7 @@ pub fn coerce_unsized_into<'tcx>(
|
||||
};
|
||||
dst.write_cvalue(fx, CValue::by_val_pair(base, info, dst.layout()));
|
||||
};
|
||||
match (&src_ty.sty, &dst_ty.sty) {
|
||||
match (&src_ty.kind, &dst_ty.kind) {
|
||||
(&ty::Ref(..), &ty::Ref(..))
|
||||
| (&ty::Ref(..), &ty::RawPtr(..))
|
||||
| (&ty::RawPtr(..), &ty::RawPtr(..)) => coerce_ptr(),
|
||||
@ -154,7 +154,7 @@ pub fn size_and_align_of_dst<'tcx>(
|
||||
.iconst(fx.pointer_type, layout.align.abi.bytes() as i64);
|
||||
return (size, align);
|
||||
}
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Dynamic(..) => {
|
||||
// load size/align from vtable
|
||||
(
|
||||
@ -200,7 +200,7 @@ pub fn size_and_align_of_dst<'tcx>(
|
||||
let size = fx.bcx.ins().iadd_imm(unsized_size, sized_size as i64);
|
||||
|
||||
// Packed types ignore the alignment of their fields.
|
||||
if let ty::Adt(def, _) = ty.sty {
|
||||
if let ty::Adt(def, _) = ty.kind {
|
||||
if def.repr.packed() {
|
||||
unsized_align = sized_align;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ fn codegen_field<'tcx>(
|
||||
if !field_layout.is_unsized() {
|
||||
return simple(fx);
|
||||
}
|
||||
match field_layout.ty.sty {
|
||||
match field_layout.ty.kind {
|
||||
ty::Slice(..) | ty::Str | ty::Foreign(..) => return simple(fx),
|
||||
ty::Adt(def, _) if def.repr.packed() => {
|
||||
assert_eq!(layout.align.abi.bytes(), 1);
|
||||
@ -178,7 +178,7 @@ impl<'tcx> CValue<'tcx> {
|
||||
let clif_ty = fx.clif_type(ty).unwrap();
|
||||
let layout = fx.layout_of(ty);
|
||||
|
||||
let val = match ty.sty {
|
||||
let val = match ty.kind {
|
||||
ty::TyKind::Uint(UintTy::U128) | ty::TyKind::Int(IntTy::I128) => {
|
||||
let lsb = fx.bcx.ins().iconst(types::I64, const_val as u64 as i64);
|
||||
let msb = fx
|
||||
@ -350,7 +350,7 @@ impl<'tcx> CPlace<'tcx> {
|
||||
from_ty: Ty<'tcx>,
|
||||
to_ty: Ty<'tcx>,
|
||||
) {
|
||||
match (&from_ty.sty, &to_ty.sty) {
|
||||
match (&from_ty.kind, &to_ty.kind) {
|
||||
(ty::Ref(_, t, MutImmutable), ty::Ref(_, u, MutImmutable))
|
||||
| (ty::Ref(_, t, MutMutable), ty::Ref(_, u, MutImmutable))
|
||||
| (ty::Ref(_, t, MutMutable), ty::Ref(_, u, MutMutable)) => {
|
||||
@ -480,7 +480,7 @@ impl<'tcx> CPlace<'tcx> {
|
||||
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
|
||||
index: Value,
|
||||
) -> CPlace<'tcx> {
|
||||
let (elem_layout, addr) = match self.layout().ty.sty {
|
||||
let (elem_layout, addr) = match self.layout().ty.kind {
|
||||
ty::Array(elem_ty, _) => (fx.layout_of(elem_ty), self.to_addr(fx)),
|
||||
ty::Slice(elem_ty) => (fx.layout_of(elem_ty), self.to_addr_maybe_unsized(fx).0),
|
||||
_ => bug!("place_index({:?})", self.layout().ty),
|
||||
|
Loading…
Reference in New Issue
Block a user