Merge commit 'c19edfd71a
' into sync_cg_clif-2022-07-25
This commit is contained in:
commit
7a3ed235eb
24 changed files with 473 additions and 219 deletions
|
@ -458,7 +458,7 @@ pub trait FnMut<Args>: FnOnce<Args> {
|
|||
|
||||
#[lang = "panic"]
|
||||
#[track_caller]
|
||||
pub fn panic(_msg: &str) -> ! {
|
||||
pub fn panic(_msg: &'static str) -> ! {
|
||||
unsafe {
|
||||
libc::puts("Panicking\n\0" as *const str as *const i8);
|
||||
intrinsics::abort();
|
||||
|
@ -497,7 +497,7 @@ pub trait Deref {
|
|||
#[repr(transparent)]
|
||||
#[rustc_layout_scalar_valid_range_start(1)]
|
||||
#[rustc_nonnull_optimization_guaranteed]
|
||||
pub struct NonNull<T: ?Sized>(pub *mut T);
|
||||
pub struct NonNull<T: ?Sized>(pub *const 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> {}
|
||||
|
@ -521,7 +521,7 @@ impl<T: ?Sized> Drop for Box<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> Deref for Box<T> {
|
||||
impl<T: ?Sized> Deref for Box<T> {
|
||||
type Target = T;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
|
|
|
@ -124,6 +124,23 @@ fn call_return_u128_pair() {
|
|||
return_u128_pair();
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct bool_11 {
|
||||
field0: bool,
|
||||
field1: bool,
|
||||
field2: bool,
|
||||
field3: bool,
|
||||
field4: bool,
|
||||
field5: bool,
|
||||
field6: bool,
|
||||
field7: bool,
|
||||
field8: bool,
|
||||
field9: bool,
|
||||
field10: bool,
|
||||
}
|
||||
|
||||
extern "C" fn bool_struct_in_11(arg0: bool_11) {}
|
||||
|
||||
#[allow(unreachable_code)] // FIXME false positive
|
||||
fn main() {
|
||||
take_unique(Unique {
|
||||
|
@ -134,6 +151,20 @@ fn main() {
|
|||
|
||||
call_return_u128_pair();
|
||||
|
||||
bool_struct_in_11(bool_11 {
|
||||
field0: true,
|
||||
field1: true,
|
||||
field2: true,
|
||||
field3: true,
|
||||
field4: true,
|
||||
field5: true,
|
||||
field6: true,
|
||||
field7: true,
|
||||
field8: true,
|
||||
field9: true,
|
||||
field10: true,
|
||||
});
|
||||
|
||||
let slice = &[0, 1] as &[i32];
|
||||
let slice_ptr = slice as *const [i32] as *const i32;
|
||||
|
||||
|
@ -299,6 +330,17 @@ fn main() {
|
|||
static REF1: &u8 = &42;
|
||||
static REF2: &u8 = REF1;
|
||||
assert_eq!(*REF1, *REF2);
|
||||
|
||||
extern "C" {
|
||||
type A;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x: &A = unsafe { &*(1usize as *const A) };
|
||||
|
||||
assert_eq!(unsafe { intrinsics::size_of_val(x) }, 0);
|
||||
assert_eq!(unsafe { intrinsics::min_align_of_val(x) }, 1);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(not(jit), target_arch = "x86_64", target_os = "linux"))]
|
||||
|
|
|
@ -128,6 +128,25 @@ fn main() {
|
|||
0 => loop {},
|
||||
v => panic(v),
|
||||
};
|
||||
|
||||
if black_box(false) {
|
||||
// Based on https://github.com/rust-lang/rust/blob/2f320a224e827b400be25966755a621779f797cc/src/test/ui/debuginfo/debuginfo_with_uninhabitable_field_and_unsized.rs
|
||||
let _ = Foo::<dyn Send>::new();
|
||||
|
||||
#[allow(dead_code)]
|
||||
struct Foo<T: ?Sized> {
|
||||
base: Never,
|
||||
value: T,
|
||||
}
|
||||
|
||||
impl<T: ?Sized> Foo<T> {
|
||||
pub fn new() -> Box<Foo<T>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
enum Never {}
|
||||
}
|
||||
}
|
||||
|
||||
fn panic(_: u128) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue