about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/path.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_parse/src/parser/path.rs')
-rw-r--r--compiler/rustc_parse/src/parser/path.rs33
1 files changed, 7 insertions, 26 deletions
diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs
index 0d5f48e424e..feb7e829caf 100644
--- a/compiler/rustc_parse/src/parser/path.rs
+++ b/compiler/rustc_parse/src/parser/path.rs
@@ -1,7 +1,6 @@
-use super::pat::PatternLocation;
 use super::ty::{AllowPlus, RecoverQPath, RecoverReturnSign};
 use super::{Parser, Restrictions, TokenType};
-use crate::errors::{GenericArgsInPatRequireTurbofishSyntax, PathSingleColon};
+use crate::errors::PathSingleColon;
 use crate::{errors, maybe_whole};
 use rustc_ast::ptr::P;
 use rustc_ast::token::{self, Delimiter, Token, TokenKind};
@@ -80,7 +79,7 @@ impl<'a> Parser<'a> {
         let (mut path, path_span);
         if self.eat_keyword(kw::As) {
             let path_lo = self.token.span;
-            path = self.parse_path(PathStyle::Type, None)?;
+            path = self.parse_path(PathStyle::Type)?;
             path_span = path_lo.to(self.prev_token.span);
         } else {
             path_span = self.token.span.to(self.token.span);
@@ -99,7 +98,7 @@ impl<'a> Parser<'a> {
         }
 
         let qself = P(QSelf { ty, path_span, position: path.segments.len() });
-        self.parse_path_segments(&mut path.segments, style, None, None)?;
+        self.parse_path_segments(&mut path.segments, style, None)?;
 
         Ok((
             qself,
@@ -140,12 +139,8 @@ impl<'a> Parser<'a> {
         true
     }
 
-    pub(super) fn parse_path(
-        &mut self,
-        style: PathStyle,
-        syntax_loc: Option<PatternLocation>,
-    ) -> PResult<'a, Path> {
-        self.parse_path_inner(style, None, syntax_loc)
+    pub(super) fn parse_path(&mut self, style: PathStyle) -> PResult<'a, Path> {
+        self.parse_path_inner(style, None)
     }
 
     /// Parses simple paths.
@@ -162,7 +157,6 @@ impl<'a> Parser<'a> {
         &mut self,
         style: PathStyle,
         ty_generics: Option<&Generics>,
-        syntax_loc: Option<PatternLocation>,
     ) -> PResult<'a, Path> {
         let reject_generics_if_mod_style = |parser: &Parser<'_>, path: &Path| {
             // Ensure generic arguments don't end up in attribute paths, such as:
@@ -207,7 +201,7 @@ impl<'a> Parser<'a> {
         if self.eat(&token::ModSep) {
             segments.push(PathSegment::path_root(lo.shrink_to_lo().with_ctxt(mod_sep_ctxt)));
         }
-        self.parse_path_segments(&mut segments, style, ty_generics, syntax_loc)?;
+        self.parse_path_segments(&mut segments, style, ty_generics)?;
         Ok(Path { segments, span: lo.to(self.prev_token.span), tokens: None })
     }
 
@@ -216,10 +210,9 @@ impl<'a> Parser<'a> {
         segments: &mut ThinVec<PathSegment>,
         style: PathStyle,
         ty_generics: Option<&Generics>,
-        syntax_loc: Option<PatternLocation>,
     ) -> PResult<'a, ()> {
         loop {
-            let segment = self.parse_path_segment(style, ty_generics, syntax_loc)?;
+            let segment = self.parse_path_segment(style, ty_generics)?;
             if style.has_generic_ambiguity() {
                 // In order to check for trailing angle brackets, we must have finished
                 // recursing (`parse_path_segment` can indirectly call this function),
@@ -274,7 +267,6 @@ impl<'a> Parser<'a> {
         &mut self,
         style: PathStyle,
         ty_generics: Option<&Generics>,
-        syntax_loc: Option<PatternLocation>,
     ) -> PResult<'a, PathSegment> {
         let ident = self.parse_path_segment_ident()?;
         let is_args_start = |token: &Token| {
@@ -294,17 +286,6 @@ impl<'a> Parser<'a> {
             is_args_start(&this.token)
         };
 
-        if let Some(PatternLocation::FunctionParameter) = syntax_loc {
-        } else if style == PathStyle::Pat
-            && self.check_noexpect(&token::Lt)
-            && self.look_ahead(1, |t| t.can_begin_type())
-        {
-            return Err(self.sess.create_err(GenericArgsInPatRequireTurbofishSyntax {
-                span: self.token.span,
-                suggest_turbofish: self.token.span.shrink_to_lo(),
-            }));
-        }
-
         Ok(
             if style == PathStyle::Type && check_args_start(self)
                 || style != PathStyle::Mod