]> git.lizzy.rs Git - rust.git/commitdiff
Clean up span in non-trailing `..` suggestion
authorEsteban Küber <esteban@kuber.com.ar>
Thu, 29 Nov 2018 00:05:02 +0000 (16:05 -0800)
committerEsteban Küber <esteban@kuber.com.ar>
Thu, 29 Nov 2018 00:05:02 +0000 (16:05 -0800)
src/libsyntax/parse/parser.rs
src/test/ui/issues/issue-49257.stderr

index e2f09affd4fea5cd823b6a9d3552aee36b1a06f9..ac0bde7856ab26bc077f6f04f34587b246117ca3 100644 (file)
@@ -3956,7 +3956,7 @@ fn parse_pat_fields(&mut self) -> PResult<'a, (Vec<source_map::Spanned<ast::Fiel
                     );
                     err.emit();
                 }
-                self.bump();  // `..` || `...`:w
+                self.bump();  // `..` || `...`
 
                 if self.token == token::CloseDelim(token::Brace) {
                     etc_span = Some(etc_sp);
@@ -3976,7 +3976,7 @@ fn parse_pat_fields(&mut self) -> PResult<'a, (Vec<source_map::Spanned<ast::Fiel
                     ate_comma = true;
                 }
 
-                etc_span = Some(etc_sp);
+                etc_span = Some(etc_sp.until(self.span));
                 if self.token == token::CloseDelim(token::Brace) {
                     // If the struct looks otherwise well formed, recover and continue.
                     if let Some(sp) = comma_sp {
index 40179832b49b271bee71a2151c2ec9ecc1a6775a..644df1f56b426a4507ef64e7f221cc02d19869ac 100644 (file)
@@ -8,8 +8,8 @@ LL |     let Point { .., y, } = p; //~ ERROR expected `}`, found `,`
    |                 `..` must be at the end and cannot have a trailing comma
 help: move the `..` to the end of the field list
    |
-LL |     let Point {  y, .. } = p; //~ ERROR expected `}`, found `,`
-   |                --   ^^^^
+LL |     let Point { y, .. } = p; //~ ERROR expected `}`, found `,`
+   |                --  ^^^^
 
 error: expected `}`, found `,`
   --> $DIR/issue-49257.rs:21:19
@@ -21,8 +21,8 @@ LL |     let Point { .., y } = p; //~ ERROR expected `}`, found `,`
    |                 `..` must be at the end and cannot have a trailing comma
 help: move the `..` to the end of the field list
    |
-LL |     let Point {  y , .. } = p; //~ ERROR expected `}`, found `,`
-   |                --  ^^^^^^
+LL |     let Point { y , .. } = p; //~ ERROR expected `}`, found `,`
+   |                -- ^^^^^^
 
 error: expected `}`, found `,`
   --> $DIR/issue-49257.rs:22:19