Commit Graph

42005 Commits

Author SHA1 Message Date
Lee Jeffery
86de427b25 Fix incorrect link in Option documentation. 2015-05-04 17:53:08 +01:00
bors
a979efc2f9 Auto merge of #25082 - shepmaster:inline-docs, r=steveklabnik 2015-05-04 13:16:20 +00:00
bors
165a8dec9c Auto merge of #25055 - bguiz:patch-2, r=steveklabnik
- I found n error in the book, before contributing the patch to fix it, I had to find where they were hosted
- It took me quite look to find where within the rust-lang *organisation* it was! ... and this should make it easier for the next person in the same position
2015-05-04 09:11:27 +00:00
bors
1ea9e8db6f Auto merge of #25067 - koute:master, r=alexcrichton
Without the inline annotation this:
    str::from_utf8_unchecked( slice::from_raw_parts( ptr, len ) )
doesn't get inlined which can be pretty brutal performance-wise
when used in an inner loop of a low level string manipulation method.
2015-05-04 07:24:24 +00:00
bors
6517a0e90e Auto merge of #25047 - sinkuu:vec_intoiter_override, r=alexcrichton
Override methods `count`, `last`, and `nth` in vec::IntoIter.

#24214
2015-05-04 04:05:37 +00:00
bors
45b9a34a7b Auto merge of #25044 - tshepang:doc-addr, r=alexcrichton 2015-05-04 02:19:09 +00:00
bors
ce1150b9f0 Auto merge of #25043 - alexcrichton:musl-out-of-stack, r=nikomatsakis
Stack overflow detection does not currently work with MUSL, so this test needs
to be disabled.
2015-05-04 00:31:09 +00:00
bors
77ce30f038 Auto merge of #24990 - steveklabnik:doc_associated_constants, r=alexcrichton 2015-05-03 22:42:33 +00:00
Jake Goulding
7826711dcb Clean up the grammar around the inline attribute 2015-05-03 17:52:11 -04:00
bors
796be61e90 Auto merge of #25070 - dotdash:inline_hash, r=alexcrichton
Since the hashmap and its hasher are implemented in different crates, we
currently can't benefit from inlining, which means that especially for
small, fixed size keys, there is a huge overhead in hash calculations,
because the compiler can't apply optimizations that only apply for these
keys.

Fixes the brainfuck benchmark in #24014.
2015-05-03 20:55:59 +00:00
bors
6b3d66b04f Auto merge of #25060 - luqmana:matching-dst-struct, r=huonw
Fixes #23261.

