Skip to content

Commit 4a6aa36

Browse files
committed
Address review comments and CI failures
1 parent 29f3d7b commit 4a6aa36

9 files changed

+24
-44
lines changed

src/librustc_resolve/macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl<'a> base::Resolver for Resolver<'a> {
196196
Ok((def, ext)) => (def, ext),
197197
Err(Determinacy::Determined) if kind == MacroKind::Attr => {
198198
// Replace unresolved attributes with used inert attributes for better recovery.
199-
return Ok(Some(self.get_macro(Def::NonMacroAttr(NonMacroAttrKind::Tool))));
199+
return Ok(Some(Lrc::new(SyntaxExtension::NonMacroAttr { mark_used: true })));
200200
}
201201
Err(determinacy) => return Err(determinacy),
202202
};

src/libsyntax/parse/parser.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2881,6 +2881,7 @@ impl<'a> Parser<'a> {
28812881
let mut err = self.fatal(&format!("unknown macro variable `{}`", name));
28822882
err.span_label(self.span, "unknown macro variable");
28832883
err.emit();
2884+
self.bump();
28842885
return
28852886
}
28862887
token::Interpolated(ref nt) => {

src/test/ui/issues/issue-6596-1.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ macro_rules! e {
1313
($inp:ident) => (
1414
$nonexistent
1515
//~^ ERROR unknown macro variable `nonexistent`
16-
//~| ERROR cannot find value `nonexistent` in this scope
1716
);
1817
}
1918

src/test/ui/issues/issue-6596-1.stderr

+1-11
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,5 @@ LL | $nonexistent
77
LL | e!(foo);
88
| -------- in this macro invocation
99

10-
error[E0425]: cannot find value `nonexistent` in this scope
11-
--> $DIR/issue-6596-1.rs:14:9
12-
|
13-
LL | $nonexistent
14-
| ^^^^^^^^^^^^ not found in this scope
15-
...
16-
LL | e!(foo);
17-
| -------- in this macro invocation
18-
19-
error: aborting due to 2 previous errors
10+
error: aborting due to previous error
2011

21-
For more information about this error, try `rustc --explain E0425`.

src/test/ui/issues/issue-6596-2.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ macro_rules! g {
1414
($inp:ident) => (
1515
{ $inp $nonexistent }
1616
//~^ ERROR unknown macro variable `nonexistent`
17-
//~| ERROR expected one of
1817
);
1918
}
2019

src/test/ui/issues/issue-6596-2.stderr

+1-10
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,5 @@ LL | { $inp $nonexistent }
77
LL | g!(foo);
88
| -------- in this macro invocation
99

10-
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `nonexistent`
11-
--> $DIR/issue-6596-2.rs:15:16
12-
|
13-
LL | { $inp $nonexistent }
14-
| ^^^^^^^^^^^^ expected one of 8 possible tokens here
15-
...
16-
LL | g!(foo);
17-
| -------- in this macro invocation
18-
19-
error: aborting due to 2 previous errors
10+
error: aborting due to previous error
2011

Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
error: 1 positional argument in format string, but no arguments were given
2-
--> $DIR/macro-comma-behavior.rs:27:23
2+
--> $DIR/macro-comma-behavior.rs:29:23
33
|
44
LL | assert_eq!(1, 1, "{}",);
55
| ^^
66

77
error: 1 positional argument in format string, but no arguments were given
8-
--> $DIR/macro-comma-behavior.rs:30:23
8+
--> $DIR/macro-comma-behavior.rs:32:23
99
|
1010
LL | assert_ne!(1, 2, "{}",);
1111
| ^^
1212

1313
error: 1 positional argument in format string, but no arguments were given
14-
--> $DIR/macro-comma-behavior.rs:36:29
14+
--> $DIR/macro-comma-behavior.rs:38:29
1515
|
1616
LL | debug_assert_eq!(1, 1, "{}",);
1717
| ^^
1818

1919
error: 1 positional argument in format string, but no arguments were given
20-
--> $DIR/macro-comma-behavior.rs:39:29
20+
--> $DIR/macro-comma-behavior.rs:41:29
2121
|
2222
LL | debug_assert_ne!(1, 2, "{}",);
2323
| ^^
2424

2525
error: 1 positional argument in format string, but no arguments were given
26-
--> $DIR/macro-comma-behavior.rs:60:19
26+
--> $DIR/macro-comma-behavior.rs:62:19
2727
|
2828
LL | format_args!("{}",);
2929
| ^^
3030

3131
error: 1 positional argument in format string, but no arguments were given
32-
--> $DIR/macro-comma-behavior.rs:78:21
32+
--> $DIR/macro-comma-behavior.rs:80:21
3333
|
3434
LL | unimplemented!("{}",);
3535
| ^^
3636

3737
error: 1 positional argument in format string, but no arguments were given
38-
--> $DIR/macro-comma-behavior.rs:87:24
38+
--> $DIR/macro-comma-behavior.rs:89:24
3939
|
4040
LL | write!(f, "{}",)?;
4141
| ^^
@@ -44,7 +44,5 @@ error: `#[panic_handler]` function required, but not found
4444

4545
error: language item required, but not found: `eh_personality`
4646

47-
error: language item required, but not found: `eh_unwind_resume`
48-
49-
error: aborting due to 10 previous errors
47+
error: aborting due to 9 previous errors
5048

src/test/ui/macros/macro-comma-behavior.rs

+2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
// compile-flags: -C debug_assertions=yes
1414
// revisions: std core
1515

16+
#![feature(lang_items)]
1617
#![cfg_attr(core, no_std)]
1718

1819
#[cfg(std)] use std::fmt;
1920
#[cfg(core)] use core::fmt;
21+
#[cfg(core)] #[lang = "eh_unwind_resume"] fn eh_unwind_resume() {}
2022

2123
// (see documentation of the similarly-named test in run-pass)
2224
fn to_format_or_not_to_format() {

src/test/ui/macros/macro-comma-behavior.std.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
11
error: 1 positional argument in format string, but no arguments were given
2-
--> $DIR/macro-comma-behavior.rs:27:23
2+
--> $DIR/macro-comma-behavior.rs:29:23
33
|
44
LL | assert_eq!(1, 1, "{}",);
55
| ^^
66

77
error: 1 positional argument in format string, but no arguments were given
8-
--> $DIR/macro-comma-behavior.rs:30:23
8+
--> $DIR/macro-comma-behavior.rs:32:23
99
|
1010
LL | assert_ne!(1, 2, "{}",);
1111
| ^^
1212

1313
error: 1 positional argument in format string, but no arguments were given
14-
--> $DIR/macro-comma-behavior.rs:36:29
14+
--> $DIR/macro-comma-behavior.rs:38:29
1515
|
1616
LL | debug_assert_eq!(1, 1, "{}",);
1717
| ^^
1818

1919
error: 1 positional argument in format string, but no arguments were given
20-
--> $DIR/macro-comma-behavior.rs:39:29
20+
--> $DIR/macro-comma-behavior.rs:41:29
2121
|
2222
LL | debug_assert_ne!(1, 2, "{}",);
2323
| ^^
2424

2525
error: 1 positional argument in format string, but no arguments were given
26-
--> $DIR/macro-comma-behavior.rs:44:18
26+
--> $DIR/macro-comma-behavior.rs:46:18
2727
|
2828
LL | eprint!("{}",);
2929
| ^^
3030

3131
error: 1 positional argument in format string, but no arguments were given
32-
--> $DIR/macro-comma-behavior.rs:56:18
32+
--> $DIR/macro-comma-behavior.rs:58:18
3333
|
3434
LL | format!("{}",);
3535
| ^^
3636

3737
error: 1 positional argument in format string, but no arguments were given
38-
--> $DIR/macro-comma-behavior.rs:60:19
38+
--> $DIR/macro-comma-behavior.rs:62:19
3939
|
4040
LL | format_args!("{}",);
4141
| ^^
4242

4343
error: 1 positional argument in format string, but no arguments were given
44-
--> $DIR/macro-comma-behavior.rs:67:17
44+
--> $DIR/macro-comma-behavior.rs:69:17
4545
|
4646
LL | print!("{}",);
4747
| ^^
4848

4949
error: 1 positional argument in format string, but no arguments were given
50-
--> $DIR/macro-comma-behavior.rs:78:21
50+
--> $DIR/macro-comma-behavior.rs:80:21
5151
|
5252
LL | unimplemented!("{}",);
5353
| ^^
5454

5555
error: 1 positional argument in format string, but no arguments were given
56-
--> $DIR/macro-comma-behavior.rs:87:24
56+
--> $DIR/macro-comma-behavior.rs:89:24
5757
|
5858
LL | write!(f, "{}",)?;
5959
| ^^

0 commit comments

Comments
 (0)