Skip to content

Commit b824721

Browse files
committed
Rustup to rustc 1.38.0-nightly (dfd52ba6a 2019-07-06)
1 parent 6959184 commit b824721

File tree

6 files changed

+35
-33
lines changed

6 files changed

+35
-33
lines changed

build_sysroot/alloc_system/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
feature(integer_atomics, stdsimd)
2424
)]
2525
#![cfg_attr(any(unix, target_os = "cloudabi", target_os = "redox"), feature(libc))]
26-
#![rustc_alloc_kind = "lib"]
2726
// The minimum alignment guaranteed by the architecture. This value is used to
2827
// add fast paths for low alignment values.
2928
#[cfg(all(any(target_arch = "x86",

example/example.rs

-4
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,6 @@ unsafe fn transmute(c: char) -> u32 {
137137
intrinsics::transmute(c)
138138
}
139139

140-
unsafe fn call_uninit() -> u8 {
141-
intrinsics::uninit()
142-
}
143-
144140
unsafe fn deref_str_ptr(s: *const str) -> &'static str {
145141
&*s
146142
}

example/mini_core.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(no_core, lang_items, intrinsics, unboxed_closures, type_ascription, extern_types)]
1+
#![feature(no_core, lang_items, intrinsics, unboxed_closures, type_ascription, extern_types, untagged_unions)]
22
#![no_core]
33
#![allow(dead_code)]
44

@@ -371,6 +371,11 @@ pub trait Drop {
371371
fn drop(&mut self);
372372
}
373373

