Commit Graph

31110 Commits

Author SHA1 Message Date
Erick Tryzelaar
e1dcbefe52 remove serialize::ebml, add librbml
Our implementation of ebml has diverged from the standard in order
to better serve the needs of the compiler, so it doesn't make much
sense to call what we have ebml anyore. Furthermore, our implementation
is pretty crufty, and should eventually be rewritten into a format
that better suits the needs of the compiler. This patch factors out
serialize::ebml into librbml, otherwise known as the Really Bad
Markup Language. This is a stopgap library that shouldn't be used
by end users, and will eventually be replaced by something better.

[breaking-change]
2014-07-31 07:30:49 -07:00
Steve Klabnik
ea1b637654 fix formatting in pointer guide table 2014-07-31 07:30:48 -07:00
Tobias Bucher
4c196c27c4 Fix deprecation commment on core::cmp::lexical_ordering 2014-07-31 07:30:45 -07:00
Brian Anderson
4562803a3d core: Fix failure doc comment 2014-07-31 07:30:17 -07:00
Brian Anderson
678814aafa core: Add #[inline(never)] to failure functions
For consistency, just because `fail_` has it.
2014-07-31 07:30:17 -07:00
Brian Anderson
4db68e644e Modify failure lang items to take less pointers.
Divide-by-zero before:

```
        leaq    "str\"str\"(1762)"(%rip), %rax
        movq    %rax, 16(%rsp)
        movq    $27, 24(%rsp)
        leaq    "str\"str\"(1542)"(%rip), %rax
        movq    %rax, (%rsp)
        movq    $19, 8(%rsp)
        leaq    16(%rsp), %rdi
        leaq    (%rsp), %rsi
        movl    $32, %edx
        callq   _ZN7failure5fail_20hc04408f955ce60aaqWjE@PLT
```

After:

```
        leaq    .Lconst(%rip), %rdi
        callq   _ZN7failure5fail_20haf918a97c8f7f2bfqWjE@PLT
```

Bounds check before:

```
        leaq    "str\"str\"(1542)"(%rip), %rax
        movq    %rax, 8(%rsp)
        movq    $19, 16(%rsp)
        leaq    8(%rsp), %rdi
        movl    $38, %esi
        movl    $1, %edx
        movl    $1, %ecx
        callq   _ZN7failure17fail_bounds_check20hf4bc3c69e96caf41RXjE@PLT
```

Bounds check after:

```
        leaq    .Lconst2(%rip), %rdi
        movl    $1, %esi
        movl    $1, %edx
        callq   _ZN7failure17fail_bounds_check20h5267276a537a7de22XjE@PLT
```

Size before:

21277995 librustc-4e7c5e5c.s

```
text       data
12554881   6089335
```

Size after:

21247617 librustc-4e7c5e5c.so

```
text       data
12518497   6095748
```
2014-07-31 07:30:17 -07:00
Brian Anderson
134946d06e rustrt: Make begin_unwind take a single file/line pointer
Smaller text size.
2014-07-31 07:30:17 -07:00
DJUrsus
571f6cf29a fix variable name in tutorial 2014-07-31 07:30:14 -07:00
bors
8cda74c4b5 auto merge of #16076 : SimonSapin/rust/deprecate-url, r=alexcrichton
The replacement is [rust-url](https://github.com/servo/rust-url), which can be used with Cargo.

Fix #15874
Fix #10707
Close #10706
Close #10705
Close #8486
2014-07-31 11:16:35 +00:00
bors
6f833ee151 auto merge of #16074 : nham/rust/bitflags_traits, r=alexcrichton
I wanted to add an implementation of `Default` inside the bitflags macro, but `Default` isn't in the prelude, which means anyone who wants to use `bitflags!` needs to import it. This seems not nice, so I've just implemented for `FilePermission` instead.
2014-07-31 09:31:37 +00:00
bors
28ae6f5329 auto merge of #15385 : jroweboy/rust/master, r=brson
This enables the docs search function to be more forgiving for spelling mistakes. The algorithm works as a dynamic programming algorithm to detect the minimum number of changes required to the search parameter string in order to match any string in the search index. If the number of changes is less then a threshold (currently defined as 3), then the search parameter will be included as it is a possible misspelling of the word. Any results returned by the algorithm are sorted by distance and are ranked lower than results that are partial or exact matches (aka the matches returned by the original search algorithm). Additionally, the increment in the for loops in this file were using one of three different ways to increment (`i += 1` `i++` and `++i`) so I just standardized it to `++i`.

As an example, consider searching for the word `String` and accidentally typing in `Strnig`. The old system would return no results because it is a misspelling, but the Levenshtein distance between these two inputs is only two, which means that this will return `String` as a result. Additionally, it will return a few other results such as `strong`, and `StdRng` because these are also similar to `Strnig`. Because of the ranking system though, this change should be unobtrusive to anyone that spells the words correctly, as those are still ranked first before any Levenshtein results.
2014-07-31 07:51:38 +00:00
Simon Sapin
491bd29945 Deprecate the url crate.
The replacement is [rust-url](https://github.com/servo/rust-url),
which can be used with Cargo.

Fix #15874
Fix #10707
Close #10706
Close #10705
Close #8486
2014-07-31 00:14:32 +01:00
bors
7c28dd080c auto merge of #16059 : epdtry/rust/mono-item-dedup, r=alexcrichton
Currently, each time a function is monomorphized, all items within that function are translated.  This is unnecessary work because the inner items already get translated when the function declaration is visited by `trans_item`.  This patch adds a flag to the `FunctionContext` to prevent translation of items during monomorphization.
2014-07-30 20:51:22 +00: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
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
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