rust/src/libsyntax
Ryan Prichard 0f46e4f1f2 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
2015-04-11 16:00:58 -07:00
..
ast_map rollup merge of #23860: nikomatsakis/copy-requires-clone 2015-04-01 18:37:54 -07:00
diagnostics Change span_help calls to fileline_help where appropriate 2015-03-03 15:18:33 +02:00
ext Propagate macro backtraces more often, improve formatting diagnostics 2015-04-11 16:00:58 -07:00
parse Fix the span for for expressions 2015-04-09 20:36:07 +12:00
print rollup merge of #23860: nikomatsakis/copy-requires-clone 2015-04-01 18:37:54 -07:00
util Simplifications to statement macro handling. 2015-04-10 23:42:40 -05:00
abi.rs Fallout in libsyntax 2015-04-01 11:22:39 -04:00
ast.rs fallout when bootstrapping rustc. 2015-04-01 22:35:50 +02:00
ast_util.rs Fallout in libsyntax 2015-04-01 11:22:39 -04:00
attr.rs Work towards a non-panicing parser (libsyntax) 2015-04-05 09:52:50 +01:00
codemap.rs Modify the codemap code to use more slices and to information about 2015-04-10 06:11:28 -04:00
config.rs syntax: gather common fields of impl & trait items into their respective types. 2015-03-11 23:39:16 +02:00
diagnostic.rs Add a new span_suggestion infrastructure. This lets you edit a snippet 2015-04-10 06:11:28 -04:00
feature_gate.rs Revise logic to match rustc::session::config::get_unstable_features_setting 2015-04-02 17:47:51 +02:00
fold.rs Propagate macro backtraces more often, improve formatting diagnostics 2015-04-11 16:00:58 -07:00
lib.rs Add comments suggested by Niko 2015-04-05 09:52:56 +01:00
owned_slice.rs Switched to Box::new in many places. 2015-03-03 21:05:55 +01:00
ptr.rs alloc: impl fmt::Pointer for Rc, Arc and Box 2015-04-07 22:50:36 -07:00
show_span.rs std: Stabilize FromStr and parse 2015-01-30 08:52:44 -08:00
std_inject.rs Unquote all crate names without underscores 2015-03-27 10:58:12 -07:00
test.rs Work towards a non-panicing parser (libsyntax) 2015-04-05 09:52:50 +01:00
visit.rs Fallout in libsyntax 2015-04-01 11:22:39 -04:00