374+
pub union MaybeUninit<T> {
375+
pub uninit: (),
376+
pub value: T,
377+
}
378+
374379
pub mod intrinsics {
375380
extern "rust-intrinsic" {
376381
pub fn abort() -> !;
@@ -380,7 +385,6 @@ pub mod intrinsics {
380385
pub fn min_align_of_val<T: ?::Sized>(val: &T) -> usize;
381386
pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
382387
pub fn transmute<T, U>(e: T) -> U;
383-
pub fn uninit<T>() -> T;
384388
pub fn init<T>() -> T;
385389
pub fn ctlz_nonzero<T>(x: T) -> T;
386390
pub fn needs_drop<T>() -> bool;

example/mini_core_hello_world.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,15 @@ fn main() {
181181
}
182182

183183
unsafe fn uninitialized<T>() -> T {
184-
intrinsics::uninit::<T>()
184+
MaybeUninit { uninit: () }.value
185185
}
186186

187+
zeroed::<(u8, u8)>();
187188
#[allow(unreachable_code)]
188189
{
189190
if false {
190191
zeroed::<!>();
191192
zeroed::<Foo>();
192-
zeroed::<(u8, u8)>();
193193
uninitialized::<Foo>();
194194
}
195195
}

src/constant.rs

+27-14
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc::mir::interpret::{
55
};
66
use rustc::ty::Const;
77
use rustc_mir::interpret::{
8-
InterpretCx, ImmTy, Machine, Memory, MemoryKind, OpTy, PlaceTy,
8+
InterpCx, ImmTy, Machine, Memory, MemoryKind, OpTy, PlaceTy,
99
StackPopCleanup,
1010
};
1111

@@ -141,10 +141,11 @@ fn trans_const_place<'a, 'tcx: 'a>(
141141
) -> CPlace<'tcx> {
142142
// Adapted from https://github.com/rust-lang/rust/pull/53671/files#diff-e0b58bb6712edaa8595ad7237542c958L551
143143
let result = || -> InterpResult<'tcx, &'tcx Allocation> {
144-
let mut ecx = InterpretCx::new(
144+
let mut ecx = InterpCx::new(
145145
fx.tcx.at(DUMMY_SP),
146146
ty::ParamEnv::reveal_all(),
147147
TransPlaceInterpreter,
148+
(),
148149
);
149150
ecx.push_stack_frame(
150151
fx.instance,
@@ -242,7 +243,7 @@ fn define_all_allocs(
242243
module: &mut Module<impl Backend>,
243244
cx: &mut ConstantCx,
244245
) {
245-
let memory = Memory::<TransPlaceInterpreter>::new(tcx.at(DUMMY_SP));
246+
let memory = Memory::<TransPlaceInterpreter>::new(tcx.at(DUMMY_SP), ());
246247

247248
while let Some(todo_item) = pop_set(&mut cx.todo) {
248249
let (data_id, alloc) = match todo_item {
@@ -338,23 +339,25 @@ struct TransPlaceInterpreter;
338339

339340
impl<'mir, 'tcx> Machine<'mir, 'tcx> for TransPlaceInterpreter {
340341
type MemoryKinds = !;
342+
type ExtraFnVal = !;
341343
type PointerTag = ();
342344
type AllocExtra = ();
343345
type MemoryExtra = ();
344346
type FrameExtra = ();
345347
type MemoryMap = FxHashMap<AllocId, (MemoryKind<!>, Allocation<()>)>;
348+
346349
const STATIC_KIND: Option<!> = None;
347350

348-
fn enforce_validity(_: &InterpretCx<'mir, 'tcx, Self>) -> bool {
351+
fn enforce_validity(_: &InterpCx<'mir, 'tcx, Self>) -> bool {
349352
false
350353
}
351354

352-
fn before_terminator(_: &mut InterpretCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
355+
fn before_terminator(_: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
353356
panic!();
354357
}
355358

356359
fn find_fn(
357-
_: &mut InterpretCx<'mir, 'tcx, Self>,
360+
_: &mut InterpCx<'mir, 'tcx, Self>,
358361
_: Instance<'tcx>,
359362
_: &[OpTy<'tcx>],
360363
_: Option<PlaceTy<'tcx>>,
@@ -364,7 +367,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for TransPlaceInterpreter {
364367
}
365368

366369
fn call_intrinsic(
367-
_: &mut InterpretCx<'mir, 'tcx, Self>,
370+
_: &mut InterpCx<'mir, 'tcx, Self>,
368371
_: Instance<'tcx>,
369372
_: &[OpTy<'tcx>],
370373
_: PlaceTy<'tcx>,
@@ -373,43 +376,53 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for TransPlaceInterpreter {
373376
}
374377

375378
fn find_foreign_static(
379+
_: TyCtxt<'tcx>,
376380
_: DefId,
377-
_: ::rustc::ty::query::TyCtxtAt<'tcx>,
378381
) -> InterpResult<'tcx, Cow<'tcx, Allocation>> {
379382
panic!();
380383
}
381384

382385
fn ptr_op(
383-
_: &InterpretCx<'mir, 'tcx, Self>,
386+
_: &InterpCx<'mir, 'tcx, Self>,
384387
_: mir::BinOp,
385388
_: ImmTy<'tcx>,
386389
_: ImmTy<'tcx>,
387390
) -> InterpResult<'tcx, (Scalar, bool)> {
388391
panic!();
389392
}
390393

391-
fn box_alloc(_: &mut InterpretCx<'mir, 'tcx, Self>, _: PlaceTy<'tcx>) -> InterpResult<'tcx> {
394+
fn box_alloc(_: &mut InterpCx<'mir, 'tcx, Self>, _: PlaceTy<'tcx>) -> InterpResult<'tcx> {
392395
panic!();
393396
}
394397

395398
fn tag_allocation<'b>(
399+
_: &(),
396400
_: AllocId,
397401
alloc: Cow<'b, Allocation>,
398402
_: Option<MemoryKind<!>>,
399-
_: &Memory<'mir, 'tcx, Self>,
400403
) -> (Cow<'b, Allocation<(), ()>>, ()) {
401404
(alloc, ())
402405
}
403406

404-
fn tag_static_base_pointer(_: AllocId, _: &Memory<'mir, 'tcx, Self>) -> Self::PointerTag {
407+
fn tag_static_base_pointer(_: &(), _: AllocId) -> Self::PointerTag {
405408
()
406409
}
407410

408-
fn stack_push(_: &mut InterpretCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
411+
fn call_extra_fn(
412+
_: &mut InterpCx<'mir, 'tcx, Self>,
413+
_: !,
414+
_: &[OpTy<'tcx, ()>],
415+
_: Option<PlaceTy<'tcx, ()>>,
416+
_: Option<BasicBlock>,
417+
) -> InterpResult<'tcx> {
418+
unreachable!();
419+
}
420+
421+
fn stack_push(_: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
409422
Ok(())
410423
}
411424

412-
fn stack_pop(_: &mut InterpretCx<'mir, 'tcx, Self>, _: ()) -> InterpResult<'tcx> {
425+
fn stack_pop(_: &mut InterpCx<'mir, 'tcx, Self>, _: ()) -> InterpResult<'tcx> {
413426
Ok(())
414427
}
415428
}

src/intrinsics.rs

-10
Original file line numberDiff line numberDiff line change
@@ -389,16 +389,6 @@ pub fn codegen_intrinsic_call<'a, 'tcx: 'a>(
389389
let dst_ptr = dst.load_scalar(fx);
390390
fx.bcx.call_memset(fx.module.target_config(), dst_ptr, val, count);
391391
};
392-
uninit, <T> () {
393-
if ret.layout().abi == Abi::Uninhabited {
394-
crate::trap::trap_panic(fx, "[panic] Called intrinsic::uninit for uninhabited type.");
395-
return;
396-
}
397-
398-
let uninit_place = CPlace::new_stack_slot(fx, T);
399-
let uninit_val = uninit_place.to_cvalue(fx);
400-
ret.write_cvalue(fx, uninit_val);
401-
};
402392
ctlz | ctlz_nonzero, <T> (v arg) {
403393
let res = CValue::by_val(fx.bcx.ins().clz(arg), fx.layout_of(T));
404394
ret.write_cvalue(fx, res);

0 commit comments

Comments
 (0)