Skip to content

Commit 5c022af

Browse files
lambtowolfpietroalbini
authored andcommitted
Issue rust-lang#50974: Adding tests
1 parent 783815d commit 5c022af

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/test/ui/struct-duplicate-comma.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
11+
// compile-flags: -Z parse-only
12+
13+
struct Foo {
14+
a: u8,
15+
b: u8
16+
}
17+
18+
fn main() {
19+
let bar = Foo {
20+
a: 0,,
21+
//~^ ERROR expected identifier
22+
b: 42
23+
};
24+
}
25+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error: expected identifier, found `,`
2+
--> $DIR/struct-duplicate-comma.rs:20:14
3+
|
4+
LL | let bar = Foo {
5+
| --- while parsing this struct
6+
LL | a: 0,,
7+
| ^
8+
| |
9+
| expected identifier
10+
| help: remove this comma: `,`
11+
12+
error: aborting due to previous error
13+

0 commit comments

Comments
 (0)