Skip to content

Commit

Permalink
Address review comments and CI failures
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Dec 20, 2018
1 parent 29f3d7b commit 4a6aa36
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/librustc_resolve/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl<'a> base::Resolver for Resolver<'a> {
Ok((def, ext)) => (def, ext),
Err(Determinacy::Determined) if kind == MacroKind::Attr => {
// Replace unresolved attributes with used inert attributes for better recovery.
return Ok(Some(self.get_macro(Def::NonMacroAttr(NonMacroAttrKind::Tool))));
return Ok(Some(Lrc::new(SyntaxExtension::NonMacroAttr { mark_used: true })));
}
Err(determinacy) => return Err(determinacy),
};
Expand Down
1 change: 1 addition & 0 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2881,6 +2881,7 @@ impl<'a> Parser<'a> {
let mut err = self.fatal(&format!("unknown macro variable `{}`", name));
err.span_label(self.span, "unknown macro variable");
err.emit();
self.bump();
return
}
token::Interpolated(ref nt) => {
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/issues/issue-6596-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ macro_rules! e {
($inp:ident) => (
$nonexistent
//~^ ERROR unknown macro variable `nonexistent`
//~| ERROR cannot find value `nonexistent` in this scope
);
}

Expand Down
12 changes: 1 addition & 11 deletions src/test/ui/issues/issue-6596-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,5 @@ LL | $nonexistent
LL | e!(foo);
| -------- in this macro invocation

error[E0425]: cannot find value `nonexistent` in this scope
--> $DIR/issue-6596-1.rs:14:9
|
LL | $nonexistent
| ^^^^^^^^^^^^ not found in this scope
...
LL | e!(foo);
| -------- in this macro invocation

error: aborting due to 2 previous errors
error: aborting due to previous error

For more information about this error, try `rustc --explain E0425`.
1 change: 0 additions & 1 deletion src/test/ui/issues/issue-6596-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ macro_rules! g {
($inp:ident) => (
{ $inp $nonexistent }
//~^ ERROR unknown macro variable `nonexistent`
//~| ERROR expected one of
);
}

Expand Down
11 changes: 1 addition & 10 deletions src/test/ui/issues/issue-6596-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,5 @@ LL | { $inp $nonexistent }
LL | g!(foo);
| -------- in this macro invocation

error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `nonexistent`
--> $DIR/issue-6596-2.rs:15:16
|
LL | { $inp $nonexistent }
| ^^^^^^^^^^^^ expected one of 8 possible tokens here
...
LL | g!(foo);
| -------- in this macro invocation

error: aborting due to 2 previous errors
error: aborting due to previous error

18 changes: 8 additions & 10 deletions src/test/ui/macros/macro-comma-behavior.core.stderr
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
error: 1 positional argument in format string, but no arguments were given
--> $DIR/macro-comma-behavior.rs:27:23
--> $DIR/macro-comma-behavior.rs:29:23
|
LL | assert_eq!(1, 1, "{}",);
| ^^

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

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

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

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

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

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

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

error: language item required, but not found: `eh_unwind_resume`

error: aborting due to 10 previous errors
error: aborting due to 9 previous errors

2 changes: 2 additions & 0 deletions src/test/ui/macros/macro-comma-behavior.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
// compile-flags: -C debug_assertions=yes
// revisions: std core

#![feature(lang_items)]
#![cfg_attr(core, no_std)]

#[cfg(std)] use std::fmt;
#[cfg(core)] use core::fmt;
#[cfg(core)] #[lang = "eh_unwind_resume"] fn eh_unwind_resume() {}

// (see documentation of the similarly-named test in run-pass)
fn to_format_or_not_to_format() {
Expand Down
20 changes: 10 additions & 10 deletions src/test/ui/macros/macro-comma-behavior.std.stderr
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
error: 1 positional argument in format string, but no arguments were given
--> $DIR/macro-comma-behavior.rs:27:23
--> $DIR/macro-comma-behavior.rs:29:23
|
LL | assert_eq!(1, 1, "{}",);
| ^^

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

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

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

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

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

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

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

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

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

0 comments on commit 4a6aa36

Please sign in to comment.