@@ -161,6 +161,7 @@ struct BacktraceSymbol {
161
161
name : Option < Vec < u8 > > ,
162
162
filename : Option < BytesOrWide > ,
163
163
lineno : Option < u32 > ,
164
+ colno : Option < u32 > ,
164
165
}
165
166
166
167
enum BytesOrWide {
@@ -197,6 +198,10 @@ impl fmt::Debug for Backtrace {
197
198
198
199
impl fmt:: Debug for BacktraceSymbol {
199
200
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
200
205
write ! ( fmt, "{{ " ) ?;
201
206
202
207
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 {
209
214
write ! ( fmt, ", file: \" {:?}\" " , fname) ?;
210
215
}
211
216
212
- if let Some ( line) = self . lineno . as_ref ( ) {
217
+ if let Some ( line) = self . lineno {
213
218
write ! ( fmt, ", line: {:?}" , line) ?;
214
219
}
215
220
@@ -381,14 +386,15 @@ impl fmt::Display for Backtrace {
381
386
f. print_raw ( frame. frame . ip ( ) , None , None , None ) ?;
382
387
} else {
383
388
for symbol in frame. symbols . iter ( ) {
384
- f. print_raw (
389
+ f. print_raw_with_column (
385
390
frame. frame . ip ( ) ,
386
391
symbol. name . as_ref ( ) . map ( |b| backtrace_rs:: SymbolName :: new ( b) ) ,
387
392
symbol. filename . as_ref ( ) . map ( |b| match b {
388
393
BytesOrWide :: Bytes ( w) => BytesOrWideString :: Bytes ( w) ,
389
394
BytesOrWide :: Wide ( w) => BytesOrWideString :: Wide ( w) ,
390
395
} ) ,
391
396
symbol. lineno ,
397
+ symbol. colno ,
392
398
) ?;
393
399
}
394
400
}
@@ -427,6 +433,7 @@ impl Capture {
427
433
BytesOrWideString :: Wide ( b) => BytesOrWide :: Wide ( b. to_owned ( ) ) ,
428
434
} ) ,
429
435
lineno : symbol. lineno ( ) ,
436
+ colno : symbol. colno ( ) ,
430
437
} ) ;
431
438
} ) ;
432
439
}
0 commit comments