]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #16037 : erickt/rust/quote_arm, r=acrichto
bors [Wed, 30 Jul 2014 13:01:10 +0000 (13:01 +0000)]
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`.

10 years agoauto merge of #15777 : SimonSapin/rust/pub-ascii-maps, r=alexcrichton
bors [Wed, 30 Jul 2014 10:31:11 +0000 (10:31 +0000)]
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

10 years agoauto merge of #15670 : epdtry/rust/fast-archive-builder, r=alexcrichton
bors [Wed, 30 Jul 2014 07:41:11 +0000 (07:41 +0000)]
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).

10 years agoauto merge of #16092 : alexcrichton/rust/rollup, r=alexcrichton
bors [Wed, 30 Jul 2014 05:06:41 +0000 (05:06 +0000)]
auto merge of #16092 : alexcrichton/rust/rollup, r=alexcrichton

10 years agoTest fixes from the rollup
Alex Crichton [Tue, 29 Jul 2014 23:28:46 +0000 (16:28 -0700)]
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)

10 years agosyntax: add support for quoting arms
Erick Tryzelaar [Tue, 29 Jul 2014 00:32:51 +0000 (17:32 -0700)]
syntax: add support for quoting arms

10 years agoAdd deprecated aliases for the old {Owned,}StrAsciiExt trait names.
Simon Sapin [Fri, 18 Jul 2014 15:49:05 +0000 (16:49 +0100)]
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.

10 years agoRename the std::ascii::{Owned,}StrAsciiExt traits to {Owned,}AsciiExt
Simon Sapin [Fri, 18 Jul 2014 13:53:29 +0000 (14:53 +0100)]
Rename the std::ascii::{Owned,}StrAsciiExt traits to {Owned,}AsciiExt

… and implement them on Vec<u8> / &[u8].

[breaking-change]

10 years agoMake std::ascii::ASCII_{UPPER,LOWER}_MAP public.
Simon Sapin [Fri, 18 Jul 2014 13:16:23 +0000 (14:16 +0100)]
Make std::ascii::ASCII_{UPPER,LOWER}_MAP public.

10 years agoUse byte literals in std::ascii::ASCII_{UPPER,LOWER}_MAP for readability.
Simon Sapin [Fri, 18 Jul 2014 13:11:40 +0000 (14:11 +0100)]
Use byte literals in std::ascii::ASCII_{UPPER,LOWER}_MAP for readability.

10 years agoFix a bug pretty printing `match { 5i } { _ => { } }`
Erick Tryzelaar [Mon, 28 Jul 2014 01:05:07 +0000 (18:05 -0700)]
Fix a bug pretty printing `match { 5i } { _ => { } }`

This also always puts a trailing comma on the last non-block expr.

10 years agosyntax: promote a comment on PatEnum into a docstring
Erick Tryzelaar [Sun, 27 Jul 2014 22:23:01 +0000 (15:23 -0700)]
syntax: promote a comment on PatEnum into a docstring

10 years agosyntax: allow quasiquoter to inline `Vec<Stmt>`s
Erick Tryzelaar [Sun, 27 Jul 2014 22:11:42 +0000 (15:11 -0700)]
syntax: allow quasiquoter to inline `Vec<Stmt>`s

10 years agosyntax: add some more extension helper methods
Erick Tryzelaar [Sun, 27 Jul 2014 22:11:02 +0000 (15:11 -0700)]
syntax: add some more extension helper methods

10 years agoImplement Hash for DList
nham [Tue, 29 Jul 2014 20:24:06 +0000 (16:24 -0400)]
Implement Hash for DList

10 years agoGedit/gtksourceview language spec: add raw strings
Simon Sapin [Tue, 29 Jul 2014 21:05:37 +0000 (22:05 +0100)]
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 `//!`.

10 years agoElide lifetimes around Arc<T>.
OGINO Masanori [Tue, 29 Jul 2014 20:53:40 +0000 (05:53 +0900)]
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>
10 years agoUpdate LLVM to fix miscompilations due to wrongfully removed lifetime intrinsics
Björn Steinbrink [Tue, 29 Jul 2014 18:28:33 +0000 (20:28 +0200)]
Update LLVM to fix miscompilations due to wrongfully removed lifetime intrinsics

Fixes #15972 and #16011.

10 years agodoc: add missing word
Tshepang Lekhonkhobe [Tue, 29 Jul 2014 17:47:58 +0000 (19:47 +0200)]
doc: add missing word

10 years agomaking raw source display better
Alexis Beingessner [Tue, 29 Jul 2014 02:33:43 +0000 (22:33 -0400)]
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

10 years agorustc: Switch dsymutil status => output
Alex Crichton [Tue, 29 Jul 2014 01:14:56 +0000 (18:14 -0700)]
rustc: Switch dsymutil status => output

Sometimes dsymutil writes to stdout/stderr which rust isn't reading, which may
cause a deadlock.

Closes #16060

10 years agoadding discuss.rust-lang to community
Alexis Beingessner [Tue, 29 Jul 2014 01:15:12 +0000 (21:15 -0400)]
adding discuss.rust-lang to community

10 years agoFix documentation error in MutableVectorAllocating::move_from
donkopotamus [Mon, 28 Jul 2014 23:52:16 +0000 (11:52 +1200)]
Fix documentation error in MutableVectorAllocating::move_from

Correct `str` to `src`

10 years agoRemove references to non-existant functions in the std::path documentation
nham [Mon, 28 Jul 2014 23:32:47 +0000 (19:32 -0400)]
Remove references to non-existant functions in the std::path documentation

10 years agoImprove documentation of rounding functions
Piotr Jawniak [Mon, 28 Jul 2014 19:24:38 +0000 (21:24 +0200)]
Improve documentation of rounding functions

10 years agomanual: update list of feature gates, add phase attribute
Corey Richardson [Mon, 28 Jul 2014 21:31:46 +0000 (14:31 -0700)]
manual: update list of feature gates, add phase attribute

10 years agoRename Integer trait `divides` to `is_multiple_of`.
Jonas Hietala [Mon, 28 Jul 2014 14:03:01 +0000 (16:03 +0200)]
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]

10 years agolint: Improve ffi-unsafe enum lint warning
Anton Lofgren [Tue, 22 Jul 2014 06:33:03 +0000 (08:33 +0200)]
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>
10 years agoAdd pretty=typed test support to compiletest and add a test for fixed size arrays.
Luqman Aden [Tue, 22 Jul 2014 23:39:10 +0000 (16:39 -0700)]
Add pretty=typed test support to compiletest and add a test for fixed size arrays.

