Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show backtrace numbers in backtrace whenever more than one is involved #75194

Merged
merged 1 commit into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/librustc_errors/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ pub trait Emitter {
format!(
"in this expansion of `{}`{}",
trace.kind.descr(),
if macro_backtrace.len() > 2 {
if macro_backtrace.len() > 1 {
// if macro_backtrace.len() == 1 it'll be
// pointed at by "in this macro invocation"
format!(" (#{})", i + 1)
Expand Down Expand Up @@ -393,7 +393,7 @@ pub trait Emitter {
trace.call_site,
format!(
"in this macro invocation{}",
if macro_backtrace.len() > 2 && always_backtrace {
if macro_backtrace.len() > 1 && always_backtrace {
// only specify order when the macro
// backtrace is multiple levels deep
format!(" (#{})", i + 1)
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/macro_backtrace/main.-Zmacro-backtrace.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ LL | / macro_rules! pong {
LL | | () => { syntax error };
| | ^^^^^ expected one of 8 possible tokens
LL | | }
| |__- in this expansion of `pong!`
| |__- in this expansion of `pong!` (#2)
...
LL | ping!();
| -------- in this macro invocation
| -------- in this macro invocation (#1)
|
::: $DIR/auxiliary/ping.rs:5:1
|
LL | / macro_rules! ping {
LL | | () => {
LL | | pong!();
| | -------- in this macro invocation
| | -------- in this macro invocation (#2)
LL | | }
LL | | }
| |_- in this expansion of `ping!`
| |_- in this expansion of `ping!` (#1)

error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
--> $DIR/main.rs:10:20
Expand Down