Commit Graph

31363 Commits

Author SHA1 Message Date
Cameron Zwarich
5d4d09daf2 Add a new test for borrow checker Box<T> behavior 2014-07-30 13:36:21 -07:00
Cameron Zwarich
3607c7a982 Implement RFC #43
Remove the ability of the borrow checker to determine that repeated
dereferences of a Box<T> refer to the same memory object. This will
usually require one of two workarounds:

1) The interior of a Box<T> will sometimes need to be moved / borrowed
into a temporary before moving / borrowing individual derived paths.

2) A `ref x` pattern will have to be replaced with a `box ref x`
pattern.

Fixes #16094.

[breaking-change]
2014-07-30 13:36:21 -07:00
Cameron Zwarich
8c4dbf3d47 Add two helper functions for dealing with OwnedPtr paths 2014-07-30 13:36:21 -07:00
Cameron Zwarich
8da03d9771 Library changes for RFC #43 2014-07-30 13:36:21 -07:00
nham
96d6126f9b Implement Default for std::io::FilePermission 2014-07-30 16:05:24 -04:00
nham
f3e0db1559 Derive PartialOrd, Ord and Hash for bitflags types.
In order to prevent users from having to manually implement Hash and Ord for
bitflags types, this commit derives these traits automatically.

This breaks code that has manually implemented any of these traits for types
created by the bitflags! macro. Change this code by removing implementations
of these traits.

[breaking-change]
2014-07-30 16:04:33 -04:00
Stuart Pernsteiner
f97f65f7b7 avoid redundant translation of items during monomorphization 2014-07-30 12:07:26 -07:00
Kevin Ballard
3db5cf6f1d Update docs for TLS -> TLD
The correct terminology is Task-Local Data, or TLD. Task-Local Storage,
or TLS, is the old terminology that was abandoned because of the
confusion with Thread-Local Storage (TLS).
2014-07-30 10:36:45 -07:00
bors
7a25cf3f30 auto merge of #15944 : alexcrichton/rust/task-dont-die, r=brson
Previously both spawning mechanisms were not resilient to task failures which were initiated from the task spawning infrastructure.

Closes #15895
2014-07-30 17:06:18 +00:00
Alex Crichton
8643a0d613 green: Prevent runtime corruption on spawn failure
Like with libnative, when a green task failed to spawn it would leave the world
in a corrupt state where the local scheduler had been dropped as well as the
local task. Also like libnative, this patch sets up a "bomb" which when it goes
off will restore the state of the world.
2014-07-30 08:33:53 -07:00
bors
f681420624 auto merge of #15915 : erickt/rust/master, r=alexcrichton
std: rename MemWriter to SeekableMemWriter, add seekless MemWriter

Not all users of MemWriter need to seek, but having MemWriter seekable adds between 3-29% in overhead in certain circumstances. This fixes that performance gap by making a non-seekable MemWriter, and creating a new SeekableMemWriter for those circumstances when that functionality is actually needed.

```
test io::mem::test::bench_buf_reader                        ... bench:       682 ns/iter (+/- 85)
test io::mem::test::bench_buf_writer                        ... bench:       580 ns/iter (+/- 57)
test io::mem::test::bench_mem_reader                        ... bench:       793 ns/iter (+/- 99)
test io::mem::test::bench_mem_writer_001_0000               ... bench:        48 ns/iter (+/- 27)
test io::mem::test::bench_mem_writer_001_0010               ... bench:        65 ns/iter (+/- 27) = 153 MB/s
test io::mem::test::bench_mem_writer_001_0100               ... bench:       132 ns/iter (+/- 12) = 757 MB/s
test io::mem::test::bench_mem_writer_001_1000               ... bench:       802 ns/iter (+/- 151) = 1246 MB/s
test io::mem::test::bench_mem_writer_100_0000               ... bench:       481 ns/iter (+/- 28)
test io::mem::test::bench_mem_writer_100_0010               ... bench:      1957 ns/iter (+/- 126) = 510 MB/s
test io::mem::test::bench_mem_writer_100_0100               ... bench:      8222 ns/iter (+/- 434) = 1216 MB/s
test io::mem::test::bench_mem_writer_100_1000               ... bench:     82496 ns/iter (+/- 11191) = 1212 MB/s
test io::mem::test::bench_seekable_mem_writer_001_0000      ... bench:        48 ns/iter (+/- 2)
test io::mem::test::bench_seekable_mem_writer_001_0010      ... bench:        64 ns/iter (+/- 2) = 156 MB/s
test io::mem::test::bench_seekable_mem_writer_001_0100      ... bench:       129 ns/iter (+/- 7) = 775 MB/s
test io::mem::test::bench_seekable_mem_writer_001_1000      ... bench:       801 ns/iter (+/- 159) = 1248 MB/s
test io::mem::test::bench_seekable_mem_writer_100_0000      ... bench:       711 ns/iter (+/- 51)
test io::mem::test::bench_seekable_mem_writer_100_0010      ... bench:      2532 ns/iter (+/- 227) = 394 MB/s
test io::mem::test::bench_seekable_mem_writer_100_0100      ... bench:      8962 ns/iter (+/- 947) = 1115 MB/s
test io::mem::test::bench_seekable_mem_writer_100_1000      ... bench:     85086 ns/iter (+/- 11555) = 1175 MB/s
```
2014-07-30 14:41:18 +00:00
Alex Crichton
355c798ac3 native: Don't deadlock the runtime on spawn failure
Previously, the call to bookkeeping::increment() was never paired with a
decrement when the spawn failed (due to unwinding). This fixes the problem by
returning a "bomb" from increment() which will decrement on drop, and then
moving the bomb into the child task's procedure which will be dropped naturally.
2014-07-30 07:06:44 -07:00
Alex Crichton
e156d001c6 rustrt: Allow dropping a brand-new Task
When a new task fails to spawn, it triggers a task failure of the spawning task.
This ends up causing runtime aborts today because of the destructor bomb in the
Task structure. The bomb doesn't actually need to go off until *after* the task
has run at least once.