10 years agolibsyntax: Don't ICE on macro invocation in count expr of fixed array type.
Luqman Aden [Sat, 19 Jul 2014 07:06:43 +0000 (00:06 -0700)]
libsyntax: Don't ICE on macro invocation in count expr of fixed array type.

10 years agolibrustc: Typeck & record the count expr in TyFixedLengthVec.
Luqman Aden [Sat, 19 Jul 2014 06:54:57 +0000 (23:54 -0700)]
librustc: Typeck & record the count expr in TyFixedLengthVec.

10 years agoUpdate disclaimer to improve clarity and intent
Hugo Jobling [Tue, 1 Jul 2014 08:50:55 +0000 (09:50 +0100)]
Update disclaimer to improve clarity and intent

10 years agoauto merge of #15956 : steveklabnik/rust/guide_crates, r=pcwalton
bors [Tue, 29 Jul 2014 21:16:50 +0000 (21:16 +0000)]
auto merge of #15956 : steveklabnik/rust/guide_crates, r=pcwalton

Also fixes a couple of filesystem references that I forgot to change. :sweat_smile:

10 years agospeed up static linking by combining `ar` invocations
Stuart Pernsteiner [Thu, 3 Jul 2014 23:03:26 +0000 (16:03 -0700)]
speed up static linking by combining `ar` invocations

10 years agoauto merge of #16046 : dotdash/rust/call_ignore_alloca, r=pcwalton
bors [Tue, 29 Jul 2014 19:31:44 +0000 (19:31 +0000)]
auto merge of #16046 : dotdash/rust/call_ignore_alloca, r=pcwalton

10 years agoauto merge of #15989 : pcwalton/rust/borrowck-pattern-guards, r=pnkfelix
bors [Tue, 29 Jul 2014 17:41:41 +0000 (17:41 +0000)]
auto merge of #15989 : pcwalton/rust/borrowck-pattern-guards, r=pnkfelix

the CFG for match statements.

There were two bugs in issue #14684. One was simply that the borrow
check didn't know about the correct CFG for match statements: the
pattern must be a predecessor of the guard. This disallows the bad
behavior if there are bindings in the pattern. But it isn't enough to
prevent the memory safety problem, because of wildcards; thus, this
patch introduces a more restrictive rule, which disallows assignments
and mutable borrows inside guards outright.

I discussed this with Niko and we decided this was the best plan of
action.

This breaks code that performs mutable borrows in pattern guards. Most
commonly, the code looks like this:

    impl Foo {
        fn f(&mut self, ...) {}
        fn g(&mut self, ...) {
            match bar {
                Baz if self.f(...) => { ... }
                _ => { ... }
            }
        }
    }

Change this code to not use a guard. For example:

    impl Foo {
        fn f(&mut self, ...) {}
        fn g(&mut self, ...) {
            match bar {
                Baz => {
                    if self.f(...) {
                        ...
                    } else {
                        ...
                    }
                }
                _ => { ... }
            }
        }
    }

Sometimes this can result in code duplication, but often it illustrates
a hidden memory safety problem.

Closes #14684.

[breaking-change]

r? @pnkfelix

10 years agoNew Guide: crates and modules
Steve Klabnik [Thu, 24 Jul 2014 19:00:34 +0000 (15:00 -0400)]
New Guide: crates and modules

10 years agoauto merge of #16054 : tshepang/rust/patch-1, r=brson
bors [Tue, 29 Jul 2014 15:57:01 +0000 (15:57 +0000)]
auto merge of #16054 : tshepang/rust/patch-1, r=brson

10 years agoauto merge of #16052 : nham/rust/fs_docs, r=brson
bors [Tue, 29 Jul 2014 14:11:37 +0000 (14:11 +0000)]
auto merge of #16052 : nham/rust/fs_docs, r=brson

