From fd38f663cd2e4880e09430dc56b91497b3f97412 Mon Sep 17 00:00:00 2001 From: Nikolai Vazquez Date: Fri, 3 Jun 2022 03:28:19 -0400 Subject: Make `std::mem::needs_drop` accept `?Sized` --- compiler/rustc_codegen_gcc/example/mini_core.rs | 2 +- compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_codegen_gcc') diff --git a/compiler/rustc_codegen_gcc/example/mini_core.rs b/compiler/rustc_codegen_gcc/example/mini_core.rs index a8435287d9f..ddcbb0d9fc7 100644 --- a/compiler/rustc_codegen_gcc/example/mini_core.rs +++ b/compiler/rustc_codegen_gcc/example/mini_core.rs @@ -514,7 +514,7 @@ pub mod intrinsics { pub fn copy(src: *const T, dst: *mut T, count: usize); pub fn transmute(e: T) -> U; pub fn ctlz_nonzero(x: T) -> T; - pub fn needs_drop() -> bool; + pub fn needs_drop() -> bool; pub fn bitreverse(x: T) -> T; pub fn bswap(x: T) -> T; pub fn write_bytes(dst: *mut T, val: u8, count: usize); diff --git a/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs b/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs index 69d591565ac..5ca63f270ea 100644 --- a/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs +++ b/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs @@ -47,6 +47,11 @@ struct NoisyDrop { inner: NoisyDropInner, } +struct NoisyDropUnsized { + text: str, + inner: NoisyDropInner, +} + struct NoisyDropInner; impl Drop for NoisyDrop { @@ -184,7 +189,9 @@ fn main() { assert_eq!(intrinsics::min_align_of_val(&a) as u8, intrinsics::min_align_of::<&str>() as u8); assert!(!intrinsics::needs_drop::()); + assert!(!intrinsics::needs_drop::<[u8]>()); assert!(intrinsics::needs_drop::()); + assert!(intrinsics::needs_drop::()); Unique { pointer: 0 as *const &str, -- cgit 1.4.1-3-g733a5 From 24b1b7c8a8dbd4af9556fb3748f6d37d5755d39a Mon Sep 17 00:00:00 2001 From: Nikolai Vazquez Date: Fri, 3 Jun 2022 12:58:36 -0400 Subject: Fix unsized field order --- compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs | 2 +- compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_codegen_gcc') diff --git a/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs b/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs index 059f62f7bf8..0f1245c2758 100644 --- a/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs +++ b/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs @@ -56,8 +56,8 @@ struct NoisyDrop { } struct NoisyDropUnsized { - text: str, inner: NoisyDropInner, + text: str, } struct NoisyDropInner; diff --git a/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs b/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs index 5ca63f270ea..14fd9eeffa6 100644 --- a/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs +++ b/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs @@ -48,8 +48,8 @@ struct NoisyDrop { } struct NoisyDropUnsized { - text: str, inner: NoisyDropInner, + text: str, } struct NoisyDropInner; -- cgit 1.4.1-3-g733a5