cc @blaenk
2015-05-03 19:08:06 +00:00
bors
1a60dc4fc4 Auto merge of #24737 - P1start:dst-cell, r=alexcrichton
This + DST coercions (#24619) would allow code like `Rc<RefCell<Box<Trait>>>` to be simplified to `Rc<RefCell<Trait>>`.
2015-05-03 17:22:09 +00:00
bors
26933a638c Auto merge of #25048 - huonw:test-benches, r=alexcrichton
E.g. if `foo.rs` looks like

    #![feature(test)]
    extern crate test;

    #[bench]
    fn bar(b: &mut test::Bencher) {
        b.iter(|| {
            1
        })
    }

    #[test]
    fn baz() {}

    #[bench]
    fn qux(b: &mut test::Bencher) {
        b.iter(|| {
            panic!()
        })
    }

Then

    $ rustc --test foo.rs
    $ ./foo

    running 3 tests
    test baz ... ok
    test qux ... FAILED
    test bar ... ok

    failures:

    ---- qux stdout ----
    	thread 'qux' panicked at 'explicit panic', bench.rs:17

    failures:
        qux

    test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured

    $ ./foo --bench ba

    running 2 tests
    test baz ... ignored
    test bar ... bench:        97 ns/iter (+/- 74)

    test result: ok. 0 passed; 0 failed; 1 ignored; 1 measured

In particular, the two benchmark are being run as tests in the default
mode.

This helps for the main distribution, since benchmarks are only run with
`PLEASE_BENCH=1`, which is rarely set (and never set on the test bots),
and helps for code-coverage tools: benchmarks are run and so don't count
as dead code.

Fixes #15842.
2015-05-03 14:06:08 +00:00
Björn Steinbrink
f4176b52d3 Restore HashMap performance by allowing some functions to be inlined
Since the hashmap and its hasher are implemented in different crates, we
currently can't benefit from inlining, which means that especially for
small, fixed size keys, there is a huge overhead in hash calculations,
because the compiler can't apply optimizations that only apply for these
keys.

Fixes the brainfuck benchmark in #24014.
2015-05-03 14:08:30 +02:00
Jan Bujak
91ea0c4f12 Add #[inline(always)] to str::from_utf8_unchecked
Without the inline annotation this:
    str::from_utf8_unchecked( slice::from_raw_parts( ptr, len ) )
doesn't get inlined which can be pretty brutal performance-wise
when used in an inner loop of a low level string manipulation method.
2015-05-03 12:09:40 +02:00
Luqman Aden
715605faf9 librustc_trans: Handle DST structs in trans::_match. 2015-05-03 05:36:04 -04:00
bors
07915ef6a1 Auto merge of #25064 - tshepang:brevity, r=alexcrichton 2015-05-03 07:08:13 +00:00
Tshepang Lekhonkhobe
78c1ae2791 doc: make concat() and connect() examples brief 2015-05-03 05:27:36 +02:00
Tshepang Lekhonkhobe
f86da3d6de doc: improve IpAddr is_global and is_unicast_global 2015-05-03 04:57:02 +02:00
bors
0d7d3ec9d2 Auto merge of #25058 - steveklabnik:gh25008, r=huonw
Fixes #25008
2015-05-02 20:47:32 +00:00
bors
5574029b68 Auto merge of #25038 - bluss:fat-pointer-cast, r=luqmana
typeck: Make sure casts from other types to fat pointers are illegal

Fixes ICEs where non-fat pointers and scalars are cast to fat pointers,

Fixes #21397
Fixes #22955
Fixes #23237
Fixes #24100
2015-05-02 17:44:11 +00:00
Steve Klabnik
6b465f5c87 TRPL: associated constants 2015-05-02 11:58:30 -04:00
Steve Klabnik
df18642b1a Revise @ in patterns section
Fixes #25008
2015-05-02 11:56:58 -04:00
bors
84f8c257b4 Auto merge of #25054 - bguiz:patch-1, r=steveklabnik
- `0..2` iterates over `0,1`
- `0..3` iterates over `0,1,2`, which is what we want instead
2015-05-02 14:42:57 +00:00
bors
38cedaf430 Auto merge of #25045 - XuefengWu:1398_remove_ndebug, r=huonw
According to #1398 and pull https://github.com/rust-lang/cargo/pull/1444 , fix doc overridable using -C debug-assertions
2015-05-02 12:56:05 +00:00
Brendan Graetz
3eee2b9319 =BG= minor: add link to book source files
- I found n error in the book, before contributing the patch to fix it, I had to find where they were hosted
- It took me quite look to find where within the rust-lang *organisation* it was!
2015-05-02 22:40:07 +10:00
Brendan Graetz
07ff8279be =BG= minor: ensure correct range bounds in concurreny examples in the rust book
- `0..2` iterates over `0,1`
- `0..3` iterates over `0,1,2`, which is what we want instead
2015-05-02 22:29:53 +10:00
bors
354d16bd72 Auto merge of #25027 - Manishearth:deriving_attr, r=huonw
Adds an `attrs` field to `FieldInfo` which lets one check the attributes on
a field whilst expanding.

This lets deriving plugins be more robust, for example providing the ability to
"ignore" a field for the purpose of deriving, or perhaps handle the field a
different way.


r? @huonw
2015-05-02 09:55:13 +00:00
Manish Goregaokar
5892b40859 Rename AstBuilder::expr_int -> AstBuilder::expr_isize 2015-05-02 13:57:58 +05:30
bors
82158c9d1c Auto merge of #25040 - mrsweaters:patch-1, r=alexcrichton
Correct 'danging' to 'dangling'.
2015-05-02 08:09:47 +00:00
sinkuu
5d8431c203 Override Iterator::count method in vec::IntoIter 2015-05-02 17:05:43 +09:00
bors
f0af2ec99c Auto merge of #24980 - jooert:test-22468, r=pnkfelix
Closes #22468.
2015-05-02 06:22:41 +00:00
Huon Wilson
d73545ceca Run benchmarks once, as a test by default.
E.g. if `foo.rs` looks like

    #![feature(test)]
    extern crate test;

    #[bench]
    fn bar(b: &mut test::Bencher) {
        b.iter(|| {
            1
        })
    }

    #[test]
    fn baz() {}

    #[bench]
    fn qux(b: &mut test::Bencher) {
        b.iter(|| {
            panic!()
        })
    }

Then

    $ rustc --test foo.rs
    $ ./foo

    running 3 tests
    test baz ... ok
    test qux ... FAILED
    test bar ... ok

    failures:

    ---- qux stdout ----
    	thread 'qux' panicked at 'explicit panic', bench.rs:17

    failures:
        qux

    test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured

    $ ./foo --bench ba

    running 2 tests
    test baz ... ignored
    test bar ... bench:        97 ns/iter (+/- 74)

    test result: ok. 0 passed; 0 failed; 1 ignored; 1 measured

In particular, the two benchmark are being run as tests in the default
mode.

This helps for the main distribution, since benchmarks are only run with
`PLEASE_BENCH=1`, which is rarely set (and never set on the test bots),
and helps for code-coverage tools: benchmarks are run and so don't count
as dead code.

Fixes #15842.
2015-05-02 15:45:23 +10:00
bors
700b4c160b Auto merge of #25028 - bluss:drain-string, r=alexcrichton
collections: Implement String::drain(range) according to RFC 574

`.drain(range)` is unstable and under feature(collections_drain).

This adds a safe way to remove any range of a String as efficiently as
possible.

As noted in the code, this drain iterator has none of the memory safety
issues of the vector version.

RFC tracking issue is #23055
2015-05-02 04:35:33 +00:00
bors
b858b7f4ce Auto merge of #25015 - alexcrichton:rwlock-check-ret, r=aturon
Apparently implementations are allowed to return EDEADLK instead of blocking
forever, in which case this can lead to unsafety in the `RwLock` primitive
exposed by the standard library. A debug-build of the standard library would
have caught this error (due to the debug assert), but we don't ship debug
builds right now.

This commit adds explicit checks for the EDEADLK error code and triggers a panic
to ensure the call does not succeed.

Closes #25012
2015-05-02 02:48:53 +00:00
Xuefeng Wu
5d963d23c6 fix doc:#1398 stop passing --cfg ndebug and uses -C debug-assertions 2015-05-02 10:24:10 +08:00
bors
c42c1e7a67 Auto merge of #24792 - alexcrichton:issue-24748, r=alexcrichton
Ensures that the same error type is propagated throughout. Unnecessary leakage
of the internals is prevented through the usage of stability attributes.

Closes #24748
2015-05-02 01:03:43 +00:00
Alex Crichton
e32dab78b8 test: Ignore out-of-stack for MUSL
Stack overflow detection does not currently work with MUSL, so this test needs
to be disabled.
2015-05-01 17:55:08 -07:00
Jordan Humphreys
f2a19b39fb Correct typo in introduction
Correct 'danging' to 'dangling'.
2015-05-01 16:54:57 -07:00
Alex Crichton
12910418fb std: Don't use a wrapper for the float error type
Ensures that the same error type is propagated throughout. Unnecessary leakage
of the internals is prevented through the usage of stability attributes.

Closes #24748
2015-05-01 16:44:36 -07:00
Ulrik Sverdrup
4806fb29a0 typeck: Make sure casts to or from fat pointers are illegal
Fixes ICEs where non-fat pointers and scalars are cast to fat pointers,

Fixes #21397
Fixes #22955
Fixes #23237
Fixes #24100
2015-05-02 01:18:33 +02:00
bors
f6574c5b04 Auto merge of #25006 - alexcrichton:unstable-indexing, r=aturon
These implementations were intended to be unstable, but currently the stability
attributes cannot handle a stable trait with an unstable `impl` block. This
commit also audits the rest of the standard library for explicitly-`#[unstable]`
impl blocks. No others were removed but some annotations were changed to
`#[stable]` as they're defacto stable anyway.

One particularly interesting `impl` marked `#[stable]` as part of this commit
is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly
clones all elements of the vector provided.

Closes #24791

[breaking-change]
2015-05-01 22:54:09 +00:00
P1start
57d8289754 Make UnsafeCell, RefCell, Mutex, and RwLock accept DSTs
This + DST coercions (#24619) would allow code like `Rc<RefCell<Box<Trait>>>` to
be simplified to `Rc<RefCell<Trait>>`.
2015-05-02 10:03:35 +12:00
bors
f3345cb0a7 Auto merge of #24778 - nagisa:managed-removal, r=huonw
Leftovers from @-pointer times, I guess.
2015-05-01 19:17:45 +00:00
Ulrik Sverdrup
da03c9df33 syntax: Avoid reallocating or copying in CodeMap::new_filemap
Avoid creating a new String when there is no BOM to strip, and
otherwises use .drain(..3) to strip the BOM using the same allocation.
2015-05-01 19:51:31 +02:00
Ulrik Sverdrup
ee48e6d192 collections: Implement String::drain(range) according to RFC 574
`.drain(range)` is unstable and under feature(collections_drain).

This adds a safe way to remove any range of a String as efficiently as
possible.

As noted in the code, this drain iterator has none of the memory safety
issues of the vector version.

RFC tracking issue is #23055
2015-05-01 19:51:31 +02:00
Alex Crichton
b1976f1f6e std: Remove index notation on slice iterators
These implementations were intended to be unstable, but currently the stability
attributes cannot handle a stable trait with an unstable `impl` block. This
commit also audits the rest of the standard library for explicitly-`#[unstable]`
impl blocks. No others were removed but some annotations were changed to
`#[stable]` as they're defacto stable anyway.

One particularly interesting `impl` marked `#[stable]` as part of this commit
is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly
clones all elements of the vector provided.

Closes #24791
2015-05-01 10:40:46 -07:00
bors
613109db1b Auto merge of #24720 - critiqjo:stepby-sizehint, r=alexcrichton
`Iterator::size_hint` can be easily implemented for `StepBy`.
#23708
2015-05-01 16:42:19 +00:00
bors
1320c293c1 Auto merge of #25025 - Manishearth:rollup, r=Manishearth
- Successful merges: #24979, #24980, #24981, #24982, #24983, #24987, #24988, #24991, #24992, #24994, #24998, #25002, #25010, #25014, #25020, #25021
- Failed merges:
2015-05-01 14:50:51 +00:00
Manish Goregaokar
616b94b66c Rollup merge of #25021 - frewsxcv:an-utf, r=steveklabnik
Even spelled out, one would say 'a Universal Character Set'
2015-05-01 20:20:21 +05:30