Commit Graph

87 Commits

Author SHA1 Message Date
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
Jihyun Yu 95bc9ea26d Remove REC, change related tests/docs 2013-03-02 12:57:05 +09:00
Brian Anderson bcf626812b Rename core::private to core::unstable. #4743 2013-03-01 14:55:47 -08:00
Alex Crichton 2df07ddc25 Fix implicit leaks of imports throughout libraries
Also touch up use of 'pub' and move some tests around so the tested functions
don't have to be 'pub'
2013-02-28 18:00:34 -05:00
Patrick Walton 107bf96ff0 librustc: Mark all type implementations public. rs=impl-publicity 2013-02-28 11:32:24 -08:00
Patrick Walton 8d7e6ef772 libsyntax: Forbid ~mut and ~const. rs=demuting 2013-02-27 09:40:15 -08:00
Brian Anderson dab6a85230 core: Extract comm from pipes. #4742 2013-02-21 17:36:54 -08:00
Patrick Walton bf2a225c0b librustc: Separate most trait bounds with '+'. rs=plussing 2013-02-20 21:14:20 -08:00
Luqman Aden 4cf51c2531 libstd: Get rid of move. 2013-02-15 02:49:54 -08:00
Patrick Walton 9143688197 librustc: Replace impl Type : Trait with impl Trait for Type. rs=implflipping 2013-02-14 14:44:12 -08:00
Nick Desaulniers 4445b38df2 Remove die!, raplace invocations with fail! Issue #4524 pt 3 2013-02-13 17:01:32 -08:00
Niko Matsakis a32498d846 Make ~fn non-copyable, make &fn copyable, split barefn/closure types,
correct handling of moves for struct-record update.

Part of #3678.  Fixes #2828, #3904, #4719.
2013-02-07 05:53:30 -08:00
Brian Anderson e08a805b30 Merge remote-tracking branch 'bstrie/rimov' into incoming
Conflicts:
	src/libsyntax/parse/parser.rs
	src/test/bench/graph500-bfs.rs
	src/test/bench/sudoku.rs
	src/test/run-pass/borrowck-mut-vec-as-imm-slice.rs
	src/test/run-pass/empty-mutable-vec.rs
	src/test/run-pass/foreach-nested.rs
	src/test/run-pass/swap-2.rs
