about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorJeffrey Seyfried <jeffrey.seyfried@gmail.com>2017-08-17 11:44:28 -0700
committerJeffrey Seyfried <jeffrey.seyfried@gmail.com>2017-08-22 15:50:19 -0700
commitd54a6d941312b2bd4e0c3f8209a8fd23175d180f (patch)
treec3d05565079d0c7a4cc5abae3ea0158b875b00ee /src/libsyntax/parse/parser.rs
parent469a6f9bd9aef394c5cff6b3bc41b8c520f9515b (diff)
downloadrust-d54a6d941312b2bd4e0c3f8209a8fd23175d180f.tar.gz
rust-d54a6d941312b2bd4e0c3f8209a8fd23175d180f.zip
Ensure that generic arguments don't end up in attribute paths.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 2b2f925306d..90a635fdf44 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1776,7 +1776,13 @@ impl<'a> Parser<'a> {
 
     pub fn parse_path_common(&mut self, style: PathStyle, enable_warning: bool)
                              -> PResult<'a, ast::Path> {
-        maybe_whole!(self, NtPath, |x| x);
+        maybe_whole!(self, NtPath, |path| {
+            if style == PathStyle::Mod &&
+               path.segments.iter().any(|segment| segment.parameters.is_some()) {
+                self.diagnostic().span_err(path.span, "unexpected generic arguments in path");
+            }
+            path
+        });
 
         let lo = self.meta_var_span.unwrap_or(self.span);
         let mut segments = Vec::new();