@@ -30,7 +30,7 @@ use crate::fmt;
3030/// Files are compared as strings, not `Path`, which could be unexpected.
3131/// See [`Location::file`]'s documentation for more discussion.
3232#[ lang = "panic_location" ]
33- #[ derive( Copy , Clone , Debug , Eq , Hash , Ord , PartialEq , PartialOrd ) ]
33+ #[ derive( Copy , Clone , Eq , Hash , Ord , PartialEq , PartialOrd ) ]
3434#[ stable( feature = "panic_hooks" , since = "1.10.0" ) ]
3535pub struct Location < ' a > {
3636 // Note: this filename will have exactly one nul byte at its end, but otherwise
@@ -43,6 +43,17 @@ pub struct Location<'a> {
4343 col : u32 ,
4444}
4545
46+ #[ stable( feature = "panic_hooks" , since = "1.10.0" ) ]
47+ impl fmt:: Debug for Location < ' _ > {
48+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
49+ f. debug_struct ( "Location" )
50+ . field ( "file" , & self . file ( ) )
51+ . field ( "line" , & self . line )
52+ . field ( "column" , & self . col )
53+ . finish ( )
54+ }
55+ }
56+
4657impl < ' a > Location < ' a > {
4758 /// Returns the source location of the caller of this function. If that function's caller is
4859 /// annotated then its call location will be returned, and so on up the stack to the first call
0 commit comments