Skip to content

Commit 6a1c063

Browse files
committed
Auto merge of #52175 - fpoli:testsuite-callsite-span, r=petrochenkov
Match errors using the callsite of macro expansions Fix for issue #51848
2 parents 00204c2 + 8ec9d72 commit 6a1c063

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+137
-49
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
fn main() {
12-
format!();
13-
format!("" 1);
14-
format!("", 1 1);
12+
format!(); //~ ERROR requires at least a format string argument
13+
format!("" 1); //~ ERROR expected token: `,`
14+
format!("", 1 1); //~ ERROR expected token: `,`
1515
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
error: requires at least a format string argument
22
--> $DIR/bad-format-args.rs:12:5
33
|
4-
LL | format!();
4+
LL | format!(); //~ ERROR requires at least a format string argument
55
| ^^^^^^^^^^
66
|
77
= 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
|
12-
LL | format!("" 1);
12+
LL | format!("" 1); //~ ERROR expected token: `,`
1313
| ^^^^^^^^^^^^^^
1414
|
1515
= 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
|
20-
LL | format!("", 1 1);
20+
LL | format!("", 1 1); //~ ERROR expected token: `,`
2121
| ^^^^^^^^^^^^^^^^^
2222
|
2323
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: in format string
12-
1311
// aux-build:extern_macro_crate.rs
1412
#[macro_use(myprintln, myprint)]
1513
extern crate extern_macro_crate;
1614

1715
fn main() {
1816
myprintln!("{}");
17+
//~^ ERROR in format string
1918
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: 1 positional argument in format string, but no arguments were given
2-
--> $DIR/main.rs:18:5
2+
--> $DIR/main.rs:16:5
33
|
44
LL | myprintln!("{}");
55
| ^^^^^^^^^^^^^^^^^

src/test/ui/cross-file-errors/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ mod underscore;
1313

1414
fn main() {
1515
underscore!();
16+
//~^ ERROR expected expression, found reserved identifier `_`
1617
}

src/test/ui/edition-keywords-2015-2018-expansion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
extern crate edition_kw_macro_2018;
1818

1919
mod one_async {
20-
produces_async! {} // ERROR expected identifier, found reserved keyword
20+
produces_async! {} //~ ERROR expected identifier, found reserved keyword
2121
}
2222
mod two_async {
2323
produces_async_raw! {} // OK

src/test/ui/edition-keywords-2015-2018-expansion.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: expected identifier, found reserved keyword `async`
22
--> $DIR/edition-keywords-2015-2018-expansion.rs:20:5
33
|
4-
LL | produces_async! {} // ERROR expected identifier, found reserved keyword
4+
LL | produces_async! {} //~ ERROR expected identifier, found reserved keyword
55
| ^^^^^^^^^^^^^^^^^^ expected identifier, found reserved keyword
66
|
77
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

src/test/ui/edition-keywords-2018-2018-expansion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
extern crate edition_kw_macro_2018;
1818

1919
mod one_async {
20-
produces_async! {} // ERROR expected identifier, found reserved keyword `async`
20+
produces_async! {} //~ ERROR expected identifier, found reserved keyword `async`
2121
}
2222
mod two_async {
2323
produces_async_raw! {} // OK

src/test/ui/edition-keywords-2018-2018-expansion.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: expected identifier, found reserved keyword `async`
22
--> $DIR/edition-keywords-2018-2018-expansion.rs:20:5
33
|
4-
LL | produces_async! {} // ERROR expected identifier, found reserved keyword `async`
4+
LL | produces_async! {} //~ ERROR expected identifier, found reserved keyword `async`
55
| ^^^^^^^^^^^^^^^^^^ expected identifier, found reserved keyword
66
|
77
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

src/test/ui/hygiene/intercrate.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@
1212

1313
// aux-build:intercrate.rs
1414

15-
// error-pattern:type `fn() -> u32 {intercrate::foo::bar::f}` is private
16-
1715
#![feature(decl_macro)]
1816

1917
extern crate intercrate;
2018

2119
fn main() {
2220
assert_eq!(intercrate::foo::m!(), 1);
21+
//~^ ERROR type `fn() -> u32 {intercrate::foo::bar::f}` is private
2322
}

0 commit comments

Comments
 (0)