about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2018-11-29 13:10:54 +0100
committerGitHub <noreply@github.com>2018-11-29 13:10:54 +0100
commit3b64f86beb82b78496a5d5fe3c43944ef7ebd95d (patch)
tree2a1c29c05f2b36c1b7f7d0a9d4e9d4df759ac583
parent1fe2085441c5c9afc1523c19c1c1ddbf86bae462 (diff)
parent66a2c39290daddf8cc32284fe635591b9dde4b0a (diff)
downloadrust-3b64f86beb82b78496a5d5fe3c43944ef7ebd95d.tar.gz
rust-3b64f86beb82b78496a5d5fe3c43944ef7ebd95d.zip
Rollup merge of #56330 - estebank:cleanup-span, r=zackmdavis
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 e0436cc7380..506199b60ad 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3952,7 +3952,7 @@ impl<'a> Parser<'a> {
                     );
                     err.emit();
                 }
-                self.bump();  // `..` || `...`:w
+                self.bump();  // `..` || `...`
 
                 if self.token == token::CloseDelim(token::Brace) {
                     etc_span = Some(etc_sp);
@@ -3972,7 +3972,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