rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros.

This commit is contained in:
Eduard-Mihai Burtescu 2019-12-16 15:56:47 +02:00
parent ab080973cb
commit 4c7eb59e81
280 changed files with 888 additions and 119 deletions

View file

@ -16,7 +16,7 @@ error: macro requires a boolean expression as an argument
LL | debug_assert!();
| ^^^^^^^^^^^^^^^^ boolean expression required
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected expression, found keyword `struct`
--> $DIR/assert.rs:5:19

View file

@ -3,6 +3,8 @@ error: macro requires a cfg-pattern as an argument
|
LL | cfg!();
| ^^^^^^^ cfg-pattern required
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected identifier, found `123`
--> $DIR/cfg.rs:3:10

View file

@ -12,6 +12,7 @@ LL | | }
LL | format_args!(hang!());
| ------- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: you might be missing a string literal to format with
|
LL | format_args!("{}", hang!());

View file

@ -4,7 +4,7 @@ error: requires at least a format string argument
LL | format!();
| ^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected expression, found keyword `struct`
--> $DIR/format-parse-errors.rs:5:13

View file

@ -6,6 +6,8 @@ LL | let
...
LL | m!();
| ----- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error

View file

@ -6,6 +6,8 @@ LL | 1.fake()
...
LL | fake_method_stmt!();
| -------------------- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> $DIR/macro-backtrace-invalid-internals.rs:11:13
@ -15,6 +17,8 @@ LL | 1.fake
...
LL | fake_field_stmt!();
| ------------------- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> $DIR/macro-backtrace-invalid-internals.rs:17:15
@ -24,6 +28,8 @@ LL | (1).0
...
LL | fake_anon_field_stmt!();
| ------------------------ in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0689]: can't call method `neg` on ambiguous numeric type `{float}`
--> $DIR/macro-backtrace-invalid-internals.rs:41:15
@ -34,6 +40,7 @@ LL | 2.0.neg()
LL | real_method_stmt!();
| -------------------- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: you must specify a concrete type for this numeric value, like `f32`
|
LL | 2.0_f32.neg()
@ -47,6 +54,8 @@ LL | 1.fake()
...
LL | let _ = fake_method_expr!();
| ------------------- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> $DIR/macro-backtrace-invalid-internals.rs:29:13
@ -56,6 +65,8 @@ LL | 1.fake
...
LL | let _ = fake_field_expr!();
| ------------------ in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> $DIR/macro-backtrace-invalid-internals.rs:35:15
@ -65,6 +76,8 @@ LL | (1).0
...
LL | let _ = fake_anon_field_expr!();
| ----------------------- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0689]: can't call method `neg` on ambiguous numeric type `{float}`
--> $DIR/macro-backtrace-invalid-internals.rs:47:15
@ -75,6 +88,7 @@ LL | 2.0.neg()
LL | let _ = real_method_expr!();
| ------------------- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: you must specify a concrete type for this numeric value, like `f32`
|
LL | 2.0_f32.neg()

View file

@ -6,6 +6,8 @@ LL | () => (fake)
...
LL | 1 + call_nested_expr!();
| ------------------- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `fake` in this scope
--> $DIR/macro-backtrace-nested.rs:5:12
@ -15,6 +17,8 @@ LL | () => (fake)
...
LL | call_nested_expr_sum!();
| ------------------------ in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors

View file

@ -6,6 +6,8 @@ LL | ($fmt:expr) => (myprint!(concat!($fmt, "\n")));
...
LL | myprintln!("{}");
| ----------------- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error

View file

@ -39,6 +39,8 @@ LL | () => ( i ; typeof );
...
LL | m!();
| ----- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors

View file

