diff options
| author | Do Nhat Minh <mrordinaire@gmail.com> | 2013-08-17 14:43:13 +0800 |
|---|---|---|
| committer | Do Nhat Minh <mrordinaire@gmail.com> | 2013-08-18 00:07:14 +0800 |
| commit | 4457d2b379c40415ac95d7cb7d98508bb919ff36 (patch) | |
| tree | dad2ae4c54973b210d64da8dd10292b7566d9b89 /src/test | |
| parent | a1674b6150b20616c954e37206012b356ff81b1c (diff) | |
| download | rust-4457d2b379c40415ac95d7cb7d98508bb919ff36.tar.gz rust-4457d2b379c40415ac95d7cb7d98508bb919ff36.zip | |
fix for #8088 (Cannot name a struct field `new` due to ancient syntax)
remove code for parsing ancient syntax added a run-pass test
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/obsolete-syntax.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/struct-new-as-field-name.rs | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/test/compile-fail/obsolete-syntax.rs b/src/test/compile-fail/obsolete-syntax.rs index 8ba5e2815a5..49af0972341 100644 --- a/src/test/compile-fail/obsolete-syntax.rs +++ b/src/test/compile-fail/obsolete-syntax.rs @@ -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 { diff --git a/src/test/run-pass/struct-new-as-field-name.rs b/src/test/run-pass/struct-new-as-field-name.rs new file mode 100644 index 00000000000..fb93c560e0d --- /dev/null +++ b/src/test/run-pass/struct-new-as-field-name.rs @@ -0,0 +1,8 @@ +struct Foo { + new: int, +} + +pub fn main() { + let foo = Foo{ new: 3 }; + assert_eq!(foo.new, 3); +} |
