diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index efeace4f05ecc..38647bec982cc 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3208,7 +3208,7 @@ impl<'a> Parser<'a> { if let Some(suffix) = suffix { let mut err = self.diagnostic().struct_span_err( span, - "tuple index with a suffix is invalid", + "suffixes on tuple indexes are invalid", ); err.span_label(span, format!("invalid suffix `{}`", suffix)); err.emit(); diff --git a/src/test/ui/parser/issue-59418.rs b/src/test/ui/parser/issue-59418.rs index 33ad11bb0b011..cab37e0d80920 100644 --- a/src/test/ui/parser/issue-59418.rs +++ b/src/test/ui/parser/issue-59418.rs @@ -3,7 +3,11 @@ struct X(i32,i32,i32); fn main() { let a = X(1, 2, 3); let b = a.1suffix; - //~^ ERROR tuple index with a suffix is invalid + //~^ ERROR suffixes on tuple indexes are invalid println!("{}", b); + let c = (1, 2, 3); + let d = c.1suffix; + //~^ ERROR suffixes on tuple indexes are invalid + println!("{}", d); } diff --git a/src/test/ui/parser/issue-59418.stderr b/src/test/ui/parser/issue-59418.stderr index c06b950f60119..e50780de4f96b 100644 --- a/src/test/ui/parser/issue-59418.stderr +++ b/src/test/ui/parser/issue-59418.stderr @@ -1,8 +1,14 @@ -error: tuple index with a suffix is invalid +error: suffixes on tuple indexes are invalid --> $DIR/issue-59418.rs:5:15 | LL | let b = a.1suffix; | ^^^^^^^ invalid suffix `suffix` -error: aborting due to previous error +error: suffixes on tuple indexes are invalid + --> $DIR/issue-59418.rs:9:15 + | +LL | let d = c.1suffix; + | ^^^^^^^ invalid suffix `suffix` + +error: aborting due to 2 previous errors