Rustup to rustc 1.62.0-nightly (879aff385
2022-04-20)
This commit is contained in:
parent
acb32e6eb5
commit
f2cdd4a78d
6 changed files with 28 additions and 11 deletions
5
build_sysroot/Cargo.lock
generated
5
build_sysroot/Cargo.lock
generated
|
@ -134,9 +134,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.121"
|
||||
version = "0.2.124"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f"
|
||||
checksum = "21a41fed9d98f27ab1c6d161da622a4fa35e8a54a8adc24bbf3ddd0ef70b0e50"
|
||||
dependencies = [
|
||||
"rustc-std-workspace-core",
|
||||
]
|
||||
|
@ -203,6 +203,7 @@ dependencies = [
|
|||
name = "proc_macro"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"core",
|
||||
"std",
|
||||
]
|
||||
|
||||
|
|
|
@ -494,13 +494,20 @@ pub trait Deref {
|
|||
fn deref(&self) -> &Self::Target;
|
||||
}
|
||||
|
||||
#[repr(transparent)]
|
||||
#[rustc_layout_scalar_valid_range_start(1)]
|
||||
#[rustc_nonnull_optimization_guaranteed]
|
||||
pub struct NonNull<T: ?Sized>(pub *mut T);
|
||||
|
||||
impl<T: ?Sized, U: ?Sized> CoerceUnsized<NonNull<U>> for NonNull<T> where T: Unsize<U> {}
|
||||
impl<T: ?Sized, U: ?Sized> DispatchFromDyn<NonNull<U>> for NonNull<T> where T: Unsize<U> {}
|
||||
|
||||
pub struct Unique<T: ?Sized> {
|
||||
pub pointer: *const T,
|
||||
pub pointer: NonNull<T>,
|
||||
pub _marker: PhantomData<T>,
|
||||
}
|
||||
|
||||
impl<T: ?Sized, U: ?Sized> CoerceUnsized<Unique<U>> for Unique<T> where T: Unsize<U> {}
|
||||
|
||||
impl<T: ?Sized, U: ?Sized> DispatchFromDyn<Unique<U>> for Unique<T> where T: Unsize<U> {}
|
||||
|
||||
#[lang = "owned_box"]
|
||||
|
@ -529,7 +536,7 @@ unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
|
|||
|
||||
#[lang = "box_free"]
|
||||
unsafe fn box_free<T: ?Sized>(ptr: Unique<T>, alloc: ()) {
|
||||
libc::free(ptr.pointer as *mut u8);
|
||||
libc::free(ptr.pointer.0 as *mut u8);
|
||||
}
|
||||
|
||||
#[lang = "drop"]
|
||||
|
|
|
@ -122,7 +122,7 @@ fn call_return_u128_pair() {
|
|||
#[allow(unreachable_code)] // FIXME false positive
|
||||
fn main() {
|
||||
take_unique(Unique {
|
||||
pointer: 0 as *const (),
|
||||
pointer: unsafe { NonNull(1 as *mut ()) },
|
||||
_marker: PhantomData,
|
||||
});
|
||||
take_f32(0.1);
|
||||
|
@ -173,7 +173,7 @@ fn main() {
|
|||
assert!(intrinsics::needs_drop::<NoisyDrop>());
|
||||
|
||||
Unique {
|
||||
pointer: 0 as *const &str,
|
||||
pointer: NonNull(1 as *mut &str),
|
||||
_marker: PhantomData,
|
||||
} as Unique<dyn SomeTrait>;
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[toolchain]
|
||||
channel = "nightly-2022-04-05"
|
||||
channel = "nightly-2022-04-21"
|
||||
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
||||
|
|
|
@ -821,7 +821,8 @@ pub(crate) fn codegen_place<'tcx>(
|
|||
if cplace.layout().ty.is_box() {
|
||||
cplace = cplace
|
||||
.place_field(fx, Field::new(0)) // Box<T> -> Unique<T>
|
||||
.place_field(fx, Field::new(0)) // Unique<T> -> *const T
|
||||
.place_field(fx, Field::new(0)) // Unique<T> -> NonNull<T>
|
||||
.place_field(fx, Field::new(0)) // NonNull<T> -> *mut T
|
||||
.place_deref(fx);
|
||||
} else {
|
||||
cplace = cplace.place_deref(fx);
|
||||
|
|
|
@ -128,8 +128,16 @@ pub(crate) fn codegen_get_discriminant<'tcx>(
|
|||
let relative_discr = if niche_start == 0 {
|
||||
tag
|
||||
} else {
|
||||
// FIXME handle niche_start > i64::MAX
|
||||
fx.bcx.ins().iadd_imm(tag, -i64::try_from(niche_start).unwrap())
|
||||
let niche_start = match fx.bcx.func.dfg.value_type(tag) {
|
||||
types::I128 => {
|
||||
let lsb = fx.bcx.ins().iconst(types::I64, niche_start as u64 as i64);
|
||||
let msb =
|
||||
fx.bcx.ins().iconst(types::I64, (niche_start >> 64) as u64 as i64);
|
||||
fx.bcx.ins().iconcat(lsb, msb)
|
||||
}
|
||||
ty => fx.bcx.ins().iconst(ty, niche_start as i64),
|
||||
};
|
||||
fx.bcx.ins().isub(tag, niche_start)
|
||||
};
|
||||
let relative_max = niche_variants.end().as_u32() - niche_variants.start().as_u32();
|
||||
let is_niche = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue