File tree 3 files changed +48
-0
lines changed
3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -3866,6 +3866,9 @@ impl<'a> Parser<'a> {
3866
3866
// check that a comma comes after every field
3867
3867
if !ate_comma {
3868
3868
let err = self . struct_span_err ( self . prev_span , "expected `,`" ) ;
3869
+ if let Some ( mut delayed) = delayed_err {
3870
+ delayed. emit ( ) ;
3871
+ }
3869
3872
return Err ( err) ;
3870
3873
}
3871
3874
ate_comma = false ;
Original file line number Diff line number Diff line change
1
+ // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+ struct MyStruct {
11
+ pub s1 : Option < String > ,
12
+ }
13
+
14
+ fn main ( ) {
15
+ let thing = MyStruct { s1 : None } ;
16
+
17
+ match thing {
18
+ MyStruct { .., Some( _) } => { } ,
19
+ _ => { }
20
+ }
21
+ }
Original file line number Diff line number Diff line change
1
+ error: expected `}`, found `,`
2
+ --> $DIR/issue-54379.rs:18:22
3
+ |
4
+ LL | MyStruct { .., Some(_) } => {},
5
+ | --^
6
+ | | |
7
+ | | expected `}`
8
+ | `..` must be at the end and cannot have a trailing comma
9
+
10
+ error: expected `,`
11
+ --> $DIR/issue-54379.rs:18:24
12
+ |
13
+ LL | MyStruct { .., Some(_) } => {},
14
+ | ^^^^
15
+
16
+ error[E0027]: pattern does not mention field `s1`
17
+ --> $DIR/issue-54379.rs:18:9
18
+ |
19
+ LL | MyStruct { .., Some(_) } => {},
20
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ missing field `s1`
21
+
22
+ error: aborting due to 3 previous errors
23
+
24
+ For more information about this error, try `rustc --explain E0027`.
You can’t perform that action at this time.
0 commit comments