Rustup to rustc 1.48.0-nightly (c59199efc 2020-09-04)

This commit is contained in:
bjorn3 2020-09-05 10:38:49 +02:00
parent c9b0d5119b
commit 217b3818b7
15 changed files with 121 additions and 81 deletions

48
Cargo.lock generated
View File

@ -1,10 +1,16 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "ahash"
version = "0.3.8"
name = "adler"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217"
checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
[[package]]
name = "ahash"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d66721683190aeea775c737eee925aea24719058d86d815e8ee121dd9f37d19"
[[package]]
name = "anyhow"
@ -182,6 +188,18 @@ dependencies = [
"libc",
]
[[package]]
name = "flate2"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "766d0e77a2c1502169d4a93ff3b8c15a71fd946cd0126309752104e5f3c46d94"
dependencies = [
"cfg-if",
"crc32fast",
"libc",
"miniz_oxide",
]
[[package]]
name = "gcc"
version = "0.3.55"
@ -203,10 +221,18 @@ version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34f595585f103464d8d2f6e9864682d74c1601fed5e07d62b1c9058dba8246fb"
dependencies = [
"ahash",
"autocfg",
]
[[package]]
name = "hashbrown"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00d63df3d41950fb462ed38308eea019113ad1508da725bbedcd0fa5a85ef5f7"
dependencies = [
"ahash",
]
[[package]]
name = "indexmap"
version = "1.5.0"
@ -214,7 +240,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b88cd59ee5f71fea89a62248fc8f387d44400cefe05ef548466d61ced9029a7"
dependencies = [
"autocfg",
"hashbrown",
"hashbrown 0.8.1",
]
[[package]]
@ -250,6 +276,15 @@ dependencies = [
"libc",
]
[[package]]
name = "miniz_oxide"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d7559a8a40d0f97e1edea3220f698f78b1c5ab67532e49f68fde3910323b722"
dependencies = [
"adler",
]
[[package]]
name = "object"
version = "0.21.1"
@ -331,8 +366,9 @@ dependencies = [
"cranelift-module",
"cranelift-object",
"cranelift-simplejit",
"flate2",
"gimli",
"hashbrown",
"hashbrown 0.9.0",
"indexmap",
"libloading",
"object",

View File

@ -24,6 +24,7 @@ indexmap = "1.0.2"
cfg-if = "0.1.10"
libloading = { version = "0.6.0", optional = true }
hashbrown = "0.9.0"
flate2 = "1.0.17"
# Uncomment to use local checkout of cranelift
#[patch."https://github.com/bytecodealliance/wasmtime/"]

View File

@ -41,15 +41,15 @@ dependencies = [
[[package]]
name = "autocfg"
version = "1.0.0"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "cc"
version = "1.0.58"
version = "1.0.59"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518"
checksum = "66120af515773fb005778dc07c261bd201ec8ce50bd6e7144c927753fe013381"
[[package]]
name = "cfg-if"
@ -63,9 +63,9 @@ dependencies = [
[[package]]
name = "compiler_builtins"
version = "0.1.32"
version = "0.1.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bc4ac2c824d2bfc612cba57708198547e9a26943af0632aff033e0693074d5c"
checksum = "e3fcd8aba10d17504c87ef12d4f62ef404c6a4703d16682a9eb5543e6cf24455"
dependencies = [
"rustc-std-workspace-core",
]
@ -142,18 +142,18 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.74"
version = "0.2.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2f02823cf78b754822df5f7f268fb59822e7296276d3e069d8e8cb26a14bd10"
checksum = "755456fae044e6fa1ebbbd1b3e902ae19e73097ed4ed87bb79934a867c007bc3"
dependencies = [
"rustc-std-workspace-core",
]
[[package]]
name = "miniz_oxide"
version = "0.4.0"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be0f75932c1f6cfae3c04000e40114adf955636e19040f9c0a2c380702aa1c7f"
checksum = "4d7559a8a40d0f97e1edea3220f698f78b1c5ab67532e49f68fde3910323b722"
dependencies = [
"adler",
"compiler_builtins",

View File

@ -1 +1 @@
nightly-2020-08-23
nightly-2020-09-05

View File

@ -20,14 +20,14 @@ pub(crate) fn fn_sig_for_fn_abi<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx
// FIXME(davidtwco,eddyb): A `ParamEnv` should be passed through to this function.
let ty = instance.ty(tcx, ty::ParamEnv::reveal_all());
match ty.kind {
match *ty.kind() {
ty::FnDef(..) => {
// HACK(davidtwco,eddyb): This is a workaround for polymorphization considering
// parameters unused if they show up in the signature, but not in the `mir::Body`
// (i.e. due to being inside a projection that got normalized, see
// `src/test/ui/polymorphization/normalized_sig_types.rs`), and codegen not keeping
// track of a polymorphization `ParamEnv` to allow normalizing later.
let mut sig = match ty.kind {
let mut sig = match *ty.kind() {
ty::FnDef(def_id, substs) => tcx
.normalize_erasing_regions(tcx.param_env(def_id), tcx.fn_sig(def_id))
.subst(tcx, substs),
@ -65,13 +65,13 @@ pub(crate) fn fn_sig_for_fn_abi<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx
let env_region = ty::ReLateBound(ty::INNERMOST, ty::BrEnv);
let env_ty = tcx.mk_mut_ref(tcx.mk_region(env_region), ty);
let pin_did = tcx.require_lang_item(rustc_hir::LangItem::PinTypeLangItem, None);
let pin_did = tcx.require_lang_item(rustc_hir::LangItem::Pin, None);
let pin_adt_ref = tcx.adt_def(pin_did);
let pin_substs = tcx.intern_substs(&[env_ty.into()]);
let env_ty = tcx.mk_adt(pin_adt_ref, pin_substs);
sig.map_bound(|sig| {
let state_did = tcx.require_lang_item(rustc_hir::LangItem::GeneratorStateLangItem, None);
let state_did = tcx.require_lang_item(rustc_hir::LangItem::GeneratorState, None);
let state_adt_ref = tcx.adt_def(state_did);
let state_substs =
tcx.intern_substs(&[sig.yield_ty.into(), sig.return_ty.into()]);
@ -116,7 +116,7 @@ fn clif_sig_from_fn_sig<'tcx>(
Abi::SysV64 => (CallConv::SystemV, sig.inputs().to_vec(), sig.output()),
Abi::RustCall => {
assert_eq!(sig.inputs().len(), 2);
let extra_args = match sig.inputs().last().unwrap().kind {
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"),
};
@ -307,7 +307,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.kind {
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()]
@ -379,7 +379,7 @@ pub(crate) fn codegen_fn_prelude<'tcx>(
// to reconstruct it into a tuple local variable, from multiple
// individual function arguments.
let tupled_arg_tys = match arg_ty.kind {
let tupled_arg_tys = match arg_ty.kind() {
ty::Tuple(ref tys) => tys,
_ => bug!("spread argument isn't a tuple?! but {:?}", arg_ty),
};
@ -500,7 +500,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
let destination = destination.map(|(place, bb)| (trans_place(fx, place), bb));
// Handle special calls like instrinsics and empty drop glue.
let instance = if let ty::FnDef(def_id, substs) = fn_ty.kind {
let instance = 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()
.unwrap()
@ -553,7 +553,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
let self_arg = trans_operand(fx, &args[0]);
let pack_arg = trans_operand(fx, &args[1]);
let tupled_arguments = match pack_arg.layout().ty.kind {
let tupled_arguments = match pack_arg.layout().ty.kind() {
ty::Tuple(ref tupled_arguments) => tupled_arguments,
_ => bug!("argument to function with \"rust-call\" ABI is not a tuple"),
};
@ -715,7 +715,7 @@ pub(crate) fn codegen_drop<'tcx>(
);
assert_eq!(fn_sig.output(), fx.tcx.mk_unit());
match ty.kind {
match ty.kind() {
ty::Dynamic(..) => {
let (ptr, vtable) = drop_place.to_ptr_maybe_unsized();
let ptr = ptr.get_addr(fx);

View File

@ -281,7 +281,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Backend>) {
let len = trans_operand(fx, len).load_scalar(fx);
let index = trans_operand(fx, index).load_scalar(fx);
args = [index, len, location];
rustc_hir::lang_items::PanicBoundsCheckFnLangItem
rustc_hir::LangItem::PanicBoundsCheck
}
_ => {
let msg_str = msg.description();
@ -291,7 +291,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Backend>) {
.ins()
.iconst(fx.pointer_type, i64::try_from(msg_str.len()).unwrap());
args = [msg_ptr, msg_len, location];
rustc_hir::lang_items::PanicFnLangItem
rustc_hir::LangItem::Panic
}
};
@ -322,7 +322,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Backend>) {
} => {
let discr = trans_operand(fx, discr).load_scalar(fx);
if switch_ty.kind == fx.tcx.types.bool.kind {
if switch_ty.kind() == fx.tcx.types.bool.kind() {
assert_eq!(targets.len(), 2);
let then_block = fx.get_block(targets[0]);
let else_block = fx.get_block(targets[1]);
@ -504,7 +504,7 @@ fn trans_stmt<'tcx>(
let layout = operand.layout();
let val = operand.load_scalar(fx);
let res = match un_op {
UnOp::Not => match layout.ty.kind {
UnOp::Not => match layout.ty.kind() {
ty::Bool => {
let res = fx.bcx.ins().icmp_imm(IntCC::Equal, val, 0);
CValue::by_val(fx.bcx.ins().bint(types::I8, res), layout)
@ -514,7 +514,7 @@ fn trans_stmt<'tcx>(
}
_ => unreachable!("un op Not for {:?}", layout.ty),
},
UnOp::Neg => match layout.ty.kind {
UnOp::Neg => match layout.ty.kind() {
ty::Int(IntTy::I128) => {
// FIXME remove this case once ineg.i128 works
let zero = CValue::const_val(fx, layout, 0);
@ -530,7 +530,7 @@ fn trans_stmt<'tcx>(
Rvalue::Cast(CastKind::Pointer(PointerCast::ReifyFnPointer), operand, to_ty) => {
let from_ty = fx.monomorphize(&operand.ty(&fx.mir.local_decls, fx.tcx));
let to_layout = fx.layout_of(fx.monomorphize(to_ty));
match from_ty.kind {
match *from_ty.kind() {
ty::FnDef(def_id, substs) => {
let func_ref = fx.get_function_ref(
Instance::resolve_for_fn_ptr(
@ -585,10 +585,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.kind {
} else if let ty::Adt(adt_def, _substs) = from_ty.kind() {
// enum -> discriminant value
assert!(adt_def.is_enum());
match to_ty.kind {
match to_ty.kind() {
ty::Uint(_) | ty::Int(_) => {}
_ => unreachable!("cast adt {} -> {}", from_ty, to_ty),
}
@ -658,7 +658,7 @@ fn trans_stmt<'tcx>(
_to_ty,
) => {
let operand = trans_operand(fx, operand);
match operand.layout().ty.kind {
match *operand.layout().ty.kind() {
ty::Closure(def_id, substs) => {
let instance = Instance::resolve_closure(
fx.tcx,
@ -706,8 +706,6 @@ fn trans_stmt<'tcx>(
lval.write_cvalue(fx, CValue::by_val(len, usize_layout));
}
Rvalue::NullaryOp(NullOp::Box, content_ty) => {
use rustc_hir::lang_items::ExchangeMallocFnLangItem;
let usize_type = fx.clif_type(fx.tcx.types.usize).unwrap();
let content_ty = fx.monomorphize(content_ty);
let layout = fx.layout_of(content_ty);
@ -719,7 +717,11 @@ fn trans_stmt<'tcx>(
let box_layout = fx.layout_of(fx.tcx.mk_box(content_ty));
// Allocate space:
let def_id = match fx.tcx.lang_items().require(ExchangeMallocFnLangItem) {
let def_id = match fx
.tcx
.lang_items()
.require(rustc_hir::LangItem::ExchangeMalloc)
{
Ok(id) => id,
Err(s) => {
fx.tcx
@ -868,7 +870,7 @@ fn codegen_array_len<'tcx>(
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
place: CPlace<'tcx>,
) -> Value {
match place.layout().ty.kind {
match *place.layout().ty.kind() {
ty::Array(_elem_ty, len) => {
let len = fx
.monomorphize(&len)
@ -907,11 +909,12 @@ pub(crate) fn trans_place<'tcx>(
min_length: _,
from_end,
} => {
let offset: u64 = offset;
let index = if !from_end {
fx.bcx.ins().iconst(fx.pointer_type, i64::from(offset))
fx.bcx.ins().iconst(fx.pointer_type, offset as i64)
} else {
let len = codegen_array_len(fx, cplace);
fx.bcx.ins().iadd_imm(len, -i64::from(offset))
fx.bcx.ins().iadd_imm(len, -(offset as i64))
};
cplace = cplace.place_index(fx, index);
}
@ -919,13 +922,16 @@ pub(crate) fn trans_place<'tcx>(
// These indices are generated by slice patterns.
// slice[from:-to] in Python terms.
match cplace.layout().ty.kind {
let from: u64 = from;
let to: u64 = to;
match cplace.layout().ty.kind() {
ty::Array(elem_ty, _len) => {
assert!(!from_end, "array subslices are never `from_end`");
let elem_layout = fx.layout_of(elem_ty);
let ptr = cplace.to_ptr();
cplace = CPlace::for_ptr(
ptr.offset_i64(fx, elem_layout.size.bytes() as i64 * i64::from(from)),
ptr.offset_i64(fx, elem_layout.size.bytes() as i64 * (from as i64)),
fx.layout_of(fx.tcx.mk_array(elem_ty, u64::from(to) - u64::from(from))),
);
}
@ -935,10 +941,8 @@ pub(crate) fn trans_place<'tcx>(
let (ptr, len) = cplace.to_ptr_maybe_unsized();
let len = len.unwrap();
cplace = CPlace::for_ptr_with_extra(
ptr.offset_i64(fx, elem_layout.size.bytes() as i64 * i64::from(from)),
fx.bcx
.ins()
.iadd_imm(len, -(i64::from(from) + i64::from(to))),
ptr.offset_i64(fx, elem_layout.size.bytes() as i64 * (from as i64)),
fx.bcx.ins().iadd_imm(len, -(from as i64 + to as i64)),
cplace.layout(),
);
}

View File

@ -31,7 +31,7 @@ pub(crate) fn scalar_to_clif_type(tcx: TyCtxt<'_>, scalar: Scalar) -> Type {
}
fn clif_type_from_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<types::Type> {
Some(match ty.kind {
Some(match ty.kind() {
ty::Bool => types::I8,
ty::Uint(size) => match size {
UintTy::U8 => types::I8,
@ -88,7 +88,7 @@ fn clif_pair_type_from_ty<'tcx>(
tcx: TyCtxt<'tcx>,
ty: Ty<'tcx>,
) -> Option<(types::Type, types::Type)> {
Some(match ty.kind {
Some(match ty.kind() {
ty::Tuple(substs) if substs.len() == 2 => {
let mut types = substs.types();
let a = clif_type_from_ty(tcx, types.next().unwrap())?;
@ -279,7 +279,7 @@ pub(crate) fn type_min_max_value(
}
pub(crate) fn type_sign(ty: Ty<'_>) -> bool {
match ty.kind {
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

View File

@ -170,7 +170,7 @@ impl<'tcx> DebugContext<'tcx> {
let name = format!("{}", ty);
let layout = self.tcx.layout_of(ParamEnv::reveal_all().and(ty)).unwrap();
let type_id = match ty.kind {
let type_id = match ty.kind() {
ty::Bool => primitive(&mut self.dwarf, gimli::DW_ATE_boolean),
ty::Char => primitive(&mut self.dwarf, gimli::DW_ATE_UTF),
ty::Uint(_) => primitive(&mut self.dwarf, gimli::DW_ATE_unsigned),

View File

@ -87,7 +87,7 @@ pub(crate) fn codegen_llvm_intrinsic_call<'tcx>(
};
simd_pair_for_each_lane(fx, x, y, ret, |fx, lane_layout, res_lane_layout, x_lane, y_lane| {
let res_lane = match lane_layout.ty.kind {
let res_lane = match lane_layout.ty.kind() {
ty::Float(_) => fx.bcx.ins().fcmp(flt_cc, x_lane, y_lane),
_ => unreachable!("{:?}", lane_layout.ty),
};

View File

@ -141,7 +141,7 @@ macro atomic_minmax($fx:expr, $cc:expr, <$T:ident> ($ptr:ident, $src:ident) -> $
}
macro validate_atomic_type($fx:ident, $intrinsic:ident, $span:ident, $ty:expr) {
match $ty.kind {
match $ty.kind() {
ty::Uint(_) | ty::Int(_) => {}
_ => {
$fx.tcx.sess.span_err(
@ -302,7 +302,7 @@ macro simd_cmp {
$y,
$ret,
|fx, lane_layout, res_lane_layout, x_lane, y_lane| {
let res_lane = match lane_layout.ty.kind {
let res_lane = match lane_layout.ty.kind() {
ty::Uint(_) | ty::Int(_) => fx.bcx.ins().icmp(IntCC::$cc, x_lane, y_lane),
_ => unreachable!("{:?}", lane_layout.ty),
};
@ -319,7 +319,7 @@ macro simd_cmp {
$y,
$ret,
|fx, lane_layout, res_lane_layout, x_lane, y_lane| {
let res_lane = match lane_layout.ty.kind {
let res_lane = match lane_layout.ty.kind() {
ty::Uint(_) => fx.bcx.ins().icmp(IntCC::$cc_u, x_lane, y_lane),
ty::Int(_) => fx.bcx.ins().icmp(IntCC::$cc_s, x_lane, y_lane),
_ => unreachable!("{:?}", lane_layout.ty),
@ -341,7 +341,7 @@ macro simd_int_binop {
$y,
$ret,
|fx, lane_layout, ret_lane_layout, x_lane, y_lane| {
let res_lane = match lane_layout.ty.kind {
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),
@ -363,7 +363,7 @@ macro simd_int_flt_binop {
$y,
$ret,
|fx, lane_layout, ret_lane_layout, x_lane, y_lane| {
let res_lane = match lane_layout.ty.kind {
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),
@ -382,7 +382,7 @@ macro simd_flt_binop($fx:expr, $op:ident($x:ident, $y:ident) -> $ret:ident) {
$y,
$ret,
|fx, lane_layout, ret_lane_layout, x_lane, y_lane| {
let res_lane = match lane_layout.ty.kind {
let res_lane = match lane_layout.ty.kind() {
ty::Float(_) => fx.bcx.ins().$op(x_lane, y_lane),
_ => unreachable!("{:?}", lane_layout.ty),
};

View File

@ -9,7 +9,6 @@
#![warn(rust_2018_idioms)]
#![warn(unused_lifetimes)]
extern crate flate2;
#[cfg(feature = "jit")]
extern crate libc;
#[macro_use]

View File

@ -1,3 +1,6 @@
use rustc_hir::LangItem;
use rustc_session::config::EntryFnType;
use crate::prelude::*;
/// Create the `main` function which will initialize the rust runtime and call
@ -7,9 +10,6 @@ pub(crate) fn maybe_create_entry_wrapper(
module: &mut Module<impl Backend + 'static>,
unwind_context: &mut UnwindContext<'_>,
) {
use rustc_hir::lang_items::StartFnLangItem;
use rustc_session::config::EntryFnType;
let (main_def_id, use_start_lang_item) = match tcx.entry_fn(LOCAL_CRATE) {
Some((def_id, entry_ty)) => (
def_id.to_def_id(),
@ -88,7 +88,7 @@ pub(crate) fn maybe_create_entry_wrapper(
let main_func_ref = m.declare_func_in_func(main_func_id, &mut bcx.func);
let call_inst = if use_start_lang_item {
let start_def_id = tcx.require_lang_item(StartFnLangItem, None);
let start_def_id = tcx.require_lang_item(LangItem::Start, None);
let start_instance = Instance::resolve(
tcx,
ParamEnv::reveal_all(),

View File

@ -59,15 +59,15 @@ pub(crate) 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.kind {
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.kind == fx.tcx.types.i8.kind
|| in_lhs.layout().ty.kind == fx.tcx.types.i16.kind)
&& (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(crate) fn codegen_binop<'tcx>(
_ => {}
}
match in_lhs.layout().ty.kind {
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),
@ -373,7 +373,7 @@ pub(crate) 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.kind {
let name = match in_lhs.layout().ty.kind() {
ty::Float(FloatTy::F32) => "fmodf",
ty::Float(FloatTy::F64) => "fmod",
_ => bug!(),

View File

@ -17,7 +17,7 @@ pub(crate) fn unsized_info<'tcx>(
let (source, target) =
fx.tcx
.struct_lockstep_tails_erasing_lifetimes(source, target, ParamEnv::reveal_all());
match (&source.kind, &target.kind) {
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,
@ -46,7 +46,7 @@ fn unsize_thin_ptr<'tcx>(
src_layout: TyAndLayout<'tcx>,
dst_layout: TyAndLayout<'tcx>,
) -> (Value, Value) {
match (&src_layout.ty.kind, &dst_layout.ty.kind) {
match (&src_layout.ty.kind(), &dst_layout.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(crate) fn coerce_unsized_into<'tcx>(
};
dst.write_cvalue(fx, CValue::by_val_pair(base, info, dst.layout()));
};
match (&src_ty.kind, &dst_ty.kind) {
match (&src_ty.kind(), &dst_ty.kind()) {
(&ty::Ref(..), &ty::Ref(..))
| (&ty::Ref(..), &ty::RawPtr(..))
| (&ty::RawPtr(..), &ty::RawPtr(..)) => coerce_ptr(),
@ -153,7 +153,7 @@ pub(crate) fn size_and_align_of_dst<'tcx>(
.iconst(fx.pointer_type, layout.align.abi.bytes() as i64);
return (size, align);
}
match layout.ty.kind {
match layout.ty.kind() {
ty::Dynamic(..) => {
// load size/align from vtable
(
@ -199,7 +199,7 @@ pub(crate) 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, _) = layout.ty.kind {
if let ty::Adt(def, _) = layout.ty.kind() {
if def.repr.packed() {
unsized_align = sized_align;
}

View File

@ -24,7 +24,7 @@ fn codegen_field<'tcx>(
if !field_layout.is_unsized() {
return simple(fx);
}
match field_layout.ty.kind {
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);
@ -235,7 +235,7 @@ impl<'tcx> CValue<'tcx> {
let clif_ty = fx.clif_type(layout.ty).unwrap();
match layout.ty.kind {
match layout.ty.kind() {
ty::Bool => {
assert!(
const_val == 0 || const_val == 1,
@ -246,7 +246,7 @@ impl<'tcx> CValue<'tcx> {
_ => {}
}
let val = match layout.ty.kind {
let val = match layout.ty.kind() {
ty::Uint(UintTy::U128) | ty::Int(IntTy::I128) => {
let lsb = fx.bcx.ins().iconst(types::I64, const_val as u64 as i64);
let msb = fx
@ -279,11 +279,11 @@ impl<'tcx> CValue<'tcx> {
pub(crate) fn cast_pointer_to(self, layout: TyAndLayout<'tcx>) -> Self {
assert!(matches!(
self.layout().ty.kind,
self.layout().ty.kind(),
ty::Ref(..) | ty::RawPtr(..) | ty::FnPtr(..)
));
assert!(matches!(
layout.ty.kind,
layout.ty.kind(),
ty::Ref(..) | ty::RawPtr(..) | ty::FnPtr(..)
));
assert_eq!(self.layout().abi, layout.abi);
@ -454,7 +454,7 @@ impl<'tcx> CPlace<'tcx> {
from_ty: Ty<'tcx>,
to_ty: Ty<'tcx>,
) {
match (&from_ty.kind, &to_ty.kind) {
match (&from_ty.kind(), &to_ty.kind()) {
(ty::Ref(_, a, _), ty::Ref(_, b, _))
| (
ty::RawPtr(TypeAndMut { ty: a, mutbl: _ }),
@ -716,7 +716,7 @@ impl<'tcx> CPlace<'tcx> {
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
index: Value,
) -> CPlace<'tcx> {
let (elem_layout, ptr) = match self.layout().ty.kind {
let (elem_layout, ptr) = match self.layout().ty.kind() {
ty::Array(elem_ty, _) => (fx.layout_of(elem_ty), self.to_ptr()),
ty::Slice(elem_ty) => (fx.layout_of(elem_ty), self.to_ptr_maybe_unsized().0),
_ => bug!("place_index({:?})", self.layout().ty),