2013-02-04 11:58:30 -08:00
Nick Desaulniers aee7929469 Replace most invocations of fail keyword with die! macro 2013-01-31 20:12:49 -08:00
Ben Striegel dafd759b20 Repair RIMOV damage to libstd 2013-01-30 23:21:16 -05:00
Ben Striegel 0336a8633f RIMOV, round 10
find ./ -type f -name "*.rs" -exec sed -i "s/~\[mut /~\[/g" {} \;
2013-01-30 23:19:08 -05:00
Patrick Walton f1ddb2a32c libstd: De-export libstd. rs=deexport 2013-01-29 12:06:09 -08:00
Patrick Walton 6ce74460e6 librustc: Disallow trait bounds in types, enumerations, and structure definitions. r=tjc 2013-01-29 10:42:58 -08:00
Trinick 9dc8e96c5f core: Rename to_mut and from_mut to cast_to_mut and cast_from_mut 2013-01-23 10:09:45 +00:00
Nick Desaulniers bb7d7204e2 Swap return value order in pipes::oneshot Issue #4496 2013-01-15 17:18:00 -08:00
Tim Chevalier 9bb399a6d6 Merge pull request #4444 from JensNockert/pub-semaphore
Make std::sync::semaphore() public
2013-01-13 14:56:14 -08:00
Jens Nockert 6df643981b Make std::sync::semaphore() public 2013-01-11 12:51:16 +01:00
William Ting 9fd970ad13 Adds priv qualifiers where they have been commented out before implementation.
Updates #4386.
2013-01-11 02:30:10 -06:00
Patrick Walton 2db3abddcd librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc 2013-01-08 22:02:35 -08:00
Patrick Walton 44ab00ee37 Revert "librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc"
This reverts commit a8d37af247.
2013-01-08 19:29:16 -08:00
Patrick Walton a8d37af247 librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc 2013-01-08 19:27:57 -08:00
Patrick Walton 13879d8e9f libstd: Fix tests. rs=bustage 2012-12-28 12:48:27 -08:00
Patrick Walton fa5ee934ed libstd: Fix a bunch of resolve errors in tests. rs=fire 2012-12-27 18:24:18 -08:00
Patrick Walton 57c599914a librustc: Terminate name searches at the nearest module scope for paths that contain at least two components. r=graydon 2012-12-27 10:02:54 -08:00
Brian Anderson ed4fac01b5 Rename Send trait to Owned 2012-12-13 15:52:50 -08:00
Tim Chevalier 38bd694df1 Reverse the order of the results of pipes::stream
As per #3637.
2012-12-11 19:23:28 -08:00
Tim Chevalier 7a365e4aa4 make bblum happy 2012-12-06 21:53:25 -08:00
Graydon Hoare 00c856c0b1 Update license, add license boilerplate to most files. Remainder will follow. 2012-12-03 17:12:14 -08:00
Patrick Walton 9e1c9be16f librustc: Make the Drop trait use explicit self 2012-11-29 11:06:15 -08:00
Brian Anderson b21e9d52de core: Add Clone trait 2012-11-27 11:08:19 -08:00
Ben Striegel 4589597785 Convert libstd to use the Drop trait 2012-11-14 16:15:34 -08:00
Brian Anderson c44c9a47d8 Revert "Convert libstd to use the Drop trait"
This reverts commit 28c7a25151.
2012-11-14 14:51:16 -08:00
Ben Striegel 28c7a25151 Convert libstd to use the Drop trait 2012-11-14 12:40:44 -08:00
Tim Chevalier 11e92f37c1 Remove uses of binary move - <- - from tests and libraries 2012-10-23 12:10:03 -07:00
Tim Chevalier 90d06b80fd Make moves explicit in std tests 2012-10-12 20:43:37 -07:00
Tim Chevalier d2efd7edf7 Update FIXME number 2012-10-11 16:00:30 -07:00
Tim Chevalier 8fc60af441 Remove by-copy mode from std, mostly
One instance remains in net_tcp due to a foreign fn. Lots of
instances remain in serialization.rs, but IIRC that is being removed.

I had to do unholy things to task-perf-word-count-generic to get it
to compile after demoding pipes. I may well have messed up its
performance, but it passes.
2012-10-04 19:59:47 -07:00
Tim Chevalier fe12da0864 De-mode comm::Chan 2012-10-04 16:48:57 -07:00
Tim Chevalier f33539e446 Remove uses of + mode from libstd
More or less the same as my analogous commit for libcore. Had
to remove the forbid(deprecated_modes) pragma from some files -- will
restore it after the snapshot.
2012-10-03 14:05:51 -07:00
Tim Chevalier b18320446e Move over to calling ptr::addr_of
Everything should now call ptr::addr_of instead of
ptr::p2::addr_of. Only the pipes macro code when compiled
by stage0 will call ptr::p2::addr_of. Needs a snapshot to get
rid of that.
2012-10-01 15:12:09 -07:00
Graydon Hoare 43a9d90b48 De-export std::{arc,comm,sync}. Part of #3583. 2012-09-28 16:05:45 -07:00
Brian Anderson bc9efaad9c std: Eliminate deprecated patterns 2012-09-28 00:22:28 -07:00
Niko Matsakis 67a8e7128a Demode vec::push (and convert to method) 2012-09-26 18:02:07 -07:00
Niko Matsakis ba3eebd41d Make it illegal to use modes in a fn signature with providing
an explicit variable name. (Step one to changing the defaults)

First step to #3535
2012-09-23 13:30:13 -05:00
Niko Matsakis 3d59ac3a19 De-mode vec::map, vec::eachi, vec::rev_each, vec::rev_eachi 2012-09-21 19:13:55 -07:00