Fix "new trace_macros doesn't work if there's an error during expansion"#44088
Fix "new trace_macros doesn't work if there's an error during expansion"#44088bors merged 6 commits intorust-lang:masterfrom
Conversation
…r during expansion)
|
(rust_highfive has picked a reviewer for you, use r? to override) |
|
r? @jseyfried |
|
Let's work up a test? |
|
Will do it tommorrow when I have more time to build rust |
| ProcMacroDerive(..) | BuiltinDerive(..) => { | ||
| self.cx.span_err(attr.span, &format!("`{}` is a derive mode", attr.path)); | ||
| self.cx.trace_macros_diag(); | ||
| kind.dummy(attr.span) |
There was a problem hiding this comment.
I don't think we need self.cx.trace_macros_diag(); when we're not panicking immediately after.
|
@bjorn3 A gentle reminder - it's been 7 days since your last message! |
|
@shepmaster Working on it. |
|
@jseyfried: Should be working. Travis job #58449.5 failed: |
jseyfried
left a comment
There was a problem hiding this comment.
LGTM other than what appears to be excessive self.cx.trace_macros_diag();.
| db.emit(); | ||
| } | ||
| // Fixme: does this result in errors? | ||
| self.expansions.clear(); |
There was a problem hiding this comment.
As this prevent reporting an expansion trace twice or more
| _ => { | ||
| let msg = &format!("macro `{}` may not be used in attributes", attr.path); | ||
| self.cx.span_err(attr.span, msg); | ||
| self.cx.trace_macros_diag(); |
There was a problem hiding this comment.
Why do we need this here? This error shouldn't abort expansion.
There was a problem hiding this comment.
The order of the trace notes is unstable otherwise.
| if let Err(msg) = validate_and_set_expn_info(def_span.map(|(_, s)| s), | ||
| false, false) { | ||
| self.cx.span_err(path.span, &msg); | ||
| self.cx.trace_macros_diag(); |
There was a problem hiding this comment.
Also this, and the most of the others in this file.
We use dummy expansions (kind.dummy(span)) so that we don't have to abort.
| cx.span_fatal(best_fail_spot.substitute_dummy(sp), &best_fail_msg); | ||
| cx.span_err(best_fail_spot.substitute_dummy(sp), &best_fail_msg); | ||
| cx.trace_macros_diag(); | ||
| DummyResult::any(sp) |
There was a problem hiding this comment.
With DummyResult we shouldn't need cx.trace_macros_diag(); here.
|
ping @jseyfried |
|
📌 Commit 0a2c95b has been approved by |
…ried Fix "new trace_macros doesn't work if there's an error during expansion" Fixes rust-lang#43493
…ried Fix "new trace_macros doesn't work if there's an error during expansion" Fixes rust-lang#43493
…ried Fix "new trace_macros doesn't work if there's an error during expansion" Fixes rust-lang#43493
|
@bors p=-1 retry Why are you still appearing in the queue |
Fixes #43493