@ -8,4 +8,6 @@ LL | 'b: loop {
| -- first declared here
LL | br2!('b);
| --------- in this macro invocation
|
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -9,7 +9,7 @@ note: the constant `baz` is defined here
|
LL | thread_local!(static baz: f64 = 0.0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error

View file

@ -8,6 +8,7 @@ LL | m1!();
| ------ in this macro invocation
|
= note: macro-expanded `#[macro_use]`s may not shadow existing macros (see RFC 1560)
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `foo` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/macro-shadowing.rs:17:1
@ -28,6 +29,7 @@ note: `foo` could also refer to the macro defined here
|
LL | macro_rules! foo { () => {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors

View file

@ -3,6 +3,8 @@ error[E0665]: `Default` cannot be derived for enums, only structs
|
LL | #[derive(Default)]
| ^^^^^^^
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: inline assembly must be a string literal
--> $DIR/macros-nonfatal-errors.rs:13:10
@ -68,6 +70,8 @@ error: couldn't read $DIR/i'd be quite surprised if a file with this name existe
|
LL | include_str!("i'd be quite surprised if a file with this name existed");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: argument must be a string literal
--> $DIR/macros-nonfatal-errors.rs:28:20
@ -80,6 +84,8 @@ error: couldn't read $DIR/i'd be quite surprised if a file with this name existe
|
LL | include_bytes!("i'd be quite surprised if a file with this name existed");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: trace_macros! accepts only `true` or `false`
--> $DIR/macros-nonfatal-errors.rs:31:5

View file

@ -6,5 +6,5 @@ LL | write!(&mut example, "{}", 42);
|
= note: `-W unused-must-use` implied by `-W unused`
= note: this `Result` may be an `Err` variant, which should be handled
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -9,6 +9,8 @@ LL | n!(a $nt_item b);
...
LL | complex_nonterminal!(enum E {});
| -------------------------------- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error

View file

@ -23,6 +23,7 @@ LL | macro_rules! m { () => {} }
...
LL | include!();
| ----------- in this macro invocation
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-legacy.rs:139:42
@ -49,6 +50,7 @@ LL | macro_rules! m { () => {} }
...
LL | include!();
| ----------- in this macro invocation
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-legacy.rs:148:9
@ -75,6 +77,7 @@ LL | macro_rules! m { () => {} }
...
LL | include!();
| ----------- in this macro invocation
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-legacy.rs:164:9
@ -101,6 +104,7 @@ LL | macro_rules! m { () => { Wrong } }
...
LL | include!();
| ----------- in this macro invocation
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-legacy.rs:180:13
@ -127,6 +131,7 @@ LL | macro_rules! m { () => { Wrong } }
...
LL | include!();
| ----------- in this macro invocation
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-legacy.rs:218:42
@ -153,6 +158,7 @@ LL | macro_rules! m { () => { Wrong } }
...
LL | include!();
| ----------- in this macro invocation
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-legacy.rs:232:9
@ -179,6 +185,7 @@ LL | macro_rules! m { () => {} }
...
LL | include!();
| ----------- in this macro invocation
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-legacy.rs:262:42
@ -205,6 +212,7 @@ LL | macro_rules! m { () => {} }
...
LL | include!();
| ----------- in this macro invocation
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 8 previous errors

View file

@ -23,6 +23,7 @@ LL | macro m() {}
...
LL | include!();
| ----------- in this macro invocation
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-modern.rs:147:33
@ -49,6 +50,7 @@ LL | macro m() {}
...
LL | include!();
| ----------- in this macro invocation
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-modern.rs:156:13
@ -75,6 +77,7 @@ LL | macro m() {}
...
LL | include!();
| ----------- in this macro invocation
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-modern.rs:172:13
@ -101,6 +104,7 @@ LL | macro m() { Wrong }
...
LL | include!();
| ----------- in this macro invocation
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-modern.rs:190:17
@ -127,6 +131,7 @@ LL | macro m() { Wrong }
...
LL | include!();
| ----------- in this macro invocation
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-modern.rs:233:33
@ -153,6 +158,7 @@ LL | macro m() { Wrong }
...
LL | include!();
| ----------- in this macro invocation
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 6 previous errors

View file

@ -28,6 +28,7 @@ LL | | fn main() {}
... |
|
= note: allowed there are: `=>`, `,` or `;`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: `$x:expr` may be followed by `=`, which is not allowed for `expr` fragments
--> $DIR/same-sequence-span.rs:19:1
@ -36,6 +37,7 @@ LL | proc_macro_sequence::make_foo!();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not allowed after `expr` fragments
|
= note: allowed there are: `=>`, `,` or `;`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors

View file

@ -8,6 +8,8 @@ LL | *&mut $s = 0;
...
LL | bad!(foo whatever);
| ------------------- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error

View file

@ -9,6 +9,8 @@ LL | my_faulty_macro!(bcd);
...
LL | my_faulty_macro!();
| ------------------- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
note: trace_macro
--> $DIR/trace_faulty_macros.rs:33:5
@ -30,6 +32,7 @@ LL | my_recursive_macro!();
| ---------------------- in this macro invocation
|
= help: consider adding a `#![recursion_limit="8"]` attribute to your crate (`trace_faulty_macros`)
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
note: trace_macro
--> $DIR/trace_faulty_macros.rs:34:5