Skip to content

Commit 9015b14

Browse files
committed
Auto merge of #46168 - durka:macro-backtrace, r=durka
mention nightly in -Z external-macro-backtrace note Fix #46167 by mentioning that you need nightly in the message that tells you to pass `-Z external-macro-backtrace`. Rationale: 1. The reason for having this message is to increase discoverability of the functionality. If the message is only shown on nightly it's less disoverable. 2. The same approach is taken if you call a const fn in const context without its feature gate (previously, if you called it without `#![feature(const_fn)]`). cc @kennytm
2 parents 827cb0d + 5da957c commit 9015b14

21 files changed

+32
-31
lines changed

src/librustc_errors/emitter.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,8 @@ impl EmitterWriter {
798798
level: Level::Note,
799799
message: vec![
800800
(["this error originates in a macro outside of the current crate",
801-
"(run with -Z external-macro-backtrace for more info)"].join(" "),
801+
"(in Nightly builds, run with -Z external-macro-backtrace for more info)"]
802+
.join(" "),
802803
Style::NoStyle),
803804
],
804805
span: MultiSpan::new(),

src/test/ui-fulldeps/issue-44953/issue-44953.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ error: use of unstable library feature 'rustc_private': this crate is being load
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1414
|
1515
= help: add #![feature(rustc_private)] to the crate attributes to enable
16-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
16+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
1717

1818
error: aborting due to 2 previous errors
1919

src/test/ui/codemap_tests/bad-format-args.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ error: requires at least a format string argument
44
12 | format!();
55
| ^^^^^^^^^^
66
|
7-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
7+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
88

99
error: expected token: `,`
1010
--> $DIR/bad-format-args.rs:13:5
1111
|
1212
13 | format!("" 1);
1313
| ^^^^^^^^^^^^^^
1414
|
15-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
15+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
1616

1717
error: expected token: `,`
1818
--> $DIR/bad-format-args.rs:14:5
1919
|
2020
14 | format!("", 1 1);
2121
| ^^^^^^^^^^^^^^^^^
2222
|
23-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
23+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2424

2525
error: aborting due to 3 previous errors
2626

src/test/ui/codemap_tests/issue-28308.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0600]: cannot apply unary operator `!` to type `&'static str`
44
12 | assert!("foo");
55
| ^^^^^^^^^^^^^^^
66
|
7-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
7+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
88

99
error: aborting due to previous error
1010

src/test/ui/cross-crate-macro-backtrace/main.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: 1 positional argument in format string, but no arguments were given
44
18 | myprintln!("{}");
55
| ^^^^^^^^^^^^^^^^^
66
|
7-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
7+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
88

99
error: aborting due to previous error
1010

src/test/ui/fmt/format-string-error.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ error: invalid format string: expected `'}'` but string was terminated
55
| ^^^^^^^^^^^^^^
66
|
77
= note: if you intended to print `{`, you can escape it using `{{`
8-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
8+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
99

1010
error: invalid format string: unmatched `}` found
1111
--> $DIR/format-string-error.rs:14:5
@@ -14,7 +14,7 @@ error: invalid format string: unmatched `}` found
1414
| ^^^^^^^^^^^^^^
1515
|
1616
= note: if you intended to print `}`, you can escape it using `}}`
17-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
17+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
1818

1919
error: aborting due to 2 previous errors
2020

src/test/ui/lifetimes/borrowck-let-suggestion.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ error[E0597]: borrowed value does not live long enough
99
| - temporary value needs to live until here
1010
|
1111
= note: consider using a `let` binding to increase its lifetime
12-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
12+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
1313

1414
error: aborting due to previous error
1515

src/test/ui/macros/format-foreign.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ error: multiple unused formatting arguments
1111
= help: `%.*3$s` should be written as `{:.2$}`
1212
= help: `%s` should be written as `{}`
1313
= note: printf formatting not supported; see the documentation for `std::fmt`
14-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
14+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
1515

1616
error: argument never used
1717
--> $DIR/format-foreign.rs:13:29

src/test/ui/macros/format-unused-lables.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ error: multiple unused formatting arguments
88
| | unused
99
| unused
1010
|
11-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
11+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
1212

1313
error: multiple unused formatting arguments
1414
--> $DIR/format-unused-lables.rs:14:5
@@ -23,7 +23,7 @@ error: multiple unused formatting arguments
2323
18 | | );
2424
| |______^
2525
|
26-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
26+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2727

