Skip to content

Commit bb426ba

Browse files
committed
Work on macro_rules
1 parent f650153 commit bb426ba

File tree

5 files changed

+18
-11
lines changed

5 files changed

+18
-11
lines changed

compiler/rustc_expand/src/mbe/macro_rules.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ impl<'a> ParserAnyMacro<'a> {
151151
// We allow semicolons at the end of expressions -- e.g., the semicolon in
152152
// `macro_rules! m { () => { panic!(); } }` isn't parsed by `.parse_expr()`,
153153
// but `m!()` is allowed in expression positions (cf. issue #34706).
154-
if kind == AstFragmentKind::Expr && parser.token == token::Semi {
154+
/*if kind == AstFragmentKind::Expr && parser.token == token::Semi {
155155
parser.bump();
156-
}
156+
}*/
157157

158158
// Make sure we don't have any tokens left to parse so we don't silently drop anything.
159159
let path = ast::Path::from_ident(macro_ident.with_span_pos(site_span));

library/core/src/str/validations.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub(super) fn run_utf8_validation(v: &[u8]) -> Result<(), Utf8Error> {
125125
let old_offset = index;
126126
macro_rules! err {
127127
($error_len: expr) => {
128-
return Err(Utf8Error { valid_up_to: old_offset, error_len: $error_len });
128+
return Err(Utf8Error { valid_up_to: old_offset, error_len: $error_len })
129129
};
130130
}
131131

src/test/ui/hygiene/intercrate.stderr

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
error: type `fn() -> u32 {foo::bar::f}` is private
2-
--> $DIR/intercrate.rs:10:16
1+
error: macro expansion ignores token `;` and any following
2+
--> $DIR/auxiliary/intercrate.rs:8:16
3+
|
4+
LL | f();
5+
| ^
6+
|
7+
::: $DIR/intercrate.rs:10:16
38
|
49
LL | assert_eq!(intercrate::foo::m!(), 1);
5-
| ^^^^^^^^^^^^^^^^^^^^^ private type
10+
| ---------------------- help: you might be missing a semicolon here: `;`
11+
| |
12+
| caused by the macro expansion here
613
|
7-
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
14+
= note: the usage of `m!` is likely invalid in expression context
815

916
error: aborting due to previous error
1017

src/test/ui/macros/macro-context.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ LL | let a: m!();
99
|
1010
= note: the usage of `m!` is likely invalid in type context
1111

12-
error: macro expansion ignores token `typeof` and any following
13-
--> $DIR/macro-context.rs:3:17
12+
error: macro expansion ignores token `;` and any following
13+
--> $DIR/macro-context.rs:3:15
1414
|
1515
LL | () => ( i ; typeof );
16-
| ^^^^^^
16+
| ^
1717
...
1818
LL | let i = m!();
1919
| ---- caused by the macro expansion here

src/test/ui/macros/trace_faulty_macros.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ LL | let a = pat_macro!();
7373
| ^^^^^^^^^^^^
7474
|
7575
= note: expanding `pat_macro! { }`
76-
= note: to `pat_macro ! (A { a : a, b : 0, c : _, .. }) ;`
76+
= note: to `pat_macro ! (A { a : a, b : 0, c : _, .. })`
7777
= note: expanding `pat_macro! { A { a : a, b : 0, c : _, .. } }`
7878
= note: to `A { a: a, b: 0, c: _, .. }`
7979

0 commit comments

Comments
 (0)