Commit Graph

22311 Commits

Author SHA1 Message Date
Niko Matsakis
a5ad4c3794 Delay assignment of node ids until after expansion. Ensures that each AST node
has a unique id. Fixes numerous bugs in macro expansion and deriving. Add two
representative tests.

Fixes #7971
Fixes #6304
Fixes #8367
Fixes #8754
Fixes #8852
Fixes #2543
Fixes #7654
2013-09-10 05:45:12 -04:00
Felix S. Klock II
ed37da2f79 middle/entry.rs Visitor refactoring (#7081): unify Entry{Context,Visitor}. 2013-09-10 11:25:10 +02:00
Felix S. Klock II
6724317dad gather_loans/mod.rs Visitor refactoring (#7081): unify GatherLoan{Ctxt,Visitor}. 2013-09-10 11:25:09 +02:00
Felix S. Klock II
959d9d60e1 check_loans.rs Visitor refactoring (#7081): unify CheckLoan{Ctxt,Visitor}. 2013-09-10 11:25:09 +02:00
bors
96da35611f auto merge of #9090 : jbclements/rust/let-var-hygiene, r=luqmana
This appears to fix issue #9049. It also re-enables the ICE check on comparing idents for equality; it appears that ICEs are better than seg faults.
2013-09-10 01:06:00 -07:00
Felix S. Klock II
8b00004871 Remove oldvisit.rs (yay!); part of #7081 refactoring. 2013-09-10 09:00:53 +02:00
bors
485446b97f auto merge of #9076 : blake2-ppc/rust/test-for-8585, r=huonw
The issue #8587 is fixed (the original testcase now passes); add that testcase to the suite.


Fixes #8587.
2013-09-09 22:41:03 -07:00
John Clements
634bddde05 added run-pass test for issue #9049 2013-09-09 22:38:45 -07:00
bors
7820fb5ca9 auto merge of #9062 : blake2-ppc/rust/vec-iterator, r=alexcrichton
Visit the free functions of std::vec and reimplement or remove some. Most prominently, remove `each_permutation` and replace with two iterators, ElementSwaps and Permutations.

Replace unzip, unzip_slice with an updated `unzip` that works with an iterator argument.

Replace each_permutation with a Permutation iterator. The new permutation iterator is more efficient since it uses an algorithm that produces permutations in an order where each is only one element swap apart, including swapping back to the original state with one swap at the end.

Unify the seldomly used functions `build`, `build_sized`, `build_sized_opt` into just one function `build`.

Remove `equal_sizes`
2013-09-09 21:31:03 -07:00
John Clements
57f7abaf19 undo cowardly hiding of eq-check
I've reversed my thinking on this restrictive definition of eq after
two separate bugs were hidden by commenting it out; it's better to
get ICEs than SIGSEGV's, any day.

RE-ENABLING ICE MACHINE!
2013-09-09 20:50:41 -07:00
blake2-ppc
c11ee0fb67 std::at_vec and vec: Unify build_sized, build_sized_opt into build
These functions have very few users since they are mostly replaced by
iterator-based constructions.

Convert a few remaining users in-tree, and reduce the number of
functions by basically renaming build_sized_opt to build, and removing
the other two. This for both the vec and the at_vec versions.
2013-09-10 05:50:11 +02:00
blake2-ppc
5f69a58e0c std::vec: Remove the function same_length
The basic construct x.len() == y.len() is just as simple.

This function used to be a precondition (not sure about the
terminology), so it had to be a function. This is not relevant any more.
2013-09-10 05:50:07 +02:00
blake2-ppc
77dff93a4b std::vec: Update module doc text
Update for a lot of changes (not many free functions left), add examples
of the important methods `slice` and `push`, and write a short bit about
iteration.
2013-09-10 05:50:06 +02:00
blake2-ppc
de9546a3f8 std::vec: Replace each_permutation with a new Permutations iterator
Introduce ElementSwaps and Permutations. ElementSwaps is an iterator
that for a given sequence length yields the element swaps needed
to visit each possible permutation of the sequence in turn.

We use an algorithm that generates a sequence such that each permutation
is only one swap apart.

    let mut v = [1, 2, 3];
    for perm in v.permutations_iter() {
        // yields 1 2 3 | 1 3 2 | 3 1 2 | 3 2 1 | 2 3 1 | 2 1 3
    }

The `.permutations_iter()` yields clones of the input vector for each
permutation.

If a copyless traversal is needed, it can be constructed with
`ElementSwaps`:

    for (a, b) in ElementSwaps::new(3) {
        // yields (2, 1), (1, 0), (2, 1) ...
        v.swap(a, b);
        // ..
    }
2013-09-10 05:50:06 +02:00
John Clements
42b1694cca ident->name in middle 2013-09-09 20:47:39 -07:00
blake2-ppc
6212729315 std::vec: Change fn unzip to take an iterator argument
Remove unzip_slice since it's redundant. Old unzip is equivalent to the
`|x| unzip(x.move_iter())`
2013-09-10 05:39:59 +02:00
bors
8c7c0b41d7 auto merge of #9034 : catamorphism/rust/rustpkg-workcache, r=metajack
r? @metajack or @brson - This pull request makes rustpkg use the workcache library to avoid recompilation.
2013-09-09 20:16:02 -07:00
bors
af259a651d auto merge of #9086 : pcwalton/rust/writeback-port, r=brson
r? @brson or @pnkfelix
2013-09-09 19:06:02 -07:00
bors
d41b558792 auto merge of #9089 : anasazi/rust/fix-acceptor-iterator, r=cmr
The iterator over incoming connections has no natural end, so it should always return Some(_).
Currently, if an incoming connection fails, the iterator returns None.
Trying to accept another connection afterwards enters the realm of undefined behavior (due to the iterator protocol being silent on the issue).

This PR changes wraps the underlying accept call in Some, so the iterator never finishes.
2013-09-09 16:26:03 -07:00
bors
ed695d470b auto merge of #9083 : dcrewi/rust/biguint-bit-ops, r=brson 2013-09-09 14:10:58 -07:00
Patrick Walton
2a0dd97675 librustc: Port writeback to the new API. 2013-09-09 14:10:58 -07:00
bors
54ae2800ff auto merge of #9071 : thestinger/rust/noalias, r=alexcrichton
This also removes a FIXME I added referring to a now closed issue.
2013-09-09 13:01:02 -07:00
bors
60a0dbc095 auto merge of #9033 : alexcrichton/rust/libuv-makefile-dep, r=brson
This way the rule isn't always built whenever you fire off a new build
2013-09-09 11:51:03 -07:00
Daniel Micay
889e1b9731 add noalias attribute to ~ return values 2013-09-09 13:48:54 -04:00
bors
059cbaadfa auto merge of #9005 : alexcrichton/rust/rusty-log, r=brson
Also redefine all of the standard logging macros to use more rust code instead
of custom LLVM translation code. This makes them a bit easier to understand, but
also more flexibile for future types of logging.

Additionally, this commit removes the LogType language item in preparation for
changing how logging is performed.
2013-09-09 10:41:05 -07:00
David Creswick
c3d0fc23d4 Implement bitwise operations on BigUint 2013-09-09 12:15:19 -05:00
David Creswick
4946e0ea5e Merge RandBigUint and RandBigInt into single trait 2013-09-09 11:31:40 -05:00
David Creswick
9bee3d7e5b Convert between BigInts, BigUints, ints, and uints
Previously, conversion to ints, uints, and BigUints clamped the value
within the range of that datatype. With this commit, conversion
overflows fail the task. To handle overflows gracefully, use the new
to_*_opt() methods.
2013-09-09 11:15:03 -05:00
blake2-ppc
5ecd3b4053 Add test for issue #8587, about calling nested functions of the same name 2013-09-09 16:01:42 +02:00
bors
fd2488bf5a auto merge of #9051 : bjz/rust/master, r=huonw 2013-09-09 06:06:04 -07:00
bors
7e2827b99d auto merge of #9059 : Kimundi/rust/master, r=huonw
- Marked a unsafe helper function as unsafe, added a second helper function
- Added moving implementations
2013-09-09 04:51:05 -07:00
Marvin Löbel
3a3934244c Some work on std::ascii: Marked unsafe function unsafe, added moving implementations 2013-09-09 15:07:22 +02:00
bors
fd49f6dce1 auto merge of #9073 : alexcrichton/rust/remove-local-data-hax, r=huonw
These compiler bugs have since been fixed (one less layer of indirection)
2013-09-09 02:36:06 -07:00
Alex Crichton
500077f637 Remove hacks around issues in local_data
These compiler bugs have since been fixed (one less layer of indirection)
2013-09-09 01:01:23 -07:00
bors
d09f569aac auto merge of #9065 : thestinger/rust/iter, r=alexcrichton
The trait will keep the `Iterator` naming, but a more concise module
name makes using the free functions less verbose. The module will define
iterables in addition to iterators, as it deals with iteration in
general.
2013-09-09 00:26:07 -07:00
Daniel Micay
6919cf5fe1 rename std::iterator to std::iter
The trait will keep the `Iterator` naming, but a more concise module
name makes using the free functions less verbose. The module will define
iterables in addition to iterators, as it deals with iteration in
general.
2013-09-09 03:21:46 -04:00
bors
eae327032c auto merge of #9066 : thestinger/rust/repr, r=alexcrichton 2013-09-08 22:16:07 -07:00
Tim Chevalier
a8194edef8 rustpkg: Address review comments from Jack 2013-09-08 22:00:49 -07:00
Tim Chevalier
ed4859ea78 extra: Address review comments from Jack 2013-09-08 22:00:13 -07:00
Daniel Micay
db4720bdfa repr: update for removal of const 2013-09-08 23:17:19 -04:00
Daniel Micay
ec7cd77bd0 repr: write the mutability qualifier for slices 2013-09-08 23:14:46 -04:00
Tim Chevalier
02a0fb94ee rustpkg: Use workcache
rustpkg now uses the workcache library to avoid recompilation.
Hooray!
2013-09-08 20:05:12 -07:00
Tim Chevalier
bb30f047f6 workcache: Add the ability to save and load the database...
...as well as the ability to discover inputs and outputs.
2013-09-08 20:05:11 -07:00
Jakub
7173b9d1b8 Fix pretty-printing of empty impl items 2013-09-08 22:44:24 +00:00
bors
dd5c7379e9 auto merge of #8988 : cmr/rust/fromstr_fn, r=brson
It just calls out to the associated function on the trait.
2013-09-08 12:05:55 -07:00
Corey Richardson
e0e5523552 Fix import order which caused the wrong from_str to be in scope 2013-09-08 15:00:00 -04:00
Brendan Zabarauskas
2c31053d20 Fix unused import warnings on 32bit systems 2013-09-09 03:51:29 +10:00
bors
d36612d65b auto merge of #9054 : huonw/rust/labelled-for, r=thestinger
The following parses and works as expected with this change:

```rust
'foo: for i in range(0, 10) {
    for j in range(0, 10) {
        if i + j == 15 { break 'foo; }
    }
}
```
2013-09-08 07:45:57 -07:00
Huon Wilson
14183114e1 syntax: aesthetic improvements to the for desugaring. 2013-09-08 23:00:05 +10:00
Huon Wilson
07351b44c6 syntax: implement labelled breaks for for.
`for` desugars to `loop` so it is trivial to just desugar to `loop` while
retaining any label.
2013-09-08 22:08:01 +10:00