2828
error: named argument never used
2929
--> $DIR/format-unused-lables.rs:20:35
@@ -47,7 +47,7 @@ error: multiple unused formatting arguments
4747
|
4848
= help: `$STUFF` should be written as `{STUFF}`
4949
= note: shell formatting not supported; see the documentation for `std::fmt`
50-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
50+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
5151

5252
error: aborting due to 4 previous errors
5353

src/test/ui/reachable/expr_again.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ note: lint level defined here
99
|
1010
13 | #![deny(unreachable_code)]
1111
| ^^^^^^^^^^^^^^^^
12-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
12+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
1313

1414
error: aborting due to previous error
1515

src/test/ui/reachable/expr_block.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ error: unreachable statement
1616
36 | println!("foo");
1717
| ^^^^^^^^^^^^^^^^
1818
|
19-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
19+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2020

2121
error: aborting due to 2 previous errors
2222

src/test/ui/reachable/expr_if.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ note: lint level defined here
99
|
1010
14 | #![deny(unreachable_code)]
1111
| ^^^^^^^^^^^^^^^^
12-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
12+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
1313

1414
error: aborting due to previous error
1515

src/test/ui/reachable/expr_loop.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ note: lint level defined here
99
|
1010
14 | #![deny(unreachable_code)]
1111
| ^^^^^^^^^^^^^^^^
12-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
12+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
1313

1414
error: unreachable statement
1515
--> $DIR/expr_loop.rs:31:5
1616
|
1717
31 | println!("I am dead.");
1818
| ^^^^^^^^^^^^^^^^^^^^^^^
1919
|
20-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
20+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2121

2222
error: unreachable statement
2323
--> $DIR/expr_loop.rs:41:5
2424
|
2525
41 | println!("I am dead.");
2626
| ^^^^^^^^^^^^^^^^^^^^^^^
2727
|
28-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
28+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2929

3030
error: aborting due to 3 previous errors
3131

src/test/ui/reachable/expr_match.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ error: unreachable statement
1616
25 | println!("I am dead");
1717
| ^^^^^^^^^^^^^^^^^^^^^^
1818
|
19-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
19+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2020

2121
error: unreachable statement
2222
--> $DIR/expr_match.rs:35:5
2323
|
2424
35 | println!("I am dead");
2525
| ^^^^^^^^^^^^^^^^^^^^^^
2626
|
27-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
27+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2828

2929
error: aborting due to 3 previous errors
3030

src/test/ui/reachable/expr_while.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ note: lint level defined here
99
|
1010
14 | #![deny(unreachable_code)]
1111
| ^^^^^^^^^^^^^^^^
12-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
12+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
1313

1414
error: unreachable statement
1515
--> $DIR/expr_while.rs:33:9
1616
|
1717
33 | println!("I am dead.");
1818
| ^^^^^^^^^^^^^^^^^^^^^^^
1919
|
20-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
20+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2121

2222
error: unreachable statement
2323
--> $DIR/expr_while.rs:35:5
2424
|
2525
35 | println!("I am, too.");
2626
| ^^^^^^^^^^^^^^^^^^^^^^^
2727
|
28-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
28+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2929

3030
error: aborting due to 3 previous errors
3131

src/test/ui/span/coerce-suggestions.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ error[E0308]: mismatched types
5353
= note: expected type `&mut std::string::String`
5454
found type `std::string::String`
5555
= help: try with `&mut format!("foo")`
56-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
56+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
5757

5858
error: aborting due to 6 previous errors
5959

src/test/ui/span/issue-33884.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ error[E0308]: mismatched types
66
|
77
= note: expected type `std::fmt::Arguments<'_>`
88
found type `std::string::String`
9-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
9+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
1010

1111
error: aborting due to previous error
1212

src/test/ui/span/issue-40157.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ error[E0597]: `foo` does not live long enough
88
| | borrow occurs here
99
| borrowed value needs to live until here
1010
|
11-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
11+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
1212

1313
error: aborting due to previous error
1414

src/test/ui/span/slice-borrow.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ error[E0597]: borrowed value does not live long enough
99
19 | }
1010
| - temporary value needs to live until here
1111
|
12-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
12+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
1313

1414
error: aborting due to previous error
1515

src/test/ui/type-check/cannot_infer_local_or_vec.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ error[E0282]: type annotations needed
66
| |
77
| consider giving `x` a type
88
|
9-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
9+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
1010

1111
error: aborting due to previous error
1212

src/test/ui/type-check/cannot_infer_local_or_vec_in_tuples.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ error[E0282]: type annotations needed
66
| |
77
| consider giving the pattern a type
88
|
9-
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
9+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
1010

1111
error: aborting due to previous error
1212

0 commit comments

Comments
 (0)