This now prevents a runtime abort when a native thread fails to spawn.
2014-07-30 07:06:44 -07:00
Steve Klabnik
6121d82d47 Guide: testing 2014-07-30 09:36:32 -04:00
bors
3ab170ffc5 auto merge of #16037 : erickt/rust/quote_arm, r=acrichto
This adds support for `quote_arm!(cx, $pat => $expr)`, and `macro_rules!(($a:arm) => (...))`. It also fixes a bug in pretty printing, where this would generate invalid code:

```
match { 5i } {
    1 => 2,
    _ => 3,
}
```

It would generate this code:

```
match { 5i } {
    1 => 2
    _ => 3
}
```

Finally, it adds a couple helper methods to `ExtCtxt`.
2014-07-30 13:01:10 +00:00
bors
692077b643 auto merge of #15777 : SimonSapin/rust/pub-ascii-maps, r=alexcrichton
When dealing with HTTP request or responses, many tokens are case-insensitive in the ASCII range but the bytes from the network are not necessarily valid UTF-8.

**[breaking-change]** Rather than adding new very similar traits, this re-uses the `std::ascii::OwnedStrAsciiExt` and `std::ascii::StrAsciiExt` traits, but rename to remove `Str` since that does not apply for bytes.

This PR also makes `std::ascii::ASCII_UPPER_MAP` and `std::ascii::ASCII_LOWER_MAP`, the lookup table all these methods are based on, public. In case there is something else related to ASCII case we haven’t thought of yet, that can be implemented outside of libstd without duplicating the tables.

Although this is a breaking change, I thought this could do without an RFC since the relevant traits are not in the prelude.

r? @alexcrichton
2014-07-30 10:31:11 +00:00
bors
774d5eb0b0 auto merge of #15670 : epdtry/rust/fast-archive-builder, r=alexcrichton
When rustc produces an rlib, it includes the contents of each static library required by the crate.  Currently each static library is added individually, by extracting the library with `ar x` and adding the objects to the rlib using `ar r`.  Each `ar r` has significant overhead - it appears to scan through the full contents of the rlib before adding the new files.  This patch avoids most of the overhead by adding all library objects (and other rlib components) at once using a single `ar r`.

When building `librustc` (on Linux, using GNU ar), this patch gives a 60-80% reduction in linking time, from 90s to 10s one machine I tried and 25s to 8s on another.  (Though `librustc` is a bit of a special case - it's a very large crate, so the rlib is large to begin with, and it also relies on a total of 45 static libraries due to the way LLVM is organized.)  More reasonable crates such as `libstd` and `libcore` also get a small reduction in linking time (just from adding metadata, bitcode, and object code in one `ar` invocation instead of three), but this is not very noticeable since the time there is small to begin with (around 1s).
2014-07-30 07:41:11 +00:00
bors
1b0dc6a3fc auto merge of #16092 : alexcrichton/rust/rollup, r=alexcrichton 2014-07-30 05:06:41 +00:00
Erick Tryzelaar
2bcb4bd406 std: Make MemWriter clonable 2014-07-29 16:32:07 -07:00
Erick Tryzelaar
e27b88d5bd remove seek from std::io::MemWriter, add SeekableMemWriter to librustc
Not all users of MemWriter need to seek, but having MemWriter
seekable adds between 3-29% in overhead in certain circumstances.
This fixes that performance gap by making a non-seekable MemWriter,
and creating a new SeekableMemWriter for those circumstances when
that functionality is actually needed.

```
test io::mem::test::bench_buf_reader                        ... bench:       682 ns/iter (+/- 85)
test io::mem::test::bench_buf_writer                        ... bench:       580 ns/iter (+/- 57)
test io::mem::test::bench_mem_reader                        ... bench:       793 ns/iter (+/- 99)
test io::mem::test::bench_mem_writer_001_0000               ... bench:        48 ns/iter (+/- 27)
test io::mem::test::bench_mem_writer_001_0010               ... bench:        65 ns/iter (+/- 27) = 153 MB/s
test io::mem::test::bench_mem_writer_001_0100               ... bench:       132 ns/iter (+/- 12) = 757 MB/s
test io::mem::test::bench_mem_writer_001_1000               ... bench:       802 ns/iter (+/- 151) = 1246 MB/s
test io::mem::test::bench_mem_writer_100_0000               ... bench:       481 ns/iter (+/- 28)
test io::mem::test::bench_mem_writer_100_0010               ... bench:      1957 ns/iter (+/- 126) = 510 MB/s
test io::mem::test::bench_mem_writer_100_0100               ... bench:      8222 ns/iter (+/- 434) = 1216 MB/s
test io::mem::test::bench_mem_writer_100_1000               ... bench:     82496 ns/iter (+/- 11191) = 1212 MB/s
test io::mem::test::bench_seekable_mem_writer_001_0000      ... bench:        48 ns/iter (+/- 2)
test io::mem::test::bench_seekable_mem_writer_001_0010      ... bench:        64 ns/iter (+/- 2) = 156 MB/s
test io::mem::test::bench_seekable_mem_writer_001_0100      ... bench:       129 ns/iter (+/- 7) = 775 MB/s
test io::mem::test::bench_seekable_mem_writer_001_1000      ... bench:       801 ns/iter (+/- 159) = 1248 MB/s
test io::mem::test::bench_seekable_mem_writer_100_0000      ... bench:       711 ns/iter (+/- 51)
test io::mem::test::bench_seekable_mem_writer_100_0010      ... bench:      2532 ns/iter (+/- 227) = 394 MB/s
test io::mem::test::bench_seekable_mem_writer_100_0100      ... bench:      8962 ns/iter (+/- 947) = 1115 MB/s
test io::mem::test::bench_seekable_mem_writer_100_1000      ... bench:     85086 ns/iter (+/- 11555) = 1175 MB/s
```

[breaking-change]
2014-07-29 16:31:39 -07:00
Alex Crichton
f91a964ef1 Test fixes from the rollup
Closes #15296 (Update disclaimer to improve clarity and intent)
Closes #15804 (Don't ICE when dealing with the count expr for fixed array types in various places.)
Closes #15893 (lint: Improve ffi-unsafe enum lint warning)
Closes #16045 (Rename Integer divides to is_multiple_of.)
Closes #16055 (manual: update list of feature gates, add phase attribute)
Closes #16056 (Improve documentation of rounding functions)
Closes #16061 (Remove references to non-existant functions in the std::path documentation)
Closes #16062 (Fix documentation error in MutableVectorAllocating::move_from)
Closes #16063 (adding discuss.rust-lang to community)
Closes #16064 (rustc: Switch dsymutil status => output)
Closes #16066 (making raw source display better)
Closes #16079 (doc: add missing word)
Closes #16080 (Update LLVM to fix miscompilations due to wrongfully removed lifetime intrinsics)
Closes #16084 (Elide lifetimes around Arc<T>.)
Closes #16085 (Gedit/gtksourceview language spec: add raw strings)
Closes #16086 (Implement Hash for DList)
2014-07-29 16:28:46 -07:00
Erick Tryzelaar
e841a88b92 syntax: add support for quoting arms 2014-07-29 16:01:36 -07:00
Simon Sapin
235bb3fb1f Add deprecated aliases for the old {Owned,}StrAsciiExt trait names.
The deprecation warning does not seem to be emitted right now, but hopefully that’ll be fixed.
2014-07-29 23:59:19 +01:00
Simon Sapin
b86574bfff Rename the std::ascii::{Owned,}StrAsciiExt traits to {Owned,}AsciiExt
… and implement them on Vec<u8> / &[u8].

[breaking-change]
2014-07-29 23:59:19 +01:00
Simon Sapin
ee8365ad81 Make std::ascii::ASCII_{UPPER,LOWER}_MAP public. 2014-07-29 23:56:44 +01:00
Simon Sapin
29cb9594d1 Use byte literals in std::ascii::ASCII_{UPPER,LOWER}_MAP for readability. 2014-07-29 23:56:44 +01:00
Erick Tryzelaar
1200ad0f06 Fix a bug pretty printing match { 5i } { _ => { } }
This also always puts a trailing comma on the last non-block expr.
2014-07-29 15:51:03 -07:00
Erick Tryzelaar
a46463d179 syntax: promote a comment on PatEnum into a docstring 2014-07-29 15:51:03 -07:00
Erick Tryzelaar
4d472ff1be syntax: allow quasiquoter to inline Vec<Stmt>s 2014-07-29 15:51:03 -07:00
Erick Tryzelaar
3b7c25ce5b syntax: add some more extension helper methods 2014-07-29 15:51:03 -07:00
Erick Tryzelaar
ce2824dafe serialize: fix a warning 2014-07-29 15:50:45 -07:00
Erick Tryzelaar
a011b2273e Fix a whitespace typo 2014-07-29 15:50:44 -07:00
nham
f7bcb736ad Implement Hash for DList 2014-07-29 15:44:37 -07:00
Simon Sapin
3c453b36ce Gedit/gtksourceview language spec: add raw strings
… and color (raw) strings as such in attributes.
This fixes cases where a string contains ] inside an attribute:
that ] used to incorrectly end the attribute coloring.

