Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forbid type parameters and global paths in macro invocations #34495

Merged
merged 2 commits into from
Jun 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libsyntax/ext/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ fn expand_mac_invoc<T>(mac: ast::Mac, ident: Option<Ident>, attrs: Vec<ast::Attr
&fld.cx.ecfg.features.unwrap());
}

if path.segments.len() > 1 {
if path.segments.len() > 1 || path.global || !path.segments[0].parameters.is_empty() {
fld.cx.span_err(path.span, "expected macro name without module separators");
return None;
}
Expand Down
6 changes: 3 additions & 3 deletions src/test/compile-fail/macro-with-seps-err-msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern:expected macro name without module separators

fn main() {
globnar::brotz!();
globnar::brotz!(); //~ ERROR expected macro name without module separators
::foo!(); //~ ERROR expected macro name without module separators
foo::<T>!(); //~ ERROR expected macro name without module separators
}