Commit Graph

42530 Commits

Author SHA1 Message Date
bors
9b481f89d1 Auto merge of #25056 - jooert:sometests, r=alexcrichton
Add several regression tests and remove some unnecessary FIXMEs.
2015-05-04 18:59:47 +00:00
Alex Crichton
700cff5262 std: Join threads in select! doctest
This test has deadlocked on Windows once or twice now and we've had lots of
problems in the past of threads panicking when the process is being shut down.
One of the two threads in this test is guaranteed to panic because of the
`.unwrap()` on the `send` calls, so just call `recv` on both receivers after the
test executes to ensure that both threads are dying/dead.
2015-05-04 11:31:36 -07:00
Alex Crichton
9b1dd4b35a std: Fix {atime,mtime,ctime}_nsec accessors
These all had a typo where they were accessing the seconds field, not the
nanoseconds field.
2015-05-04 11:21:49 -07:00
Johannes Oertel
e7d052ebd9 Remove several FIXMEs 2015-05-04 20:05:40 +02:00
Joseph Crail
464069a4bf Fix spelling errors in documentation. 2015-05-04 13:21:27 -04:00
bors
70db76602e Auto merge of #25078 - nham:std_net_impl_debug, r=alexcrichton
I'm uncertain whether the 3 implementations in `net2` should unwrap the socket address values. Without unwrapping it looks like this:

```
UdpSocket { addr: Ok(V4(127.0.0.1:34354)), inner: 3 }
TcpListener { addr: Ok(V4(127.0.0.1:9123)), inner: 4 }
TcpStream { addr: Ok(V4(127.0.0.1:9123)), peer: Ok(V4(127.0.0.1:58360)), inner: 5 }
```

One issue is that you can create, e.g. `UdpSocket`s with bad addresses, which means you can't just unwrap in the implementation:

```
#![feature(from_raw_os)]
use std::net::UdpSocket;
use std::os::unix::io::FromRawFd;

let sock: UdpSocket = unsafe { FromRawFd::from_raw_fd(-1) };
println!("{:?}", sock); // prints "UdpSocket { addr: Err(Error { repr: Os(9) }), inner: -1 }"

```

Fixes #23134.
2015-05-04 17:12:19 +00:00
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
Johannes Oertel
c4d81024db Add regression test for #22471
Closes #22471.
2015-05-04 14:03:12 +02:00
Huon Wilson
4b46546af0 Make BitVec::process faster (branch free).
This makes the `bit::vec::bench::bench_bit_vec_big_union` benchmark go
from `774 ns/iter (+/- 190)` to `602 ns/iter (+/- 5)`.

(There's room for more work here too: if one can guarantee 128-bit
alignment for the vector, the compiler actually optimises `union`,
`intersection` etc. to SIMD instructions, which end up being ~5x faster
that the original version, and 4x faster than the optimised version in
this patch.)
2015-05-04 21:20:10 +10: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
Felix S. Klock II
c62c908f08 Correct pretty-printing of type Foo<T> where T: Bound = ...;
Fix #25031
2015-05-04 10:21:39 +02:00
Felix S. Klock II
42cb2de139 Avoid latent (harmless) overflow in core::slice.
This overflow does not cause any problems; it just causes errors to be
signalled when compiling with `-C debug-assertions`.

Fix #24997
2015-05-04 09:57:42 +02: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
Nick Hamann
51463c3b17 Improve std::vec module documentation.
This changes the std::vec module docs to use full sentences. It also adds an example
for indexing vectors.
2015-05-03 23:47:10 -05: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
Abhishek Chanda
285ab0266c Add functions to convert IPv4 to long and back 2015-05-03 19:08:53 -07:00
Nick Hamann
987eb28eca Add tests for 3 Debug implementations 2015-05-03 20:01:25 -05: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
Carol Nichols
d3667746d4 Update tests to not use old ~ syntax 2015-05-03 20:16:03 -04:00
Carol Nichols
232b2022b5 Update debuginfo metadata to use Box instead of ~
Also remove comments that reference the unique_type_id HEAP_VEC_BOX
metadata, which was removed in 3e62637 and the unique_type_id GC_BOX
metadata, which was removed in 8a91d33.
2015-05-03 20:16:03 -04:00
Carol Nichols
7ec8172225 Update old uses of ~ in comments and debugging statements 2015-05-03 20:16:02 -04:00
bors
77ce30f038 Auto merge of #24990 - steveklabnik:doc_associated_constants, r=alexcrichton 2015-05-03 22:42:33 +00:00
Nick Hamann
91f9dd468f Change 'inner' field name to 'fd'/'socket' on Unix/Windows in Debug impls 2015-05-03 17:31:26 -05:00
Nick Hamann
dd85c42ee1 Unwrap address values in Debug implementations for TcpStream/TcpListener/UdpSocket.
This now omits address fields in Debug implementations when a proper address value
cannot be unwrapped.
2015-05-03 17:13:42 -05:00
Jake Goulding
7826711dcb Clean up the grammar around the inline attribute 2015-05-03 17:52:11 -04:00
Carol (Nichols || Goulding)
92d49cf6c5 Remove unused extract_grammar.py
This script used to be used to extract the grammar sections from the
reference, but there is now a separate src/doc/grammar.md where the
grammar sections that used to be in the reference live, so there is
no longer a need to extract the grammar from the reference.
2015-05-03 17:45:37 -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
Pascal Hertleif
2ac380a294 Fix Derive Notice for HashSet 2015-05-03 21:51:41 +02:00
Pascal Hertleif
5ad6edbe52 Fix Derive Notice for HashMap 2015-05-03 21:50:37 +02: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
Nick Hamann
3a4a1e5f38 Implement Debug for std::net::{UdpSocket,TcpStream,TcpListener,Shutdown}
Fixes #23134.
2015-05-03 14:02:59 -05: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
Pascal Hertleif
1283044a1a Clean up HashSet Examples 2015-05-03 18:06:08 +02:00
Pascal Hertleif
6814c2f1aa HashSet Docs: Split First Paragraph
This way, the module index renders only the first sentence as a short
description.
2015-05-03 18:02:43 +02:00
Pascal Hertleif
35149bf1ce Clean up HashMap examples 2015-05-03 17:44:24 +02: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
Michael Sproul
1174114356 Add error index generator. 2015-05-03 22:08:25 +10:00
Brendan Graetz
75a3e29042 =BG= minor: File::open --> File::create in rust book
- `FIle::open` is for opening a file in read-only mode
- `FIle::create` is for opening a file in write-only mode, which is what we want instead for this example to make sense
2015-05-03 20:42:47 +10: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