auto merge of #8573 : mrordinaire/rust/struct-new-as-field-name, r=alexcrichton
fix for #8088, along with a test.
This commit is contained in:
commit
00dd9e9cc5
4 changed files with 8 additions and 25 deletions
|
|
@ -13,8 +13,6 @@ struct s {
|
|||
//~^ ERROR obsolete syntax: `let` in field declaration
|
||||
bar: ();
|
||||
//~^ ERROR obsolete syntax: field declaration terminated with semicolon
|
||||
new() { }
|
||||
//~^ ERROR obsolete syntax: struct constructor
|
||||
}
|
||||
|
||||
struct q : r {
|
||||
|
|
|
|||
8
src/test/run-pass/struct-new-as-field-name.rs
Normal file
8
src/test/run-pass/struct-new-as-field-name.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
struct Foo {
|
||||
new: int,
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let foo = Foo{ new: 3 };
|
||||
assert_eq!(foo.new, 3);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue