File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ pub trait Pointee {
57
57
// NOTE: Keep trait bounds in `static_assert_expected_bounds_for_metadata`
58
58
// in `library/core/src/ptr/metadata.rs`
59
59
// 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 ;
61
61
}
62
62
63
63
/// 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() {
841
841
fn static_assert_expected_bounds_for_metadata < Meta > ( )
842
842
where
843
843
// 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 ,
845
845
{
846
846
}
847
847
}
848
848
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
+
849
857
#[ test]
850
858
fn dyn_metadata ( ) {
851
859
#[ derive( Debug ) ]
You can’t perform that action at this time.
0 commit comments