Rustup to rustc 1.43.0-nightly (c20d7eecb 2020-03-11)
This commit is contained in:
parent
b469bf3b08
commit
1c02e6c368
@ -72,14 +72,16 @@ pub struct System;
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
unsafe impl AllocRef for System {
|
||||
#[inline]
|
||||
unsafe fn alloc(&mut self, layout: Layout) -> Result<(NonNull<u8>, usize), AllocErr> {
|
||||
NonNull::new(GlobalAlloc::alloc(self, layout)).ok_or(AllocErr).map(|p| (p, layout.size()))
|
||||
fn alloc(&mut self, layout: Layout) -> Result<(NonNull<u8>, usize), AllocErr> {
|
||||
NonNull::new(unsafe { GlobalAlloc::alloc(self, layout) })
|
||||
.ok_or(AllocErr)
|
||||
.map(|p| (p, layout.size()))
|
||||
}
|
||||
#[inline]
|
||||
unsafe fn alloc_zeroed(&mut self, layout: Layout) -> Result<(NonNull<u8>, usize), AllocErr> {
|
||||
NonNull::new(GlobalAlloc::alloc_zeroed(self, layout))
|
||||
.ok_or(AllocErr)
|
||||
.map(|p| (p, layout.size()))
|
||||
fn alloc_zeroed(&mut self, layout: Layout) -> Result<(NonNull<u8>, usize), AllocErr> {
|
||||
NonNull::new(unsafe { GlobalAlloc::alloc_zeroed(self, layout) })
|
||||
.ok_or(AllocErr)
|
||||
.map(|p| (p, layout.size()))
|
||||
}
|
||||
#[inline]
|
||||
unsafe fn dealloc(&mut self, ptr: NonNull<u8>, layout: Layout) {
|
||||
|
@ -1 +1 @@
|
||||
nightly-2020-03-10
|
||||
nightly-2020-03-12
|
||||
|
@ -485,7 +485,6 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for TransPlaceInterpreter {
|
||||
|
||||
fn assert_panic(
|
||||
_: &mut InterpCx<'mir, 'tcx, Self>,
|
||||
_: Span,
|
||||
_: &mir::AssertKind<Operand<'tcx>>,
|
||||
_: Option<BasicBlock>,
|
||||
) -> InterpResult<'tcx> {
|
||||
|
@ -813,9 +813,20 @@ pub fn codegen_intrinsic_call<'tcx>(
|
||||
let res = CValue::by_val(swap(&mut fx.bcx, arg), fx.layout_of(T));
|
||||
ret.write_cvalue(fx, res);
|
||||
};
|
||||
panic_if_uninhabited, <T> () {
|
||||
if fx.layout_of(T).abi.is_uninhabited() {
|
||||
crate::trap::trap_panic(fx, "[panic] Called intrinsic::panic_if_uninhabited for uninhabited type.");
|
||||
panic_if_uninhabited | panic_if_zero_invalid | panic_if_any_invalid, <T> () {
|
||||
let layout = fx.layout_of(T);
|
||||
if layout.abi.is_uninhabited() {
|
||||
crate::trap::trap_panic(fx, &format!("attempted to instantiate uninhabited type `{}`", T));
|
||||
return;
|
||||
}
|
||||
|
||||
if intrinsic == "panic_if_zero_invalid" && !layout.might_permit_raw_init(fx, /*zero:*/ true).unwrap() {
|
||||
crate::trap::trap_panic(fx, &format!("attempted to zero-initialize type `{}`, which is invalid", T));
|
||||
return;
|
||||
}
|
||||
|
||||
if intrinsic == "panic_if_any_invalid" && !layout.might_permit_raw_init(fx, /*zero:*/ false).unwrap() {
|
||||
crate::trap::trap_panic(fx, &format!("attempted to leave type `{}` uninitialized, which is invalid", T));
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user