Skip to content

Commit df0e4bf

Browse files
committed
Move ensure_complete_parse into expand.rs.
1 parent b90cedd commit df0e4bf

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

src/libsyntax/ext/expand.rs

+12
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,18 @@ impl<'a> Parser<'a> {
500500
ExpansionKind::Pat => Expansion::Pat(self.parse_pat()?),
501501
})
502502
}
503+
504+
pub fn ensure_complete_parse(&mut self, macro_name: ast::Name, kind_name: &str, span: Span) {
505+
if self.token != token::Eof {
506+
let msg = format!("macro expansion ignores token `{}` and any following",
507+
self.this_token_to_string());
508+
let mut err = self.diagnostic().struct_span_err(self.span, &msg);
509+
let msg = format!("caused by the macro expansion here; the usage \
510+
of `{}!` is likely invalid in {} context",
511+
macro_name, kind_name);
512+
err.span_note(span, &msg).emit();
513+
}
514+
}
503515
}
504516

505517
struct InvocationCollector<'a, 'b: 'a> {

src/libsyntax/parse/parser.rs

-14
Original file line numberDiff line numberDiff line change
@@ -6171,18 +6171,4 @@ impl<'a> Parser<'a> {
61716171
_ => Err(self.fatal("expected string literal"))
61726172
}
61736173
}
6174-
6175-
pub fn ensure_complete_parse(&mut self, macro_name: ast::Name, kind_name: &str, span: Span) {
6176-
if self.token == token::Eof {
6177-
return
6178-
}
6179-
6180-
let msg = format!("macro expansion ignores token `{}` and any following",
6181-
self.this_token_to_string());
6182-
let mut err = self.diagnostic().struct_span_err(self.span, &msg);
6183-
let msg = format!("caused by the macro expansion here; the usage \
6184-
of `{}!` is likely invalid in {} context",
6185-
macro_name, kind_name);
6186-
err.span_note(span, &msg).emit();
6187-
}
61886174
}

0 commit comments

Comments
 (0)