This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ pub trait Pointee {
5757 // NOTE: Keep trait bounds in `static_assert_expected_bounds_for_metadata`
5858 // in `library/core/src/ptr/metadata.rs`
5959 // in sync with those here:
60- type Metadata : Copy + Send + Sync + Ord + Hash + Unpin ;
60+ type Metadata : fmt :: Debug + Copy + Send + Sync + Ord + Hash + Unpin ;
6161}
6262
6363/// Pointers to types implementing this trait alias are “thin”.
Original file line number Diff line number Diff line change @@ -841,11 +841,19 @@ fn ptr_metadata_bounds() {
841841 fn static_assert_expected_bounds_for_metadata < Meta > ( )
842842 where
843843 // Keep this in sync with the associated type in `library/core/src/ptr/metadata.rs`
844- Meta : Copy + Send + Sync + Ord + std:: hash:: Hash + Unpin ,
844+ Meta : Debug + Copy + Send + Sync + Ord + std:: hash:: Hash + Unpin ,
845845 {
846846 }
847847}
848848
849+ #[ test]
850+ fn pointee_metadata_debug ( ) {
851+ assert_eq ! ( "()" , format!( "{:?}" , metadata:: <u32 >( & 17 ) ) ) ;
852+ assert_eq ! ( "2" , format!( "{:?}" , metadata:: <[ u32 ] >( & [ 19 , 23 ] ) ) ) ;
853+ let for_dyn = format ! ( "{:?}" , metadata:: <dyn Debug >( & 29 ) ) ;
854+ assert ! ( for_dyn. starts_with( "DynMetadata(0x" ) , "{:?}" , for_dyn) ;
855+ }
856+
849857#[ test]
850858fn dyn_metadata ( ) {
851859 #[ derive( Debug ) ]
You can’t perform that action at this time.
0 commit comments