about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorRyan Prichard <ryan.prichard@gmail.com>2015-04-03 01:27:04 -0700
committerRyan Prichard <ryan.prichard@gmail.com>2015-04-11 16:00:58 -0700
commit0f46e4f1f23368f4615a9847671e3a91b2ebaf18 (patch)
tree23795acb7872118fdbcce722b0448004d06be9cd /src/libstd/sys/unix/stack_overflow.rs
parent6790b0e51967b1487728d155e0800a1ed03a30d3 (diff)
downloadrust-0f46e4f1f23368f4615a9847671e3a91b2ebaf18.tar.gz
rust-0f46e4f1f23368f4615a9847671e3a91b2ebaf18.zip
Propagate macro backtraces more often, improve formatting diagnostics
 * In noop_fold_expr, call new_span in these cases:
    - ExprMethodCall's identifier
    - ExprField's identifier
    - ExprTupField's integer

   Calling new_span for ExprMethodCall's identifier is necessary to print
   an acceptable diagnostic for write!(&2, ""). We see this error:

       <std macros>:2:20: 2:66 error: type `&mut _` does not implement any method in scope named `write_fmt`
       <std macros>:2 ( & mut * $ dst ) . write_fmt ( format_args ! ( $ ( $ arg ) * ) ) )
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   With this change, we also see a macro expansion backtrace leading to
   the write!(&2, "") call site.

 * After fully expanding a macro, we replace the expansion expression's
   span with the original span. Call fld.new_span to add a backtrace to
   this span. (Note that I'm call new_span after bt.pop(), so the macro
   just expanded isn't on the backtrace.)

   The motivating example for this change is println!("{}"). The format
   string literal is concat!($fmt, "arg") and is inside the libstd macro.
   We need to see the backtrace to find the println! call site.

 * Add a backtrace to the format_args! format expression span.

Addresses #23459
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions