Commit Graph

32899 Commits

Author SHA1 Message Date
Brian Koropoff
ea3ab731a3 Track kind of closure in upvar categorization
Keep track of the kind of closure responsible for an upvar
2014-10-05 00:23:33 -07:00
bors
20f4c45bad auto merge of #17769 : dotdash/rust/snapshot, r=eddyb 2014-10-04 13:52:09 +00:00
Björn Steinbrink
2d93a0406b Register new snapshots 2014-10-04 15:44:50 +02:00
bors
749ff5e76a auto merge of #17755 : alexcrichton/rust/unblock-snapshot, r=eddyb
Hopefully unblocks a snapshot
2014-10-04 06:12:08 +00:00
bors
8794107f74 auto merge of #17754 : O-I/rust/update-guide, r=steveklabnik
Hi,

These are a few small edits to the Guide that I made while reading online. Really well done and approachable.

I have a few questions below, but I don't know if this is the proper place to ask them, so feel free to ignore the below.

1. Trailing commas seem to be a convention in Rust and are used quite a bit throughout the Guide, but are never explicitly mentioned. Maybe adding a short mention about them when they first appear in the Structs section might be helpful to those who are unfamiliar with or don't use them in other languages.

2. In the Iterators section, there is a block of code like this:

```rust
let mut range = range(0i, 10i);

loop {
    match range.next() {
        Some(x) => {
            println!("{}", x);
        }  // no comma needed?
        None => { break }
    }
}
```

My inclination would be to put a comma where the comment is to separate the two arms to get this to compile, but it runs fine either way. Is there a convention on commas for scenarios like this where each arm is enclosed in `{}`?

All the best,
O-I
2014-10-04 04:27:05 +00:00
bors
908c9e6a1b auto merge of #17752 : SimonSapin/rust/patch-6, r=thestinger
`v.len()` counts code units, not UTF-16 bytes. The lower bound is one UTF-8 byte per code unit, not per two code units.

I believe this is correct, but it’s late. Someone please double check.
2014-10-04 02:42:07 +00:00
bors
136ab3c6b1 auto merge of #17731 : bkoropoff/rust/unboxed-by-ref, r=pcwalton
This began as an attempt to fix an ICE in borrowck (issue #17655), but the rabbit hole went pretty deep.  I ended up plumbing support for capture-by-reference unboxed closures all the way into trans.

Closes issue #17655.
2014-10-04 00:17:04 +00:00
Alex Crichton
1e22b20884 test: Fix a test that fails when cross compiling
Hopefully unblocks a snapshot
2014-10-03 16:13:33 -07:00
bors
c348550f4f auto merge of #17743 : steveklabnik/rust/receiver_fix, r=alexcrichton 2014-10-03 22:32:02 +00:00
Rahul Horé
9040948ef3 Adds comma
Oddly (to me), this code runs fine without the comma separating the `Some` and `None` arms of the `match` construct. It seems like Rust doesn't require you to separate arms with commas if all the expressions are enclosed in braces.
2014-10-03 16:40:58 -04:00
Simon Sapin
80eb616bd3 Fix preallocation amount in String::from_utf16
`v.len()` counts code units, not UTF-16 bytes. The lower bound is one UTF-8 byte per code unit, not per two code units.
2014-10-03 21:20:04 +01:00
Rahul Horé
083b46dd29 Fixes wording 2014-10-03 15:59:57 -04:00
Rahul Horé
0eb4df9ace Removes extra . 2014-10-03 15:41:59 -04:00
Rahul Horé
d3f8f8a849 Adds missing cd 2014-10-03 14:47:57 -04:00
bors
ae81c89f34 auto merge of #17742 : alexcrichton/rust/rollup, r=alexcrichton
Trying to get a couple of these into the next snapshot.
2014-10-03 18:47:13 +00:00
Alex Crichton
39f4bf7b1c Test fixes from the rollup 2014-10-03 11:43:15 -07:00
Rahul Horé
816c56e1d5 Use similar syntax in all arms
See issue #17672. This was started in commit ee1cbb9c71, but there were a few more lines to update.
2014-10-03 14:41:55 -04:00
Rahul Horé
060224af68 Fixes output 2014-10-03 13:59:32 -04:00
Rahul Horé
e8ddad18e8 Adds trailing comma 2014-10-03 13:50:42 -04:00
Rahul Horé
8a6342f751 Fixes spacing 2014-10-03 13:37:05 -04:00
Steve Klabnik
71f752bbc4 Update signature of try_recv() 2014-10-03 11:58:52 -04:00
Alex Crichton
48cdb55d79 rollup merge of #17739 : eddyb/fix-process-test 2014-10-03 07:39:45 -07:00
Alex Crichton
4b6733ec88 rollup merge of #17741 : alexcrichton/travis-again 2014-10-03 07:38:45 -07:00
Alex Crichton
8993a0aeba rollup merge of #17730 : alexcrichton/snapshot 2014-10-03 07:38:41 -07:00
Alex Crichton
79d0e82f73 rollup merge of #17729 : alexcrichton/issue-17718-start 2014-10-03 07:38:29 -07:00
Alex Crichton
61c4f6dcd9 rollup merge of #17387 : sneves/master 2014-10-03 07:38:22 -07:00
Alex Crichton
2a11f2b544 rollup merge of #17215 : P1start/lints 2014-10-03 07:38:12 -07:00
Alex Crichton
7b6ecc009c travis: Fix for real this time
I ended up botching the merge when making the rollup, and the fix was to just
not configure LLVM all via --llvm-root with a nonexistent path.
2014-10-03 07:25:10 -07:00
Eduard Burtescu
ef693885a7 Fix a race condition between remove_from_env and other io::process tests. 2014-10-03 17:16:05 +03:00
Eduard Burtescu
da7dcee8f1 tests: remove old compile-fail test asserting the removal of const. 2014-10-03 14:26:07 +03:00
Brian Koropoff
521ca31071 Add some more test coverage of by-ref unboxed closures 2014-10-03 00:57:21 -07:00
P1start
a667a6917b Move the lint for the stability lints to the method name only
Closes #17337.
2014-10-03 20:39:57 +13:00
P1start
f56c67ba86 Change rustc pretty-printing to print [T, ..n] instead of [T, .. n] 2014-10-03 20:39:56 +13:00
P1start
073a1abff2 Report trait/impl sig inconsistency before method/body inconsistency
Closes #15657.
2014-10-03 20:39:56 +13:00
P1start
042cdeefc7 Correct error message for invalid ref/mut bindings
Closes #15914.
2014-10-03 20:39:56 +13:00
P1start
45044124e4 Improve the non_snake_case lint to give better suggestions 2014-10-03 20:39:56 +13:00
P1start
333592edde Update the unused lint group to include more lints 2014-10-03 20:39:56 +13:00
P1start
94bcd3539c Set the non_uppercase_statics lint to warn by default 2014-10-03 20:39:56 +13:00
bors
9a2286d3a1 auto merge of #16995 : kmcallister/rust/plugin-tutorial, r=alexcrichton
@steveklabnik, are you interested in looking this over?
2014-10-03 07:33:26 +00:00
bors
aa034cd3ba auto merge of #17725 : alexcrichton/rust/rollup, r=alexcrichton 2014-10-03 05:02:37 +00:00
Brian Koropoff
39344c2d7e Rehabilitate an unboxed closure test
This test works as a regression test for issue #17655.  It also
exercises mutation of by-ref upvars.
2014-10-02 21:08:46 -07:00
Brian Koropoff
c4c19fe960 Correctly trans capture-by-ref unboxed closures
Store references to the freevars instead of copies when constructing
the environment and insert an additional load when reading them from
the environment.
2014-10-02 21:08:45 -07:00
Brian Koropoff
72dc0f5f82 Return correct types for capture-by-ref unboxed closure upvars
Treat upvars of capture-by-reference unboxed closures as references
with appropriate regions and mutability.
2014-10-02 21:08:45 -07:00
Brian Koropoff
931f59f214 Fix categorization of upvars of capture-by-reference unboxed closures
In particular, this causes mutation of an upvar to correctly mark
it as mutable during adjustment.  This makes borrowck correctly
flag conflicting borrows, etc.

We still seem to generate incorrect code in trans which copies the upvar
by value into the closure.  This remains to be fixed.
2014-10-02 21:08:45 -07:00
Brian Koropoff
4e5666eace Fix missing entries in upvar borrows map for capture-by-ref unboxed closures
This prevents a later ICE in borrowck.

Closes issue #17655
2014-10-02 21:08:08 -07:00
Alex Crichton
d911936dbd Merge branch 'travis' into rollup
Conflicts:
	.travis.yml
2014-10-02 21:02:36 -07:00
Alex Crichton
7e22af3582 syntax: Enable parsing of const globals
This rewrites them to the current `ItemStatic` production of the compiler, but I
want to get this into a snapshot. It will be illegal to use a `static` in a
pattern of a `match` statement, so all those current uses will need to be
rewritten to `const` once it's implemented. This requires that the stage0
snapshot is able to parse `const`.

cc #17718
2014-10-02 19:37:06 -07:00
Alex Crichton
06a6ba1d6f test: Don't depend on /bin/bash
Our FreeBSD bots apparently don't have bash installed, and it's ok to run with
sh anyway!

Unblocks a snapshot
2014-10-02 19:34:26 -07:00
bors
d0af3feebb auto merge of #17715 : aturon/rust/revert-slice-ops-libs, r=alexcrichton
This PR reverts https://github.com/rust-lang/rust/pull/17620, which caused a significant regression for slices.

As discussed with @alexcrichton, all of the public-facing changes of the earlier PR need to be rolled back, and it's not clear that we should move the libraries over to this new notation yet anyway (especially given its feature-gated status).

Closes #17710
2014-10-02 23:42:31 +00:00
Alex Crichton
f96ee10e88 Test fixes from the rollup 2014-10-02 15:43:37 -07:00