Some of the fixes include:

 - fixing mismatch between the documentation and the function parameters. (i.e. documentation references `path` parameter, but it's actually called `from`, or vice versa)
 - A few Error sections were missing an "if" on the middle clause. For example, they used to be: "This function will return an error if [Thing], [Another Thing], or if [Yet Another Thing]." I added an "if" so it becomes "This function will return an error if [Thing], if [Another Thing], or if [Yet Another Thing]"
 - The error sections previously started off with 3 different phrases:

     - "This function will return an error if ..."
     - "Will return an error if ..."
     - "This call will return an error if ..."

  I've standardized on the first phrase.

10 years agoauto merge of #16050 : jxs/rust/master, r=alexcrichton
bors [Tue, 29 Jul 2014 12:26:38 +0000 (12:26 +0000)]
auto merge of #16050 : jxs/rust/master, r=alexcrichton

getopts returns Matches not Opt

10 years agoauto merge of #16049 : aturon/rust/stability-dashboard-improvements, r=alexcrichton
bors [Tue, 29 Jul 2014 10:41:41 +0000 (10:41 +0000)]
auto merge of #16049 : aturon/rust/stability-dashboard-improvements, r=alexcrichton

* Makes dashboard width dynamic.
* Colors unmarked items.
* Gives overall crate percentages.

10 years agoauto merge of #16038 : nham/rust/collections_partialord, r=alexcrichton
bors [Tue, 29 Jul 2014 07:56:41 +0000 (07:56 +0000)]
auto merge of #16038 : nham/rust/collections_partialord, r=alexcrichton

cc #15294

10 years agoauto merge of #16034 : sfackler/rust/test-reexport-fix, r=alexcrichton
bors [Tue, 29 Jul 2014 06:11:41 +0000 (06:11 +0000)]
auto merge of #16034 : sfackler/rust/test-reexport-fix, r=alexcrichton

We previously reexported entire modules, which caused private things to
become reachable and trip the dead code and private items in public API
lints.

Closes #15912

10 years agoauto merge of #16033 : nham/rust/hash_tuple_impl, r=alexcrichton
bors [Tue, 29 Jul 2014 04:26:42 +0000 (04:26 +0000)]
auto merge of #16033 : nham/rust/hash_tuple_impl, r=alexcrichton

Previously the implementation of Hash was limited to tuples of up to arity 8. This increases it to tuples of up to arity 12.

Also, the implementation macro for `Hash` used to expand to something like this:

    impl Hash for (a7,)
    impl Hash for (a6, a7)
    impl Hash for (a5, a6, a7)
    ...

This style is inconsistent with the implementations in core::tuple, which look like this:

    impl Trait for (A,)
    impl Trait for (A, B)
    impl Trait for (A, B, C)
    ...

This is perhaps a minor point, but it does mean the documentation pages are inconsistent. Compare the tuple implementations in the documentation for [Hash](http://static.rust-lang.org/doc/master/std/hash/trait.Hash.html) and [PartialOrd](http://static.rust-lang.org/doc/master/core/cmp/trait.PartialOrd.html)

This changes the Hash implementation to be consistent with `core::tuple`.

10 years agoauto merge of #16032 : treeman/rust/doc-treecollection, r=alexcrichton
bors [Tue, 29 Jul 2014 02:41:41 +0000 (02:41 +0000)]
auto merge of #16032 : treeman/rust/doc-treecollection, r=alexcrichton

10 years agoauto merge of #16027 : treeman/rust/doc-string, r=alexcrichton
bors [Mon, 28 Jul 2014 22:36:39 +0000 (22:36 +0000)]
auto merge of #16027 : treeman/rust/doc-string, r=alexcrichton

10 years agodoc: reduce overlong sentence
Tshepang Lekhonkhobe [Mon, 28 Jul 2014 21:22:47 +0000 (23:22 +0200)]
doc: reduce overlong sentence

10 years agoauto merge of #15983 : brson/rust/fail, r=alexcrichton
bors [Mon, 28 Jul 2014 20:51:33 +0000 (20:51 +0000)]
auto merge of #15983 : brson/rust/fail, r=alexcrichton

A few refactorings to decrease text size and increase data size. I'm not sure about this tradeoff. Various stats below. cc @pcwalton

This reduces the code needed to pass arguments for `fail!()`, `fail!("{}", ...)`, and to a lesser extent `fail!("...")`. Still more work to be done on compiler-generated failures and the `fail!("...")` case.

do_fail_empty:

```
#[inline(never)]
fn do_fail_empty() {
    fail!()
}
```

do_fail_empty before:

```
leaq 8(%rsp), %rdi
movabsq $13, %rsi
leaq "str\"str\"(1494)"(%rip), %rax
movq %rax, 8(%rsp)
movq $19, 16(%rsp)
callq _ZN6unwind31begin_unwind_no_time_to_explain20h57030457935ab6111SdE@PLT
```

do_fail_empty after:

```
leaq _ZN13do_fail_empty9file_line20h339df6a0541e837eIaaE(%rip), %rdi
callq _ZN6unwind31begin_unwind_no_time_to_explain20h33184cfdcce4dfd8QTdE@PLT
```

do_fail_fmt:

```
#[inline(never)]
fn do_fail_fmt() {
    fail!("guh{}", "faw")
}
```

do_fail_fmt before:

```
        ... (snip lots of fmt stuff)
callq _ZN3fmt22Arguments$LT$$x27a$GT$3new20he09b3a3f473879c41paE
leaq 144(%rsp), %rsi
movabsq $23, %rdx
leaq "str\"str\"(1494)"(%rip), %rax
leaq 32(%rsp), %rcx
movq %rcx, 160(%rsp)
movq 160(%rsp), %rdi
movq %rax, 144(%rsp)
movq $19, 152(%rsp)
callq _ZN6unwind16begin_unwind_fmt20h3ebeb42f4d189b2buQdE@PLT
```

do_fail_fmt after:

```
        ... (snip lots of fmt stuff)
callq _ZN3fmt22Arguments$LT$$x27a$GT$3new20h42e5bb8d1711ee61OqaE
leaq _ZN11do_fail_fmt7run_fmt9file_line20h339df6a0541e837eFbaE(%rip), %rsi
leaq 32(%rsp), %rax
movq %rax, 144(%rsp)
movq 144(%rsp), %rdi
callq _ZN6unwind16begin_unwind_fmt20hfdcadc14d188656biRdE@PLT
```

File size increases.

file size before:

```
-rw-rw-r-- 1 brian brian 100501740 Jul 24 23:28 /home/brian/dev/rust2/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.rlib
-rwxrwxr-x 1 brian brian  21201780 Jul 24 23:27 /home/brian/dev/rust2/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.so
```

file size after:

```
-rw-rw-r-- 1 brian brian 101542484 Jul 25 00:34 x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.rlib
-rwxrwxr-x 1 brian brian  21348862 Jul 25 00:34 x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.so
```

Text size decreases by 52486 while data size increases by 143686.

section size before:

```
   text    data     bss     dec     hex filename
12712262        5924997     368 18637627        11c633b x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.so
```

section size after:

```
   text    data     bss     dec     hex filename
12659776        6068683     368 18728827        11dc77b /home/brian/dev/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.so
```

I don't know if anything can be learned from these benchmarks. Looks like a wash.

std bench before:

```
test collections::hashmap::bench::find_existing             ... bench:     43452 ns/iter (+/- 2423)
test collections::hashmap::bench::find_nonexisting          ... bench:     42416 ns/iter (+/- 3996)
test collections::hashmap::bench::find_pop_insert           ... bench:       214 ns/iter (+/- 11)
test collections::hashmap::bench::hashmap_as_queue          ... bench:       123 ns/iter (+/- 6)
test collections::hashmap::bench::insert                    ... bench:       153 ns/iter (+/- 14)
test collections::hashmap::bench::new_drop                  ... bench:       547 ns/iter (+/- 259)
test collections::hashmap::bench::new_insert_drop           ... bench:       682 ns/iter (+/- 366)
test io::buffered::test::bench_buffered_reader              ... bench:      1046 ns/iter (+/- 86)
test io::buffered::test::bench_buffered_stream              ... bench:      2156 ns/iter (+/- 801)
test io::buffered::test::bench_buffered_writer              ... bench:      1057 ns/iter (+/- 75)
test io::extensions::bench::u64_from_be_bytes_4_aligned     ... bench:        80 ns/iter (+/- 5)
test io::extensions::bench::u64_from_be_bytes_4_unaligned   ... bench:        81 ns/iter (+/- 6)
test io::extensions::bench::u64_from_be_bytes_7_aligned     ... bench:        80 ns/iter (+/- 4)
test io::extensions::bench::u64_from_be_bytes_7_unaligned   ... bench:        69 ns/iter (+/- 4)
test io::extensions::bench::u64_from_be_bytes_8_aligned     ... bench:        69 ns/iter (+/- 3)
test io::extensions::bench::u64_from_be_bytes_8_unaligned   ... bench:        81 ns/iter (+/- 4)
test io::mem::test::bench_buf_reader                        ... bench:       628 ns/iter (+/- 18)
test io::mem::test::bench_buf_writer                        ... bench:       478 ns/iter (+/- 19)
test io::mem::test::bench_mem_reader                        ... bench:       712 ns/iter (+/- 44)
test io::mem::test::bench_mem_writer_001_0000               ... bench:        31 ns/iter (+/- 1)
test io::mem::test::bench_mem_writer_001_0010               ... bench:        51 ns/iter (+/- 3)
test io::mem::test::bench_mem_writer_001_0100               ... bench:       121 ns/iter (+/- 8)
test io::mem::test::bench_mem_writer_001_1000               ... bench:       774 ns/iter (+/- 47)
test io::mem::test::bench_mem_writer_100_0000               ... bench:       756 ns/iter (+/- 50)
test io::mem::test::bench_mem_writer_100_0010               ... bench:      2726 ns/iter (+/- 198)
test io::mem::test::bench_mem_writer_100_0100               ... bench:      8961 ns/iter (+/- 712)
test io::mem::test::bench_mem_writer_100_1000               ... bench:    105673 ns/iter (+/- 24711)
test num::bench::bench_pow_function                         ... bench:      5849 ns/iter (+/- 371)
test num::strconv::bench::f64::float_to_string              ... bench:       662 ns/iter (+/- 202)
test num::strconv::bench::int::to_str_base_36               ... bench:       424 ns/iter (+/- 7)
test num::strconv::bench::int::to_str_bin                   ... bench:      1227 ns/iter (+/- 80)
test num::strconv::bench::int::to_str_dec                   ... bench:       466 ns/iter (+/- 13)
test num::strconv::bench::int::to_str_hex                   ... bench:       498 ns/iter (+/- 22)
test num::strconv::bench::int::to_str_oct                   ... bench:       502 ns/iter (+/- 229)
test num::strconv::bench::uint::to_str_base_36              ... bench:       375 ns/iter (+/- 7)
test num::strconv::bench::uint::to_str_bin                  ... bench:      1011 ns/iter (+/- 590)
test num::strconv::bench::uint::to_str_dec                  ... bench:       407 ns/iter (+/- 17)
test num::strconv::bench::uint::to_str_hex                  ... bench:       442 ns/iter (+/- 7)
test num::strconv::bench::uint::to_str_oct                  ... bench:       433 ns/iter (+/- 46)
test path::posix::bench::ends_with_path_home_dir            ... bench:       167 ns/iter (+/- 10)
test path::posix::bench::ends_with_path_missmatch_jome_home ... bench:       148 ns/iter (+/- 6)
test path::posix::bench::is_ancestor_of_path_with_10_dirs   ... bench:       221 ns/iter (+/- 31)
test path::posix::bench::join_abs_path_home_dir             ... bench:       144 ns/iter (+/- 23)
test path::posix::bench::join_home_dir                      ... bench:       196 ns/iter (+/- 9)
test path::posix::bench::join_many_abs_path_home_dir        ... bench:       143 ns/iter (+/- 6)
test path::posix::bench::join_many_home_dir                 ... bench:       195 ns/iter (+/- 8)
test path::posix::bench::path_relative_from_backward        ... bench:       248 ns/iter (+/- 10)
test path::posix::bench::path_relative_from_forward         ... bench:       241 ns/iter (+/- 13)
test path::posix::bench::path_relative_from_same_level      ... bench:       296 ns/iter (+/- 11)
test path::posix::bench::push_abs_path_home_dir             ... bench:       104 ns/iter (+/- 7)
test path::posix::bench::push_home_dir                      ... bench:     27311 ns/iter (+/- 2727)
test path::posix::bench::push_many_abs_path_home_dir        ... bench:       109 ns/iter (+/- 5)
test path::posix::bench::push_many_home_dir                 ... bench:     23263 ns/iter (+/- 1726)
test rand::bench::rand_isaac                                ... bench:       884 ns/iter (+/- 31) = 904 MB/s
test rand::bench::rand_isaac64                              ... bench:       440 ns/iter (+/- 126) = 1818 MB/s
test rand::bench::rand_shuffle_100                          ... bench:      2518 ns/iter (+/- 1371)
test rand::bench::rand_std                                  ... bench:       429 ns/iter (+/- 17) = 1864 MB/s
test rand::bench::rand_xorshift                             ... bench:         0 ns/iter (+/- 0) = 800000 MB/s
```

std bench after:

```
test collections::hashmap::bench::find_existing             ... bench:     43635 ns/iter (+/- 4508)
test collections::hashmap::bench::find_nonexisting          ... bench:     42323 ns/iter (+/- 1753)
test collections::hashmap::bench::find_pop_insert           ... bench:       216 ns/iter (+/- 11)
test collections::hashmap::bench::hashmap_as_queue          ... bench:       125 ns/iter (+/- 8)
test collections::hashmap::bench::insert                    ... bench:       153 ns/iter (+/- 63)
test collections::hashmap::bench::new_drop                  ... bench:       517 ns/iter (+/- 282)
test collections::hashmap::bench::new_insert_drop           ... bench:       734 ns/iter (+/- 264)
test io::buffered::test::bench_buffered_reader              ... bench:      1063 ns/iter (+/- 206)
test io::buffered::test::bench_buffered_stream              ... bench:      2321 ns/iter (+/- 2302)
test io::buffered::test::bench_buffered_writer              ... bench:      1060 ns/iter (+/- 24)
test io::extensions::bench::u64_from_be_bytes_4_aligned     ... bench:        69 ns/iter (+/- 2)
test io::extensions::bench::u64_from_be_bytes_4_unaligned   ... bench:        81 ns/iter (+/- 7)
test io::extensions::bench::u64_from_be_bytes_7_aligned     ... bench:        70 ns/iter (+/- 5)
test io::extensions::bench::u64_from_be_bytes_7_unaligned   ... bench:        69 ns/iter (+/- 5)
test io::extensions::bench::u64_from_be_bytes_8_aligned     ... bench:        80 ns/iter (+/- 6)
test io::extensions::bench::u64_from_be_bytes_8_unaligned   ... bench:        81 ns/iter (+/- 5)
test io::mem::test::bench_buf_reader                        ... bench:       663 ns/iter (+/- 44)
test io::mem::test::bench_buf_writer                        ... bench:       489 ns/iter (+/- 17)
test io::mem::test::bench_mem_reader                        ... bench:       700 ns/iter (+/- 23)
test io::mem::test::bench_mem_writer_001_0000               ... bench:        31 ns/iter (+/- 3)
test io::mem::test::bench_mem_writer_001_0010               ... bench:        49 ns/iter (+/- 5)
test io::mem::test::bench_mem_writer_001_0100               ... bench:       112 ns/iter (+/- 6)
test io::mem::test::bench_mem_writer_001_1000               ... bench:       765 ns/iter (+/- 59)
test io::mem::test::bench_mem_writer_100_0000               ... bench:       727 ns/iter (+/- 54)
test io::mem::test::bench_mem_writer_100_0010               ... bench:      2586 ns/iter (+/- 215)
test io::mem::test::bench_mem_writer_100_0100               ... bench:      8846 ns/iter (+/- 439)
test io::mem::test::bench_mem_writer_100_1000               ... bench:    105747 ns/iter (+/- 17443)
test num::bench::bench_pow_function                         ... bench:      5844 ns/iter (+/- 421)
test num::strconv::bench::f64::float_to_string              ... bench:       669 ns/iter (+/- 571)
test num::strconv::bench::int::to_str_base_36               ... bench:       417 ns/iter (+/- 24)
test num::strconv::bench::int::to_str_bin                   ... bench:      1216 ns/iter (+/- 36)
test num::strconv::bench::int::to_str_dec                   ... bench:       466 ns/iter (+/- 24)
test num::strconv::bench::int::to_str_hex                   ... bench:       492 ns/iter (+/- 8)
test num::strconv::bench::int::to_str_oct                   ... bench:       496 ns/iter (+/- 295)
test num::strconv::bench::uint::to_str_base_36              ... bench:       366 ns/iter (+/- 8)
test num::strconv::bench::uint::to_str_bin                  ... bench:      1005 ns/iter (+/- 69)
test num::strconv::bench::uint::to_str_dec                  ... bench:       396 ns/iter (+/- 20)
test num::strconv::bench::uint::to_str_hex                  ... bench:       435 ns/iter (+/- 4)
test num::strconv::bench::uint::to_str_oct                  ... bench:       436 ns/iter (+/- 451)
test path::posix::bench::ends_with_path_home_dir            ... bench:       171 ns/iter (+/- 6)
test path::posix::bench::ends_with_path_missmatch_jome_home ... bench:       152 ns/iter (+/- 6)
test path::posix::bench::is_ancestor_of_path_with_10_dirs   ... bench:       215 ns/iter (+/- 8)
test path::posix::bench::join_abs_path_home_dir             ... bench:       143 ns/iter (+/- 6)
test path::posix::bench::join_home_dir                      ... bench:       192 ns/iter (+/- 29)
test path::posix::bench::join_many_abs_path_home_dir        ... bench:       144 ns/iter (+/- 9)
test path::posix::bench::join_many_home_dir                 ... bench:       194 ns/iter (+/- 19)
test path::posix::bench::path_relative_from_backward        ... bench:       254 ns/iter (+/- 15)
test path::posix::bench::path_relative_from_forward         ... bench:       244 ns/iter (+/- 17)
test path::posix::bench::path_relative_from_same_level      ... bench:       293 ns/iter (+/- 27)
test path::posix::bench::push_abs_path_home_dir             ... bench:       108 ns/iter (+/- 5)
test path::posix::bench::push_home_dir                      ... bench:     32292 ns/iter (+/- 4361)
test path::posix::bench::push_many_abs_path_home_dir        ... bench:       108 ns/iter (+/- 6)
test path::posix::bench::push_many_home_dir                 ... bench:     20305 ns/iter (+/- 1331)
test rand::bench::rand_isaac                                ... bench:       888 ns/iter (+/- 35) = 900 MB/s
test rand::bench::rand_isaac64                              ... bench:       439 ns/iter (+/- 17) = 1822 MB/s
test rand::bench::rand_shuffle_100                          ... bench:      2582 ns/iter (+/- 1001)
test rand::bench::rand_std                                  ... bench:       431 ns/iter (+/- 93) = 1856 MB/s
test rand::bench::rand_xorshift                             ... bench:         0 ns/iter (+/- 0) = 800000 MB/s
```

10 years agoUse correct conventions for static
Brian Anderson [Mon, 28 Jul 2014 20:40:55 +0000 (13:40 -0700)]
Use correct conventions for static

10 years agoauto merge of #16025 : cmr/rust/plugin-fields, r=alexcrichton
bors [Mon, 28 Jul 2014 19:06:34 +0000 (19:06 +0000)]
auto merge of #16025 : cmr/rust/plugin-fields, r=alexcrichton

Some minor changes to the compiler to expose this information. Very
inconvenient since struct fields aren't an item.

10 years agoFix some of the documentation std::io::fs.
nham [Mon, 28 Jul 2014 18:14:56 +0000 (14:14 -0400)]
Fix some of the documentation std::io::fs.

10 years agoFix typo in getopts::getopts documentation, return Matches instead of Opt
joaoxsouls [Mon, 28 Jul 2014 16:35:31 +0000 (17:35 +0100)]
Fix typo in getopts::getopts documentation, return Matches instead of Opt

10 years agorustdoc: improvements to stability dashboard
Aaron Turon [Mon, 28 Jul 2014 06:03:46 +0000 (23:03 -0700)]
rustdoc: improvements to stability dashboard

* Makes dashboard width dynamic.
* Colors unmarked items.
* Gives overall crate percentages.

10 years agodoc: Method examples for String
Jonas Hietala [Sun, 27 Jul 2014 10:40:39 +0000 (12:40 +0200)]
doc: Method examples for String

Reword comments on unsafe methods regarding UTF-8.

10 years agoEmit lifetime end markers for allocas for ignored return values
Björn Steinbrink [Mon, 28 Jul 2014 06:41:44 +0000 (08:41 +0200)]
Emit lifetime end markers for allocas for ignored return values

10 years agoOmit unnecessary stack slots for ignored return values
Björn Steinbrink [Mon, 28 Jul 2014 06:23:16 +0000 (08:23 +0200)]
Omit unnecessary stack slots for ignored return values

If we have an immediate return value that doesn't need to be dropped, we
don't have to create a stack slot for it.

10 years agorustc: encode is_sugared_doc on ast::Attribute
Corey Richardson [Mon, 28 Jul 2014 08:02:31 +0000 (01:02 -0700)]
rustc: encode is_sugared_doc on ast::Attribute

10 years agorustdoc: remove extraneous .move_iter().collect()s
Corey Richardson [Mon, 28 Jul 2014 08:00:54 +0000 (01:00 -0700)]
rustdoc: remove extraneous .move_iter().collect()s

The impl of Clean for Vec obsoleted these long, long ago.

10 years agorustdoc: show struct field docs when inlined
Corey Richardson [Sat, 26 Jul 2014 20:21:36 +0000 (13:21 -0700)]
rustdoc: show struct field docs when inlined

Some minor changes to the compiler to expose this information. Very
inconvenient since struct fields aren't an item. Adds (yet another) table to
metadata.

Closes #15739

10 years agoImplement Ord for TrieMap/TrieSet/SmallIntMap/Bitv/BitvSet
nham [Mon, 28 Jul 2014 06:53:44 +0000 (02:53 -0400)]
Implement Ord for TrieMap/TrieSet/SmallIntMap/Bitv/BitvSet

10 years agoImplement PartialOrd for Bitv and BitvSet
nham [Mon, 28 Jul 2014 04:28:49 +0000 (00:28 -0400)]
Implement PartialOrd for Bitv and BitvSet

10 years agoImplement PartialOrd for SmallIntMap
nham [Mon, 28 Jul 2014 04:00:29 +0000 (00:00 -0400)]
Implement PartialOrd for SmallIntMap

10 years agoImplement PartialOrd for TrieMap and TrieSet
nham [Mon, 28 Jul 2014 03:51:28 +0000 (23:51 -0400)]
Implement PartialOrd for TrieMap and TrieSet

10 years agoauto merge of #16031 : arielb1/rust/remove_unneeded_fixme, r=kballard
bors [Sun, 27 Jul 2014 22:41:15 +0000 (22:41 +0000)]
auto merge of #16031 : arielb1/rust/remove_unneeded_fixme, r=kballard

The issue was fixed a month ago - remove the workaround.

10 years agoauto merge of #16026 : ruud-v-a/rust/patch-1, r=steveklabnik
bors [Sun, 27 Jul 2014 20:51:16 +0000 (20:51 +0000)]
auto merge of #16026 : ruud-v-a/rust/patch-1, r=steveklabnik

10 years agoauto merge of #16020 : nham/rust/ringbuf_hash_ord, r=alexcrichton
bors [Sun, 27 Jul 2014 19:06:16 +0000 (19:06 +0000)]
auto merge of #16020 : nham/rust/ringbuf_hash_ord, r=alexcrichton

cc #15294

10 years agoMake test expansion induce less reachability
Steven Fackler [Sun, 27 Jul 2014 19:02:19 +0000 (12:02 -0700)]
Make test expansion induce less reachability

We previously reexported entire modules, which caused private things to
become reachable and trip the dead code and private items in public API
lints.

Closes #15912

10 years agoImplement Hash for tuples of up to arity 12. Also change the style to be consistent...
nham [Sun, 27 Jul 2014 18:41:33 +0000 (14:41 -0400)]
Implement Hash for tuples of up to arity 12. Also change the style to be consistent with core::tuple

10 years agodoc: Small rewording.
Jonas Hietala [Sun, 27 Jul 2014 17:57:33 +0000 (19:57 +0200)]
doc: Small rewording.

10 years agoauto merge of #16030 : treeman/rust/doc-hashset-fix, r=sfackler
bors [Sun, 27 Jul 2014 17:06:17 +0000 (17:06 +0000)]
auto merge of #16030 : treeman/rust/doc-hashset-fix, r=sfackler

Not sure how this could slip by.

10 years agoHash the length of the RingBuf before hashing elements
nham [Sun, 27 Jul 2014 16:37:32 +0000 (12:37 -0400)]
Hash the length of the RingBuf before hashing elements

10 years agodoc: Main example for TreeMap.
Jonas Hietala [Sun, 27 Jul 2014 16:19:04 +0000 (18:19 +0200)]
doc: Main example for TreeMap.

10 years agodoc: TreeMap methods with examples.
Jonas Hietala [Sun, 27 Jul 2014 15:44:07 +0000 (17:44 +0200)]
doc: TreeMap methods with examples.

Small corrections for TreeSet examples.

10 years agodoc: TreeSet methods and main example.
Jonas Hietala [Sun, 27 Jul 2014 15:04:44 +0000 (17:04 +0200)]
doc: TreeSet methods and main example.

10 years agoRemove an unneeded FIXME in coherence.rs
Ariel Ben-Yehuda [Sun, 27 Jul 2014 15:01:19 +0000 (18:01 +0300)]
Remove an unneeded FIXME in coherence.rs

Also, let f; f = ...; is just wrong.

10 years agodoc: Correctly onclose code blocks in HashSet
Jonas Hietala [Sun, 27 Jul 2014 14:05:53 +0000 (16:05 +0200)]
doc: Correctly onclose code blocks in HashSet

10 years agoauto merge of #16016 : tomjakubowski/rust/rustdoc-fix-15490, r=alexcrichton
bors [Sun, 27 Jul 2014 09:46:15 +0000 (09:46 +0000)]
auto merge of #16016 : tomjakubowski/rust/rustdoc-fix-15490, r=alexcrichton

Previously, private and `#[doc(hidden)]` struct fields appeared in the
search index despite being hidden from the struct's documentation.

Fix #15490

10 years agodocs: Fix typo in container guide.
Ruud van Asseldonk [Sun, 27 Jul 2014 08:14:44 +0000 (10:14 +0200)]
docs: Fix typo in container guide.

10 years agoauto merge of #16001 : Gankro/rust/rawstrings-proof, r=pnkfelix
bors [Sun, 27 Jul 2014 08:01:14 +0000 (08:01 +0000)]
auto merge of #16001 : Gankro/rust/rawstrings-proof, r=pnkfelix

Stumbled across this and thought it would be cool to prove. I've never used Ogden's Lemma before, but I'm pretty sure I used it right. The pumping lemma definitely doesn't seem sufficient for the job. In particular, when using the pumping lemma, you can always just pump one of the quotes, and it's fine. Ogden's Lemma lets you effectively force the pumper to use certain characters in the string.

@cmr

10 years agoauto merge of #15963 : nham/rust/moar_15294, r=alexcrichton
bors [Sun, 27 Jul 2014 06:16:14 +0000 (06:16 +0000)]
auto merge of #15963 : nham/rust/moar_15294, r=alexcrichton

Implements PartialEq/Eq/Clone/Hash/FromIterator/Extendable for SmallIntMap and Clone/Show for TrieMap/TrieSet. cc #15294

10 years agoadding proof of context-sensitivy of raw string literals
Alexis Beingessner [Sat, 26 Jul 2014 04:28:56 +0000 (00:28 -0400)]
adding proof of context-sensitivy of raw string literals

10 years agoauto merge of #16021 : brson/rust/mb, r=pcwalton
bors [Sun, 27 Jul 2014 04:21:14 +0000 (04:21 +0000)]
auto merge of #16021 : brson/rust/mb, r=pcwalton

No longer does anything.

10 years agoRemove managed_box gate from tests
Brian Anderson [Sun, 27 Jul 2014 04:05:03 +0000 (21:05 -0700)]
Remove managed_box gate from tests

No longer does anything.

10 years agoImplement PartialOrd for RingBuf
nham [Sun, 27 Jul 2014 03:18:56 +0000 (23:18 -0400)]
Implement PartialOrd for RingBuf

10 years agoImplement Hash for RingBuf
nham [Sun, 27 Jul 2014 02:33:47 +0000 (22:33 -0400)]
Implement Hash for RingBuf

10 years agoauto merge of #16006 : TeXitoi/rust/relicense-shootout-k-nucleotide, r=brson
bors [Sun, 27 Jul 2014 00:31:13 +0000 (00:31 +0000)]
auto merge of #16006 : TeXitoi/rust/relicense-shootout-k-nucleotide, r=brson

Everyone agreed except @thestinger. As @thestinger contribution on this file is trivial,
we can relicense it.

Related to #14248, close #15330

@brson OK?

10 years agorustdoc: Keep hidden struct fields out of search
Tom Jakubowski [Sat, 26 Jul 2014 23:13:01 +0000 (16:13 -0700)]
rustdoc: Keep hidden struct fields out of search

Previously, private and `#[doc(hidden)]` struct fields appeared in the
search index despite being hidden from the struct's documentation.

Fix #15490

10 years agoManually implement Hash for SmallIntMap
nham [Sat, 26 Jul 2014 16:04:41 +0000 (12:04 -0400)]
Manually implement Hash for SmallIntMap

10 years agoauto merge of #15941 : treeman/rust/doc-lru, r=alexcrichton
bors [Sat, 26 Jul 2014 22:46:13 +0000 (22:46 +0000)]
auto merge of #15941 : treeman/rust/doc-lru, r=alexcrichton

10 years agoauto merge of #15936 : alexcrichton/rust/stability, r=brson
bors [Sat, 26 Jul 2014 21:01:15 +0000 (21:01 +0000)]
auto merge of #15936 : alexcrichton/rust/stability, r=brson

This commit applies stability attributes to the contents of these modules,
summarized here:

* The `unit` and `bool` modules have become #[unstable] as they are purely meant
  for documentation purposes and are candidates for removal.

* The `ty` module has been deprecated, and the inner `Unsafe` type has been
  renamed to `UnsafeCell` and moved to the `cell` module. The `marker1` field
  has been removed as the compiler now always infers `UnsafeCell` to be
  invariant. The `new` method i stable, but the `value` field, `get` and
  `unwrap` methods are all unstable.

* The `tuple` module has its name as stable, the naming of the `TupleN` traits
  as stable while the methods are all #[unstable]. The other impls in the module
  have appropriate stability for the corresponding trait.

* The `arc` module has received the exact same treatment as the `rc` module
  previously did.

* The `any` module has its name as stable. The `Any` trait is also stable, with
  a new private supertrait which now contains the `get_type_id` method. This is
  to make the method a private implementation detail rather than a public-facing
  detail.

  The two extension traits in the module are marked #[unstable] as they will not
  be necessary with DST. The `is` method is #[stable], the as_{mut,ref} methods
  have been renamed to downcast_{mut,ref} and are #[unstable].

  The extension trait `BoxAny` has been clarified as to why it is unstable as it
  will not be necessary with DST.

This is a breaking change because the `marker1` field was removed from the
`UnsafeCell` type. To deal with this change, you can simply delete the field and
only specify the value of the `data` field in static initializers.

[breaking-change]

10 years agostd: Stabilize unit, bool, ty, tuple, arc, any
Alex Crichton [Thu, 24 Jul 2014 02:10:12 +0000 (19:10 -0700)]
std: Stabilize unit, bool, ty, tuple, arc, any

This commit applies stability attributes to the contents of these modules,
summarized here:

* The `unit` and `bool` modules have become #[unstable] as they are purely meant
  for documentation purposes and are candidates for removal.

* The `ty` module has been deprecated, and the inner `Unsafe` type has been
  renamed to `UnsafeCell` and moved to the `cell` module. The `marker1` field
  has been removed as the compiler now always infers `UnsafeCell` to be
  invariant. The `new` method i stable, but the `value` field, `get` and
  `unwrap` methods are all unstable.

* The `tuple` module has its name as stable, the naming of the `TupleN` traits
  as stable while the methods are all #[unstable]. The other impls in the module
  have appropriate stability for the corresponding trait.

* The `arc` module has received the exact same treatment as the `rc` module
  previously did.

* The `any` module has its name as stable. The `Any` trait is also stable, with
  a new private supertrait which now contains the `get_type_id` method. This is
  to make the method a private implementation detail rather than a public-facing
  detail.

  The two extension traits in the module are marked #[unstable] as they will not
  be necessary with DST. The `is` method is #[stable], the as_{mut,ref} methods
  have been renamed to downcast_{mut,ref} and are #[unstable].

  The extension trait `BoxAny` has been clarified as to why it is unstable as it
  will not be necessary with DST.

This is a breaking change because the `marker1` field was removed from the
`UnsafeCell` type. To deal with this change, you can simply delete the field and
only specify the value of the `data` field in static initializers.

[breaking-change]

10 years agoauto merge of #15762 : nham/rust/ringbuf_docs, r=alexcrichton
bors [Sat, 26 Jul 2014 19:16:16 +0000 (19:16 +0000)]
auto merge of #15762 : nham/rust/ringbuf_docs, r=alexcrichton

This adds examples for get(), get_mut(), swap(), iter() and mut_iter()

10 years agoAdd examples for RingBuf methods get, get_mut, iter, mut_iter
nham [Thu, 17 Jul 2014 23:19:51 +0000 (19:19 -0400)]
Add examples for RingBuf methods get, get_mut, iter, mut_iter

10 years agoauto merge of #16000 : emkay/rust/lifetimes-guide-typo, r=alexcrichton
bors [Sat, 26 Jul 2014 17:31:16 +0000 (17:31 +0000)]
auto merge of #16000 : emkay/rust/lifetimes-guide-typo, r=alexcrichton

10 years agoSmall fixes for tests
nham [Sat, 26 Jul 2014 01:35:58 +0000 (21:35 -0400)]
Small fixes for tests

10 years agoauto merge of #15998 : luqmana/rust/nmnnbd, r=thestinger
bors [Sat, 26 Jul 2014 15:46:18 +0000 (15:46 +0000)]
auto merge of #15998 : luqmana/rust/nmnnbd, r=thestinger

LLVM recently added a new attribute, dereferenceable: http://reviews.llvm.org/D4449

>This patch adds a dereferencable attribute. In some sense, this is a companion to the nonnull attribute, but specifies that the pointer is known to be dereferencable in the same sense as a pointer generated by alloca is known to be dereferencable.

With rust, everywhere that we previously marked `nonnull` we can actually mark as `dereferenceable` (which implies nonnull) since we know the size. That is, except for one case: when generating calls for TyVisitor. It seems like we haven't substituted the self type (so we have `ty_param`) and just treat it as an opaque pointer so I just left that bit as nonnull.

With this, LLVM can for example hoist a load out of a loop where it previously couldn't:

```Rust
pub fn baz(c: &uint, n: uint) -> uint {
    let mut res = 0;
    for i in range(0, n) {
        if i > 0 {
            res += *c * i;
        }
    }
    res
}
```

Before:
```llvm
define i64 @baz(i64* noalias nocapture nonnull readonly, i64) unnamed_addr #0 {
entry-block:
  br label %for_loopback.outer

for_loopback.outer:                               ; preds = %then-block-33-, %entry-block
  %.ph = phi i64 [ %.lcssa, %then-block-33- ], [ 0, %entry-block ]
  %res.0.ph = phi i64 [ %8, %then-block-33- ], [ 0, %entry-block ]
  br label %for_loopback

for_exit:                                         ; preds = %for_loopback
  %res.0.ph.lcssa = phi i64 [ %res.0.ph, %for_loopback ]
  ret i64 %res.0.ph.lcssa

for_loopback:                                     ; preds = %for_loopback.outer, %for_body
  %2 = phi i64 [ %4, %for_body ], [ %.ph, %for_loopback.outer ]
  %3 = icmp ult i64 %2, %1
  br i1 %3, label %for_body, label %for_exit

for_body:                                         ; preds = %for_loopback
  %4 = add i64 %2, 1
  %5 = icmp eq i64 %2, 0
  br i1 %5, label %for_loopback, label %then-block-33-

then-block-33-:                                   ; preds = %for_body
  %.lcssa = phi i64 [ %4, %for_body ]
  %.lcssa15 = phi i64 [ %2, %for_body ]
  %6 = load i64* %0, align 8                     ; <------- this load
  %7 = mul i64 %6, %.lcssa15
  %8 = add i64 %7, %res.0.ph
  br label %for_loopback.outer
}
```

After:
```llvm
define i64 @baz(i64* noalias nocapture readonly dereferenceable(8), i64) unnamed_addr #0 {
entry-block:
  %2 = load i64* %0, align 8                    ; <------- load once instead
  br label %for_loopback.outer

for_loopback.outer:                               ; preds = %then-block-33-, %entry-block
  %.ph = phi i64 [ %.lcssa, %then-block-33- ], [ 0, %entry-block ]
  %res.0.ph = phi i64 [ %8, %then-block-33- ], [ 0, %entry-block ]
  br label %for_loopback

for_exit:                                         ; preds = %for_loopback
  %res.0.ph.lcssa = phi i64 [ %res.0.ph, %for_loopback ]
  ret i64 %res.0.ph.lcssa

for_loopback:                                     ; preds = %for_loopback.outer, %for_body
  %3 = phi i64 [ %5, %for_body ], [ %.ph, %for_loopback.outer ]
  %4 = icmp ult i64 %3, %1
  br i1 %4, label %for_body, label %for_exit

for_body:                                         ; preds = %for_loopback
  %5 = add i64 %3, 1
  %6 = icmp eq i64 %3, 0
  br i1 %6, label %for_loopback, label %then-block-33-

then-block-33-:                                   ; preds = %for_body
  %.lcssa = phi i64 [ %5, %for_body ]
  %.lcssa15 = phi i64 [ %3, %for_body ]
  %7 = mul i64 %2, %.lcssa15
  %8 = add i64 %7, %res.0.ph
  br label %for_loopback.outer
}
```

10 years agoauto merge of #15996 : nham/rust/smallintmap_not_hashmap, r=sanxiyn
bors [Sat, 26 Jul 2014 14:01:22 +0000 (14:01 +0000)]
auto merge of #15996 : nham/rust/smallintmap_not_hashmap, r=sanxiyn

SmallIntMap doesn't involve hashing?

10 years agoRelicense shootout-k-nucleotide.rs
Guillaume Pinot [Sat, 26 Jul 2014 13:06:40 +0000 (15:06 +0200)]
Relicense shootout-k-nucleotide.rs

Everyone agreed except @thestinger. As @thestinger contribution on this file is trivial,
we can relicense it.

Related to #14248, close #15330

10 years agoauto merge of #15991 : pcwalton/rust/resolve-regions-in-trait-matching, r=alexcrichton
bors [Sat, 26 Jul 2014 12:16:21 +0000 (12:16 +0000)]
auto merge of #15991 : pcwalton/rust/resolve-regions-in-trait-matching, r=alexcrichton

matching.

This breaks code like:

    struct Foo<'a,'b> {
        x: &'a int,
        y: &'b int,
    }

    trait Tr {
        fn foo(x: Self) {}
    }

    impl<'a,'b> Tr for Foo<'a,'b> {
        fn foo(x: Foo<'b,'a>) {} // <-- bad
    }

Change this code to not contain a lifetime mismatch error. For example:

    struct Foo<'a,'b> {
        x: &'a int,
        y: &'b int,
    }

    trait Tr {
        fn foo(x: Self) {}
    }

    impl<'a,'b> Tr for Foo<'a,'b> {
        fn foo(x: Foo<'a,'b>) {} // OK
    }

Closes #15517.

[breaking-change]

r? @alexcrichton

10 years agoauto merge of #15988 : brson/rust/antlrprep, r=cmr
bors [Sat, 26 Jul 2014 10:31:23 +0000 (10:31 +0000)]
auto merge of #15988 : brson/rust/antlrprep, r=cmr

Add `check-secondary`, which runs the pretty and lexer tests so we can run them on a dedicated bot. Leaves the pretty tests running under `check` until the bots are switched over. Also fixes some issues.

r? @cmr