Commit Graph

41992 Commits

Author SHA1 Message Date
bors
77ce30f038 Auto merge of #24990 - steveklabnik:doc_associated_constants, r=alexcrichton 2015-05-03 22:42:33 +00: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
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
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
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
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
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
Manish Goregaokar
ac7a75ec97 Rollup merge of #25020 - brson:current_dir, r=luqmana 2015-05-01 20:20:21 +05:30
Manish Goregaokar
c834fe474c Rollup merge of #25014 - frewsxcv:patch-20, r=alexcrichton
The variable doesn't need to be mutable.
2015-05-01 20:20:21 +05:30
Manish Goregaokar
0e9eb6022e Rollup merge of #25010 - huonw:inline-int-extremes, r=alexcrichton
These compile down to `mov $CONSTANT, register; ret`, but the lack of
`#[inline]` meant they have a full `call ...` when used from external
crates.
2015-05-01 20:20:20 +05:30
Manish Goregaokar
216fdafd71 Rollup merge of #25002 - steveklabnik:gh24767, r=alexcrichton
Fixes #24767
2015-05-01 20:20:20 +05:30
Manish Goregaokar
4aab003b60 Rollup merge of #24998 - steveklabnik:fix_links, r=alexcrichton
r? @alexcrichton
2015-05-01 20:20:20 +05:30
Manish Goregaokar
0855b7c8b5 Rollup merge of #24994 - steveklabnik:gh24977, r=alexcrichton
Fixes #24977
2015-05-01 20:20:20 +05:30
Manish Goregaokar
d3b7c5258f Rollup merge of #24992 - steveklabnik:gh24730, r=alexcrichton
Fixes #24730

r? @alexcrichton
2015-05-01 20:20:20 +05:30
Manish Goregaokar
4fda7e8b38 Rollup merge of #24991 - steveklabnik:gh24852, r=alexcrichton
First, a link was broken.

Second, the wording was a bit unclear, so I fixed it up.

Fixes #24852
2015-05-01 20:20:19 +05:30
Manish Goregaokar
84a23be537 Rollup merge of #24988 - semarie:unused-pid_t, r=alexcrichton
- unbreak the build under openbsd
- while here, apply same modification to dragonfly, freebsd, ios (pid_t
  imported, but not used in raw.rs)

r? @alexcrichton
cc @wg @mneumann @vhbit
2015-05-01 20:20:19 +05:30
Manish Goregaokar
0210381714 Rollup merge of #24983 - vhbit:ios-raw, r=sanxiyn 2015-05-01 20:20:19 +05:30
Manish Goregaokar
42fbcf3525 Rollup merge of #24982 - poga:fix-incorrect-doc-formatting, r=steveklabnik
Fix incorrect link tag formatting in `doc/trpl/nightly-rust.md`. Notice the last word of the paragraph.

Before:
![before](https://cloud.githubusercontent.com/assets/8631/7413645/10754b7e-ef80-11e4-9bb1-15e87ce9308f.png)

After:
![after](https://cloud.githubusercontent.com/assets/8631/7413647/13b96202-ef80-11e4-990b-6ecf72925e7d.png)
2015-05-01 20:20:19 +05:30
Manish Goregaokar
70020aa066 Rollup merge of #24981 - carols10cents:remove-more-priv, r=alexcrichton
Hi! While researching stuff for the reference and the grammar, I came across a few mentions of using the `priv` keyword that was removed in 0.11.0 (#13547, #8122, rust-lang/rfcs#26, [RFC 0026](https://github.com/rust-lang/rfcs/blob/master/text/0026-remove-priv.md)).

One occurrence is a mention in the reference, a few are in comments, and a few are marking test functions. I left the test that makes sure you can't name an ident `priv` since it's still a reserved keyword. I did a little grepping around for `priv `, priv in backticks, `Private` etc and I think the remaining instances are fine, but if anyone knows anywhere in particular I should check for any other lingering mentions of `priv`, please let me know and I would be happy to! 🍂 🌊
2015-05-01 20:20:18 +05:30
Manish Goregaokar
4957ecce3e Add test for custom deriving plugins which rely on field attributes 2015-05-01 15:49:05 +05:30