Commit Graph

31191 Commits

Author SHA1 Message Date
Ilya Dmitrichenko
a8f58a056a Deprecate uuid. 2014-07-31 11:50:23 -07:00
Ilya Dmitrichenko
5446aed289 Deprecate semver. 2014-07-31 11:50:23 -07:00
Simon Sapin
cdb8a88717 Add a non-regression test for issue #8372 2014-07-31 11:50:23 -07:00
Simon Sapin
efd42a355d Byte literals! 2014-07-31 11:50:23 -07:00
nham
acbac845f8 Add logic to skip the doc tests on windows since these examples are unix-specific 2014-07-31 11:50:23 -07:00
nham
a0238d54aa Use byte strings throughout examples. Add an example that was missed in the last commit. 2014-07-31 11:50:23 -07:00
nham
9956aff18a Add examples for GenericPath methods. 2014-07-31 11:50:23 -07:00
Alex Crichton
c3fcc0bc51 hexfloat: Deprecate to move out of the repo
This deprecates the hexfloat library as it is now located in the rust-lang
organization as a cargo package
2014-07-31 11:50:23 -07:00
Steve Klabnik
a74197e3f1 Guide: pointers
Not the pointer guide, but the guide section on pointers.

Adding a section about patterns for after this, as well.
2014-07-31 14:39:16 -04:00
bors
8c00357f9d auto merge of #15999 : Kimundi/rust/fix_folder, r=nikomatsakis
Note: This PR is motivated by an attempt to write an custom syntax extension that tried to use `syntax::fold`, and that could only do so by fixing bugs in it and copying out private functions.

---

Refactored `syntax::fold`

Prior to this, the code there had a few issues:

- Default implementations inconsistenly either had the prefix `noop_` or
  not.
- Some default methods where implemented in terms of a public noop function
  for user code to call, others where implemented directly on the trait
  and did not allow users of the trait to reuse the code.
- Some of the default implementations where private, and thus not reusable
  for other implementors.
- There where some bugs where default implemntations called other default
  implementations directly, rather than to the underlying Folder, with the
  result of some ast nodes never being visted even if the user implemented that
  method. (For example, the current Folder never folded struct fields)

This commit solves this situation somewhat radically by making __all__
`fold_...` functions in the module into Folder methods, and implementing
them all in terms of public `noop_...` functions for other implementors to
call out to.

Some public functions had to be renamed to fit the new system, so this is a
breaking change.

---

Also added a few trait implementations to `ast` types
2014-07-31 16:41:36 +00:00
bors
9826e801be auto merge of #16073 : mneumann/rust/dragonfly2, r=alexcrichton
Not included are two required patches:

* LLVM: segmented stack support for DragonFly [1]

* jemalloc: simple configure patches

[1]: http://reviews.llvm.org/D4705
2014-07-31 14:41:34 +00:00
Alex Crichton
ecac4d2e6c rustrt: Don't conditionally init the at_exit QUEUE
This initialization should happen unconditionally, but the rtassert! macro is
gated on the ENFORCE_SANITY define

Closes #16106
2014-07-31 07:30:53 -07:00
Steve Klabnik
20658f7ec5 Fix heading levels in pointer guide 2014-07-31 07:30:52 -07:00
Erick Tryzelaar
fd9ad77bd2 Move SeekableMemWriter into librbml 2014-07-31 07:30:50 -07:00
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
311a970621 auto merge of #16090 : epdtry/rust/doesnt-use-gc, r=alexcrichton 2014-07-31 13:01:35 +00: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
Michael Neumann
284ffc5b82 Fix test suite for DragonFly 2014-07-31 02:23:35 +02:00
Michael Neumann
e99fc20f95 Fix trailing whitespace 2014-07-31 02:01:16 +02: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
Steve Klabnik
d4c3500ec6 Add comment about speed in FAQ.
Fixes #11174.
2014-07-30 19:14:06 -04: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
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