File tree Expand file tree Collapse file tree 6 files changed +18
-4
lines changed
rustc_codegen_cranelift/example
rustc_codegen_gcc/example Expand file tree Collapse file tree 6 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -567,7 +567,7 @@ pub mod intrinsics {
567567 pub fn copy < T > ( src : * const T , dst : * mut T , count : usize ) ;
568568 pub fn transmute < T , U > ( e : T ) -> U ;
569569 pub fn ctlz_nonzero < T > ( x : T ) -> T ;
570- pub fn needs_drop < T > ( ) -> bool ;
570+ pub fn needs_drop < T : ? :: Sized > ( ) -> bool ;
571571 pub fn bitreverse < T > ( x : T ) -> T ;
572572 pub fn bswap < T > ( x : T ) -> T ;
573573 pub fn write_bytes < T > ( dst : * mut T , val : u8 , count : usize ) ;
Original file line number Diff line number Diff line change @@ -55,6 +55,11 @@ struct NoisyDrop {
5555 inner : NoisyDropInner ,
5656}
5757
58+ struct NoisyDropUnsized {
59+ inner : NoisyDropInner ,
60+ text : str ,
61+ }
62+
5863struct NoisyDropInner ;
5964
6065impl Drop for NoisyDrop {
@@ -170,7 +175,9 @@ fn main() {
170175 assert_eq ! ( intrinsics:: min_align_of_val( & a) as u8 , intrinsics:: min_align_of:: <& str >( ) as u8 ) ;
171176
172177 assert ! ( !intrinsics:: needs_drop:: <u8 >( ) ) ;
178+ assert ! ( !intrinsics:: needs_drop:: <[ u8 ] >( ) ) ;
173179 assert ! ( intrinsics:: needs_drop:: <NoisyDrop >( ) ) ;
180+ assert ! ( intrinsics:: needs_drop:: <NoisyDropUnsized >( ) ) ;
174181
175182 Unique {
176183 pointer : NonNull ( 1 as * mut & str ) ,
Original file line number Diff line number Diff line change @@ -514,7 +514,7 @@ pub mod intrinsics {
514514 pub fn copy < T > ( src : * const T , dst : * mut T , count : usize ) ;
515515 pub fn transmute < T , U > ( e : T ) -> U ;
516516 pub fn ctlz_nonzero < T > ( x : T ) -> T ;
517- pub fn needs_drop < T > ( ) -> bool ;
517+ pub fn needs_drop < T : ? :: Sized > ( ) -> bool ;
518518 pub fn bitreverse < T > ( x : T ) -> T ;
519519 pub fn bswap < T > ( x : T ) -> T ;
520520 pub fn write_bytes < T > ( dst : * mut T , val : u8 , count : usize ) ;
Original file line number Diff line number Diff line change @@ -47,6 +47,11 @@ struct NoisyDrop {
4747 inner : NoisyDropInner ,
4848}
4949
50+ struct NoisyDropUnsized {
51+ inner : NoisyDropInner ,
52+ text : str ,
53+ }
54+
5055struct NoisyDropInner ;
5156
5257impl Drop for NoisyDrop {
@@ -184,7 +189,9 @@ fn main() {
184189 assert_eq ! ( intrinsics:: min_align_of_val( & a) as u8 , intrinsics:: min_align_of:: <& str >( ) as u8 ) ;
185190
186191 assert ! ( !intrinsics:: needs_drop:: <u8 >( ) ) ;
192+ assert ! ( !intrinsics:: needs_drop:: <[ u8 ] >( ) ) ;
187193 assert ! ( intrinsics:: needs_drop:: <NoisyDrop >( ) ) ;
194+ assert ! ( intrinsics:: needs_drop:: <NoisyDropUnsized >( ) ) ;
188195
189196 Unique {
190197 pointer : 0 as * const & str ,
Original file line number Diff line number Diff line change @@ -1162,7 +1162,7 @@ extern "rust-intrinsic" {
11621162 ///
11631163 /// The stabilized version of this intrinsic is [`mem::needs_drop`](crate::mem::needs_drop).
11641164 #[ rustc_const_stable( feature = "const_needs_drop" , since = "1.40.0" ) ]
1165- pub fn needs_drop < T > ( ) -> bool ;
1165+ pub fn needs_drop < T : ? Sized > ( ) -> bool ;
11661166
11671167 /// Calculates the offset from a pointer.
11681168 ///
Original file line number Diff line number Diff line change @@ -592,7 +592,7 @@ pub const unsafe fn align_of_val_raw<T: ?Sized>(val: *const T) -> usize {
592592#[ stable( feature = "needs_drop" , since = "1.21.0" ) ]
593593#[ rustc_const_stable( feature = "const_mem_needs_drop" , since = "1.36.0" ) ]
594594#[ rustc_diagnostic_item = "needs_drop" ]
595- pub const fn needs_drop < T > ( ) -> bool {
595+ pub const fn needs_drop < T : ? Sized > ( ) -> bool {
596596 intrinsics:: needs_drop :: < T > ( )
597597}
598598
You can’t perform that action at this time.
0 commit comments