For large (many lines) doc comments, I’ve found preferable to use
`#![doc = r#"..."#]` to avoid prefixing every line with `//!`.
2014-07-29 15:44:35 -07:00
OGINO Masanori
02d12e5f71 Elide lifetimes around Arc<T>.
It's a small step forward in application of RFC 39 to the code base
itself.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-07-29 15:44:31 -07:00
Björn Steinbrink
04fa906648 Update LLVM to fix miscompilations due to wrongfully removed lifetime intrinsics
Fixes #15972 and #16011.
2014-07-29 15:44:26 -07:00
Tshepang Lekhonkhobe
f1e14cc10d doc: add missing word 2014-07-29 15:44:21 -07:00
Alexis Beingessner
7669f04fb0 making raw source display better
* Make the code fill up the full width of the page (no massive whitespace on the left)
* Move the code down to make it not intersect the logo
* Set a min-width and remove the max-width so that the code doesn't scroll internally, but instead scrolls the page, meaning horizontal scroll bars are always available
* Set overflow to actually overflow, just to be sure

Fixes #15891
2014-07-29 15:44:14 -07:00
Alex Crichton
9cffd7faea rustc: Switch dsymutil status => output
Sometimes dsymutil writes to stdout/stderr which rust isn't reading, which may
cause a deadlock.

Closes #16060
2014-07-29 15:44:10 -07:00
Alexis Beingessner
56f957f463 adding discuss.rust-lang to community 2014-07-29 15:44:08 -07:00
donkopotamus
57fef0f708 Fix documentation error in MutableVectorAllocating::move_from
Correct `str` to `src`
2014-07-29 15:44:05 -07:00
nham
16bc72040a Remove references to non-existant functions in the std::path documentation 2014-07-29 15:44:03 -07:00
Piotr Jawniak
f399d30802 Improve documentation of rounding functions 2014-07-29 15:43:59 -07:00
Corey Richardson
2a3c0d91cf manual: update list of feature gates, add phase attribute 2014-07-29 15:43:57 -07:00
Jonas Hietala
59a9128008 Rename Integer trait divides to is_multiple_of.
It is being changed because the previous wording was ambiguous.
`a.divides(b)` implied `a % b == 0` but it sounds like the other way
around. `9.divides(&3) == true` but we might read that as
"does 9 divide 3?".  It has been renamed to sidestep the ambiguity.

Work around the change by using `is_multiple_of` instead.

[breaking-change]
2014-07-29 15:43:52 -07:00
Anton Lofgren
ef7d3e13e2 lint: Improve ffi-unsafe enum lint warning
I think this is an improvement of the previous warning message, which
- like the comment that I removed implies - is in need of some
improvement.
I've opted to point the user in the right direction w.r.t how to fix the
problem, which I think is good form.

Not being familiar with the repr(...) attribute, I personally had to
check the lint rules myself to figure out what was wrong. Hopefully,
this will save he next person some time and headache.

Signed-off-by: Anton Lofgren <alofgren@op5.com>
2014-07-29 15:43:21 -07:00
Luqman Aden
c2ac7fde0b Add pretty=typed test support to compiletest and add a test for fixed size arrays. 2014-07-29 15:43:12 -07:00
Luqman Aden
445340771d libsyntax: Don't ICE on macro invocation in count expr of fixed array type. 2014-07-29 15:43:12 -07:00
Luqman Aden
779d100541 librustc: Typeck & record the count expr in TyFixedLengthVec. 2014-07-29 15:43:12 -07:00
Hugo Jobling
26ca10d2d7 Update disclaimer to improve clarity and intent 2014-07-29 15:43:02 -07:00