From c9d05aa9ceb82f31a86a548eaaffab8bdb229d76 Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Wed, 4 Sep 2019 17:36:01 -0700 Subject: Point at correct span for parenthesized types --- src/libsyntax/parse/parser/path.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/libsyntax/parse/parser') diff --git a/src/libsyntax/parse/parser/path.rs b/src/libsyntax/parse/parser/path.rs index dcd3c648017..f6df24c0568 100644 --- a/src/libsyntax/parse/parser/path.rs +++ b/src/libsyntax/parse/parser/path.rs @@ -129,10 +129,11 @@ impl<'a> Parser<'a> { self.parse_path(style) } - crate fn parse_path_segments(&mut self, - segments: &mut Vec, - style: PathStyle) - -> PResult<'a, ()> { + crate fn parse_path_segments( + &mut self, + segments: &mut Vec, + style: PathStyle, + ) -> PResult<'a, ()> { loop { let segment = self.parse_path_segment(style)?; if style == PathStyle::Expr { @@ -196,12 +197,12 @@ impl<'a> Parser<'a> { let (args, constraints) = self.parse_generic_args_with_leaning_angle_bracket_recovery(style, lo)?; self.expect_gt()?; - let span = lo.to(self.prev_span); + let span = ident.span.to(self.prev_span); AngleBracketedArgs { args, constraints, span }.into() } else { // `(T, U) -> R` let (inputs, _) = self.parse_paren_comma_seq(|p| p.parse_ty())?; - let span = lo.to(self.prev_span); + let span = ident.span.to(self.prev_span); let output = if self.eat(&token::RArrow) { Some(self.parse_ty_common(false, false, false)?) } else { -- cgit 1.4.1-3-g733a5