File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -1942,8 +1942,12 @@ pub mod tls {
1942
1942
/// This is a callback from libsyntax as it cannot access the implicit state
1943
1943
/// in librustc otherwise
1944
1944
fn span_debug ( span : syntax_pos:: Span , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
1945
- with ( |tcx| {
1946
- write ! ( f, "{}" , tcx. sess. source_map( ) . span_to_string( span) )
1945
+ with_opt ( |tcx| {
1946
+ if let Some ( tcx) = tcx {
1947
+ write ! ( f, "{}" , tcx. sess. source_map( ) . span_to_string( span) )
1948
+ } else {
1949
+ syntax_pos:: default_span_debug ( span, f)
1950
+ }
1947
1951
} )
1948
1952
}
1949
1953
Original file line number Diff line number Diff line change @@ -611,7 +611,7 @@ impl serialize::UseSpecializedDecodable for Span {
611
611
}
612
612
}
613
613
614
- fn default_span_debug ( span : Span , f : & mut fmt:: Formatter ) -> fmt:: Result {
614
+ pub fn default_span_debug ( span : Span , f : & mut fmt:: Formatter ) -> fmt:: Result {
615
615
f. debug_struct ( "Span" )
616
616
. field ( "lo" , & span. lo ( ) )
617
617
. field ( "hi" , & span. hi ( ) )
You can’t perform that action at this time.
0 commit comments