about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2018-11-28 16:05:02 -0800
committerEsteban Küber <esteban@kuber.com.ar>2018-11-28 16:05:02 -0800
commit66a2c39290daddf8cc32284fe635591b9dde4b0a (patch)
treea8360d172aad8a4627b4e355236d8bdac28f8541
parent423291f14bbb820265b2bbf33d6fffb044035b86 (diff)
downloadrust-66a2c39290daddf8cc32284fe635591b9dde4b0a.tar.gz
rust-66a2c39290daddf8cc32284fe635591b9dde4b0a.zip
Clean up span in non-trailing `..` suggestion
-rw-r--r--src/libsyntax/parse/parser.rs4
-rw-r--r--src/test/ui/issues/issue-49257.stderr8
2 files changed, 6 insertions, 6 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index e2f09affd4f..ac0bde7856a 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3956,7 +3956,7 @@ impl<'a> Parser<'a> {
                     );
                     err.emit();
                 }
-                self.bump();  // `..` || `...`:w
+                self.bump();  // `..` || `...`
 
                 if self.token == token::CloseDelim(token::Brace) {
                     etc_span = Some(etc_sp);
@@ -3976,7 +3976,7 @@ impl<'a> Parser<'a> {
                     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 {
diff --git a/src/test/ui/issues/issue-49257.stderr b/src/test/ui/issues/issue-49257.stderr
index 40179832b49..644df1f56b4 100644
--- a/src/test/ui/issues/issue-49257.stderr
+++ b/src/test/ui/issues/issue-49257.stderr
@@ -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