diff options
| author | bors <bors@rust-lang.org> | 2015-04-12 06:48:28 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-04-12 06:48:28 +0000 |
| commit | feeb23d42e0b1bc6f0466d4c6f035cfc3a4e9718 (patch) | |
| tree | 4acbbacbb3f8c2633b3bcfe79658f55db9a4f900 /src/libsyntax/ext/log_syntax.rs | |
| parent | 03f563a0e01bed68a44bf1fab946e0b6620bc153 (diff) | |
| parent | ddbdf51f394226bcae162ed2d5348126b32e7dbd (diff) | |
Auto merge of #24003 - rprichard:span-fixes, r=huonw
* 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.
r? alexcrichton
Addresses #23459
Diffstat (limited to 'src/libsyntax/ext/log_syntax.rs')
| -rw-r--r-- | src/libsyntax/ext/log_syntax.rs | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/src/libsyntax/ext/log_syntax.rs b/src/libsyntax/ext/log_syntax.rs index 8173dd93f74..9869108952c 100644 --- a/src/libsyntax/ext/log_syntax.rs +++ b/src/libsyntax/ext/log_syntax.rs @@ -26,8 +26,6 @@ pub fn expand_syntax_ext<'cx>(cx: &'cx mut base::ExtCtxt, return base::DummyResult::any(sp); } - cx.print_backtrace(); - println!("{}", print::pprust::tts_to_string(tts)); // any so that `log_syntax` can be invoked as an expression and item. |
