rust/src/libsyntax
bors 5aca7d6aef auto merge of #5137 : yjh0502/rust/empty_struct, r=nikomatsakis
The fix is straight-forward, but there are several changes
while fixing the issue.

1) disallow `mut` keyword when making a new struct

In code base, there are following code,

```rust
struct Foo { mut a: int };
let a = Foo { mut a: 1 };
```

This is because of structural record, which is
deprecated corrently (see issue #3089) In structural
record, `mut` keyword should be allowd to control
mutability. But without structural record, we don't
need to allow `mut` keyword while constructing struct.

2) disallow structural records in parser level
This is related to 1). With structural records, there
is an ambiguity between empty block and empty struct
To solve the problem, I change parser to stop parsing
structural records. I think this is not a problem,
because structural records are not compiled already.

Misc. issues

There is an ambiguity between empty struct vs. empty match stmt.
with following code,

```rust
match x{} {}
```

Two interpretation is possible, which is listed blow

```rust
match (x{}) {} //  matching with newly-constructed empty struct
(match x{}) {}  //  matching with empty enum(or struct) x
                //  and then empty block
```

It seems that there is no such code in rust code base, but
there is one test which uses empty match statement:
https://github.com/mozilla/rust/blob/incoming/src/test/run-pass/issue-3037.rs

All other cases could be distinguished with look-ahead,
but this can't be. One possible solution is wrapping with
parentheses when matching with an uninhabited type.

```rust
enum what { }
fn match_with_empty(x: what) -> ~str {
    match (x) { //use parentheses to remove the ambiguity
    }
}
```
2013-03-02 04:21:38 -08:00
..
ext auto merge of #5165 : brson/rust/unstable, r=brson 2013-03-01 19:45:41 -08:00
parse Remove REC, change related tests/docs 2013-03-02 12:57:05 +09:00
print auto merge of #5137 : yjh0502/rust/empty_struct, r=nikomatsakis 2013-03-02 04:21:38 -08:00
util libsyntax: Remove all mutable fields from libsyntax. rs=demuting 2013-02-22 16:09:16 -08:00
ast.rs librustc: Mark all type implementations public. rs=impl-publicity 2013-02-28 11:32:24 -08:00
ast_map.rs Fix implicit leaks of imports throughout libraries 2013-02-28 18:00:34 -05:00
ast_util.rs Fix implicit leaks of imports throughout libraries 2013-02-28 18:00:34 -05:00
attr.rs convert ast::meta_items to take @~strs 2013-02-19 10:02:52 -08:00
codemap.rs librustc: Forbid pub or priv before trait implementations 2013-02-27 09:40:16 -08:00
diagnostic.rs libsyntax: De-mut the pipe compiler 2013-02-22 16:09:15 -08:00
fold.rs Remove legacy object creation mode, and convert remaining uses of it 2013-02-28 20:28:04 -05:00
opt_vec.rs Avoid calling to_vec() unnecessarily in parser. 2013-03-01 19:58:17 -05:00
syntax.rc librustc: "APL2" -> "ASL2". rs=license-fix 2013-03-01 08:41:31 -08:00
visit.rs Fix implicit leaks of imports throughout libraries 2013-02-28 18:00:34 -05:00