about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-08-23 06:06:21 +0000
committerbors <bors@rust-lang.org>2017-08-23 06:06:21 +0000
commitca898411c35d9b68c91e04d2b9d20392fa3d4805 (patch)
tree183c6e0d11c284f7600875c777ad6774cd86fc26 /src/libsyntax
parent528307ab1cedc31fd8e6cc647483c986f3258ad0 (diff)
parent7e191685e3621a30d7f053173604e0fc842e9580 (diff)
downloadrust-ca898411c35d9b68c91e04d2b9d20392fa3d4805.tar.gz
rust-ca898411c35d9b68c91e04d2b9d20392fa3d4805.zip
Auto merge of #43948 - jseyfried:generic_arguments_in_paths, r=petrochenkov
Ensure that generic arguments don't end up in attribute paths.

Fixes #43424.
r? @petrochenkov or @nrc
Diffstat (limited to 'src/libsyntax')
-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();