Rustup to rustc 1.38.0-nightly (dfd52ba6a 2019-07-06)

This commit is contained in:
bjorn3 2019-07-07 11:59:11 +02:00
parent 69591844bb
commit b82472184d
6 changed files with 35 additions and 33 deletions

View File

@ -23,7 +23,6 @@
feature(integer_atomics, stdsimd)
)]
#![cfg_attr(any(unix, target_os = "cloudabi", target_os = "redox"), feature(libc))]
#![rustc_alloc_kind = "lib"]
// The minimum alignment guaranteed by the architecture. This value is used to
// add fast paths for low alignment values.
#[cfg(all(any(target_arch = "x86",

View File

@ -137,10 +137,6 @@ unsafe fn transmute(c: char) -> u32 {
intrinsics::transmute(c)
}
unsafe fn call_uninit() -> u8 {
intrinsics::uninit()
}
unsafe fn deref_str_ptr(s: *const str) -> &'static str {
&*s
}

View File

@ -1,4 +1,4 @@
#![feature(no_core, lang_items, intrinsics, unboxed_closures, type_ascription, extern_types)]
#![feature(no_core, lang_items, intrinsics, unboxed_closures, type_ascription, extern_types, untagged_unions)]
#![no_core]
#![allow(dead_code)]
@ -371,6 +371,11 @@ pub trait Drop {
fn drop(&mut self);
}
pub union MaybeUninit<T> {
pub uninit: (),
pub value: T,
}
pub mod intrinsics {
extern "rust-intrinsic" {
pub fn abort() -> !;
@ -380,7 +385,6 @@ pub mod intrinsics {
pub fn min_align_of_val<T: ?::Sized>(val: &T) -> usize;
pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
pub fn transmute<T, U>(e: T) -> U;
pub fn uninit<T>() -> T;
pub fn init<T>() -> T;
pub fn ctlz_nonzero<T>(x: T) -> T;
pub fn needs_drop<T>() -> bool;

View File

@ -181,15 +181,15 @@ fn main() {
}
unsafe fn uninitialized<T>() -> T {
intrinsics::uninit::<T>()
MaybeUninit { uninit: () }.value
}
zeroed::<(u8, u8)>();
#[allow(unreachable_code)]
{
if false {
zeroed::<!>();
zeroed::<Foo>();
zeroed::<(u8, u8)>();
uninitialized::<Foo>();
}
}

View File

@ -5,7 +5,7 @@ use rustc::mir::interpret::{
};
use rustc::ty::Const;
use rustc_mir::interpret::{
InterpretCx, ImmTy, Machine, Memory, MemoryKind, OpTy, PlaceTy,
InterpCx, ImmTy, Machine, Memory, MemoryKind, OpTy, PlaceTy,
StackPopCleanup,
};
@ -141,10 +141,11 @@ fn trans_const_place<'a, 'tcx: 'a>(
) -> CPlace<'tcx> {
// Adapted from https://github.com/rust-lang/rust/pull/53671/files#diff-e0b58bb6712edaa8595ad7237542c958L551
let result = || -> InterpResult<'tcx, &'tcx Allocation> {
let mut ecx = InterpretCx::new(
let mut ecx = InterpCx::new(
fx.tcx.at(DUMMY_SP),
ty::ParamEnv::reveal_all(),
TransPlaceInterpreter,
(),
);
ecx.push_stack_frame(
fx.instance,
@ -242,7 +243,7 @@ fn define_all_allocs(
module: &mut Module<impl Backend>,
cx: &mut ConstantCx,
) {
let memory = Memory::<TransPlaceInterpreter>::new(tcx.at(DUMMY_SP));
let memory = Memory::<TransPlaceInterpreter>::new(tcx.at(DUMMY_SP), ());
while let Some(todo_item) = pop_set(&mut cx.todo) {
let (data_id, alloc) = match todo_item {
@ -338,23 +339,25 @@ struct TransPlaceInterpreter;
impl<'mir, 'tcx> Machine<'mir, 'tcx> for TransPlaceInterpreter {
type MemoryKinds = !;
type ExtraFnVal = !;
type PointerTag = ();
type AllocExtra = ();
type MemoryExtra = ();
type FrameExtra = ();
type MemoryMap = FxHashMap<AllocId, (MemoryKind<!>, Allocation<()>)>;
const STATIC_KIND: Option<!> = None;
fn enforce_validity(_: &InterpretCx<'mir, 'tcx, Self>) -> bool {
fn enforce_validity(_: &InterpCx<'mir, 'tcx, Self>) -> bool {
false
}
fn before_terminator(_: &mut InterpretCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
fn before_terminator(_: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
panic!();
}
fn find_fn(
_: &mut InterpretCx<'mir, 'tcx, Self>,
_: &mut InterpCx<'mir, 'tcx, Self>,
_: Instance<'tcx>,
_: &[OpTy<'tcx>],
_: Option<PlaceTy<'tcx>>,
@ -364,7 +367,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for TransPlaceInterpreter {
}
fn call_intrinsic(
_: &mut InterpretCx<'mir, 'tcx, Self>,
_: &mut InterpCx<'mir, 'tcx, Self>,
_: Instance<'tcx>,
_: &[OpTy<'tcx>],
_: PlaceTy<'tcx>,
@ -373,14 +376,14 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for TransPlaceInterpreter {
}
fn find_foreign_static(
_: TyCtxt<'tcx>,
_: DefId,
_: ::rustc::ty::query::TyCtxtAt<'tcx>,
) -> InterpResult<'tcx, Cow<'tcx, Allocation>> {
panic!();
}
fn ptr_op(
_: &InterpretCx<'mir, 'tcx, Self>,
_: &InterpCx<'mir, 'tcx, Self>,
_: mir::BinOp,
_: ImmTy<'tcx>,
_: ImmTy<'tcx>,
@ -388,28 +391,38 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for TransPlaceInterpreter {
panic!();
}
fn box_alloc(_: &mut InterpretCx<'mir, 'tcx, Self>, _: PlaceTy<'tcx>) -> InterpResult<'tcx> {
fn box_alloc(_: &mut InterpCx<'mir, 'tcx, Self>, _: PlaceTy<'tcx>) -> InterpResult<'tcx> {
panic!();
}
fn tag_allocation<'b>(
_: &(),
_: AllocId,
alloc: Cow<'b, Allocation>,
_: Option<MemoryKind<!>>,
_: &Memory<'mir, 'tcx, Self>,
) -> (Cow<'b, Allocation<(), ()>>, ()) {
(alloc, ())
}
fn tag_static_base_pointer(_: AllocId, _: &Memory<'mir, 'tcx, Self>) -> Self::PointerTag {
fn tag_static_base_pointer(_: &(), _: AllocId) -> Self::PointerTag {
()
}
fn stack_push(_: &mut InterpretCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
fn call_extra_fn(
_: &mut InterpCx<'mir, 'tcx, Self>,
_: !,
_: &[OpTy<'tcx, ()>],
_: Option<PlaceTy<'tcx, ()>>,
_: Option<BasicBlock>,
) -> InterpResult<'tcx> {
unreachable!();
}
fn stack_push(_: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
Ok(())
}
fn stack_pop(_: &mut InterpretCx<'mir, 'tcx, Self>, _: ()) -> InterpResult<'tcx> {
fn stack_pop(_: &mut InterpCx<'mir, 'tcx, Self>, _: ()) -> InterpResult<'tcx> {
Ok(())
}
}

View File

@ -389,16 +389,6 @@ pub fn codegen_intrinsic_call<'a, 'tcx: 'a>(
let dst_ptr = dst.load_scalar(fx);
fx.bcx.call_memset(fx.module.target_config(), dst_ptr, val, count);
};
uninit, <T> () {
if ret.layout().abi == Abi::Uninhabited {
crate::trap::trap_panic(fx, "[panic] Called intrinsic::uninit for uninhabited type.");
return;
}
let uninit_place = CPlace::new_stack_slot(fx, T);
let uninit_val = uninit_place.to_cvalue(fx);
ret.write_cvalue(fx, uninit_val);
};
ctlz | ctlz_nonzero, <T> (v arg) {
let res = CValue::by_val(fx.bcx.ins().clz(arg), fx.layout_of(T));
ret.write_cvalue(fx, res);