@@ -161,6 +161,7 @@ struct BacktraceSymbol {
161161 name : Option < Vec < u8 > > ,
162162 filename : Option < BytesOrWide > ,
163163 lineno : Option < u32 > ,
164+ colno : Option < u32 > ,
164165}
165166
166167enum BytesOrWide {
@@ -197,6 +198,10 @@ impl fmt::Debug for Backtrace {
197198
198199impl fmt:: Debug for BacktraceSymbol {
199200 fn fmt ( & self , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
201+ // FIXME: improve formatting: https://github.com/rust-lang/rust/issues/65280
202+ // FIXME: Also, include column numbers into the debug format as Display already has them.
203+ // Until there are stable per-frame accessors, the format shouldn't be changed:
204+ // https://github.com/rust-lang/rust/issues/65280#issuecomment-638966585
200205 write ! ( fmt, "{{ " ) ?;
201206
202207 if let Some ( fn_name) = self . name . as_ref ( ) . map ( |b| backtrace_rs:: SymbolName :: new ( b) ) {
@@ -209,7 +214,7 @@ impl fmt::Debug for BacktraceSymbol {
209214 write ! ( fmt, ", file: \" {:?}\" " , fname) ?;
210215 }
211216
212- if let Some ( line) = self . lineno . as_ref ( ) {
217+ if let Some ( line) = self . lineno {
213218 write ! ( fmt, ", line: {:?}" , line) ?;
214219 }
215220
@@ -381,14 +386,15 @@ impl fmt::Display for Backtrace {
381386 f. print_raw ( frame. frame . ip ( ) , None , None , None ) ?;
382387 } else {
383388 for symbol in frame. symbols . iter ( ) {
384- f. print_raw (
389+ f. print_raw_with_column (
385390 frame. frame . ip ( ) ,
386391 symbol. name . as_ref ( ) . map ( |b| backtrace_rs:: SymbolName :: new ( b) ) ,
387392 symbol. filename . as_ref ( ) . map ( |b| match b {
388393 BytesOrWide :: Bytes ( w) => BytesOrWideString :: Bytes ( w) ,
389394 BytesOrWide :: Wide ( w) => BytesOrWideString :: Wide ( w) ,
390395 } ) ,
391396 symbol. lineno ,
397+ symbol. colno ,
392398 ) ?;
393399 }
394400 }
@@ -427,6 +433,7 @@ impl Capture {
427433 BytesOrWideString :: Wide ( b) => BytesOrWide :: Wide ( b. to_owned ( ) ) ,
428434 } ) ,
429435 lineno : symbol. lineno ( ) ,
436+ colno : symbol. colno ( ) ,
430437 } ) ;
431438 } ) ;
432439 }
0 commit comments