about summary refs log tree commit diff
path: root/src/librustc_parse/parser/path.rs
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-03-01 19:28:10 +0900
committerGitHub <noreply@github.com>2020-03-01 19:28:10 +0900
commit4439bb09aabee6df4f0ca48552b61ea9d7bc60db (patch)
treeb8e984955d096614ced60c35a9329bc8120148bb /src/librustc_parse/parser/path.rs
parent48ec25224b1e252608a0458585dc5e0847ed91c4 (diff)
parent7de9a72ca3769f55b415372f1f59f70ccf1f66fe (diff)
downloadrust-4439bb09aabee6df4f0ca48552b61ea9d7bc60db.tar.gz
rust-4439bb09aabee6df4f0ca48552b61ea9d7bc60db.zip
Rollup merge of #69579 - petrochenkov:noprevspan, r=Centril
parser: Remove `Parser::prev_span`

Follow-up to https://github.com/rust-lang/rust/pull/69384.
r? @Centril
Diffstat (limited to 'src/librustc_parse/parser/path.rs')
-rw-r--r--src/librustc_parse/parser/path.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/librustc_parse/parser/path.rs b/src/librustc_parse/parser/path.rs
index 6a71ebe2183..355b6429a74 100644
--- a/src/librustc_parse/parser/path.rs
+++ b/src/librustc_parse/parser/path.rs
@@ -50,7 +50,7 @@ impl<'a> Parser<'a> {
     /// `<T as U>::F::a<S>` (without disambiguator)
     /// `<T as U>::F::a::<S>` (with disambiguator)
     pub(super) fn parse_qpath(&mut self, style: PathStyle) -> PResult<'a, (QSelf, Path)> {
-        let lo = self.prev_span;
+        let lo = self.prev_token.span;
         let ty = self.parse_ty()?;
 
         // `path` will contain the prefix of the path up to the `>`,
@@ -61,7 +61,7 @@ impl<'a> Parser<'a> {
         if self.eat_keyword(kw::As) {
             let path_lo = self.token.span;
             path = self.parse_path(PathStyle::Type)?;
-            path_span = path_lo.to(self.prev_span);
+            path_span = path_lo.to(self.prev_token.span);
         } else {
             path_span = self.token.span.to(self.token.span);
             path = ast::Path { segments: Vec::new(), span: path_span };
@@ -81,7 +81,7 @@ impl<'a> Parser<'a> {
         let qself = QSelf { ty, path_span, position: path.segments.len() };
         self.parse_path_segments(&mut path.segments, style)?;
 
-        Ok((qself, Path { segments: path.segments, span: lo.to(self.prev_span) }))
+        Ok((qself, Path { segments: path.segments, span: lo.to(self.prev_token.span) }))
     }
 
     /// Recover from an invalid single colon, when the user likely meant a qualified path.
@@ -103,11 +103,11 @@ impl<'a> Parser<'a> {
 
         self.diagnostic()
             .struct_span_err(
-                self.prev_span,
+                self.prev_token.span,
                 "found single colon before projection in qualified path",
             )
             .span_suggestion(
-                self.prev_span,
+                self.prev_token.span,
                 "use double colon",
                 "::".to_string(),
                 Applicability::MachineApplicable,
@@ -144,7 +144,7 @@ impl<'a> Parser<'a> {
         }
         self.parse_path_segments(&mut segments, style)?;
 
-        Ok(Path { segments, span: lo.to(self.prev_span) })
+        Ok(Path { segments, span: lo.to(self.prev_token.span) })
     }
 
     pub(super) fn parse_path_segments(
@@ -221,12 +221,12 @@ impl<'a> Parser<'a> {
                     let (args, constraints) =
                         self.parse_generic_args_with_leading_angle_bracket_recovery(style, lo)?;
                     self.expect_gt()?;
-                    let span = lo.to(self.prev_span);
+                    let span = lo.to(self.prev_token.span);
                     AngleBracketedArgs { args, constraints, span }.into()
                 } else {
                     // `(T, U) -> R`
                     let (inputs, _) = self.parse_paren_comma_seq(|p| p.parse_ty())?;
-                    let span = ident.span.to(self.prev_span);
+                    let span = ident.span.to(self.prev_token.span);
                     let output = self.parse_ret_ty(AllowPlus::No, RecoverQPath::No)?;
                     ParenthesizedArgs { inputs, output, span }.into()
                 };
@@ -412,13 +412,13 @@ impl<'a> Parser<'a> {
                     AssocTyConstraintKind::Equality { ty: self.parse_ty()? }
                 } else if self.eat(&token::Colon) {
                     AssocTyConstraintKind::Bound {
-                        bounds: self.parse_generic_bounds(Some(self.prev_span))?,
+                        bounds: self.parse_generic_bounds(Some(self.prev_token.span))?,
                     }
                 } else {
                     unreachable!();
                 };
 
-                let span = lo.to(self.prev_span);
+                let span = lo.to(self.prev_token.span);
 
                 // Gate associated type bounds, e.g., `Iterator<Item: Ord>`.
                 if let AssocTyConstraintKind::Bound { .. } = kind {
@@ -473,7 +473,7 @@ impl<'a> Parser<'a> {
         // lose that information after parsing.
         if !misplaced_assoc_ty_constraints.is_empty() {
             let mut err = self.struct_span_err(
-                args_lo.to(self.prev_span),
+                args_lo.to(self.prev_token.span),
                 "associated type bindings must be declared after generic parameters",
             );
             for span in misplaced_assoc_ty_constraints {