Commit Graph

61002 Commits

Author SHA1 Message Date
Stjepan Glavina
fa457bff26 Minor fix in the *_expensive benchmark
Before, the `count` would be copied into the closure and could
potentially be optimized way. This change ensures it's borrowed by
closure and finally consumed by `test::black_box`.
2017-02-04 18:04:26 +01:00
Stjepan Glavina
a884a6c60d Slightly optimize slice::sort
First, get rid of some bound checks.

Second, instead of comparing by ternary `compare` function, use a binary
function testing whether an element is less than some other element.
This apparently makes it easier for the compiler to reason about the
code.

Benchmark:

```
name                                        before ns/iter        after ns/iter         diff ns/iter   diff %
slice::bench::sort_large_ascending          8,969 (8919 MB/s)     7,410 (10796 MB/s)          -1,559  -17.38%
slice::bench::sort_large_big_ascending      355,640 (3599 MB/s)   359,137 (3564 MB/s)          3,497    0.98%
slice::bench::sort_large_big_descending     427,112 (2996 MB/s)   424,721 (3013 MB/s)         -2,391   -0.56%
slice::bench::sort_large_big_random         2,207,799 (579 MB/s)  2,138,804 (598 MB/s)       -68,995   -3.13%
slice::bench::sort_large_descending         13,694 (5841 MB/s)    13,514 (5919 MB/s)            -180   -1.31%
slice::bench::sort_large_mostly_ascending   239,697 (333 MB/s)    203,542 (393 MB/s)         -36,155  -15.08%
slice::bench::sort_large_mostly_descending  270,102 (296 MB/s)    234,263 (341 MB/s)         -35,839  -13.27%
slice::bench::sort_large_random             513,406 (155 MB/s)    470,084 (170 MB/s)         -43,322   -8.44%
slice::bench::sort_large_random_expensive   23,650,321 (3 MB/s)   23,675,098 (3 MB/s)         24,777    0.10%
slice::bench::sort_medium_ascending         143 (5594 MB/s)       132 (6060 MB/s)                -11   -7.69%
slice::bench::sort_medium_descending        197 (4060 MB/s)       188 (4255 MB/s)                 -9   -4.57%
slice::bench::sort_medium_random            3,358 (238 MB/s)      3,271 (244 MB/s)               -87   -2.59%
slice::bench::sort_small_ascending          32 (2500 MB/s)        32 (2500 MB/s)                   0    0.00%
slice::bench::sort_small_big_ascending      97 (13195 MB/s)       97 (13195 MB/s)                  0    0.00%
slice::bench::sort_small_big_descending     247 (5182 MB/s)       249 (5140 MB/s)                  2    0.81%
slice::bench::sort_small_big_random         502 (2549 MB/s)       498 (2570 MB/s)                 -4   -0.80%
slice::bench::sort_small_descending         55 (1454 MB/s)        61 (1311 MB/s)                   6   10.91%
slice::bench::sort_small_random             358 (223 MB/s)        356 (224 MB/s)                  -2   -0.56%
```
2017-02-04 16:44:43 +01:00
bors
7df5c0f17b Auto merge of #39425 - jakllsch:netbsd-a, r=alexcrichton
Don't build gcc_personality_v0.c on NetBSD either
2017-02-04 07:29:28 +00:00
bors
1b5c7ac833 Auto merge of #39399 - clarcharr:iter_rfind, r=alexcrichton
Add Iterator::rfind.

I found it weird that `Iterator` has `rpostition` but not `rfind`. This adds that method.
2017-02-04 04:53:53 +00:00
bors
c781fc4a6a Auto merge of #36320 - GuillaumeGomez:rustdoc_test_info, r=alexcrichton
Add information in case of markdown block code test failure

r? @steveklabnik

cc @jonathandturner
2017-02-04 01:32:21 +00:00
bors
0648517faf Auto merge of #39463 - alexcrichton:update-bootstrap, r=alexcrichton
Bump version, upgrade bootstrap

This commit updates the version number to 1.17.0 as we're not on that version of
the nightly compiler, and at the same time this updates src/stage0.txt to
bootstrap from freshly minted beta compiler and beta Cargo.
2017-02-03 22:55:28 +00:00
Alex Crichton
626e754473 Bump version, upgrade bootstrap
This commit updates the version number to 1.17.0 as we're not on that version of
the nightly compiler, and at the same time this updates src/stage0.txt to
bootstrap from freshly minted beta compiler and beta Cargo.
2017-02-03 13:25:46 -08:00
bors
86d9ed6c82 Auto merge of #39356 - krdln:format-with-capacity, r=aturon
Use `String::with_capacity` in `format!`

Add an `Arguments::estimated_capacity` to estimate the length of formatted text and use it in `std::fmt::format` as the initial capacity of the buffer.

The capacity is calculated based on the literal parts of format string, see the details in the implementation.

Some benches:
```rust
empty:       format!("{}", black_box(""))
literal:     format!("Literal")
long:        format!("Hello Hello Hello Hello, {}!", black_box("world"))
long_rev:    format!("{}, hello hello hello hello!", black_box("world"))
long_rev_2:  format!("{}{}, hello hello hello hello!", 1, black_box("world"))
short:       format!("Hello, {}!", black_box("world"))
short_rev:   format!("{}, hello!", black_box("world"))
short_rev_2: format!("{}{}, hello!", 1, black_box("world"))
surround:    format!("aaaaa{}ccccc{}eeeee", black_box("bbbbb"), black_box("eeeee"))
two_spaced:  format!("{} {}", black_box("bbbbb"), black_box("eeeee"))
worst_case:  format!("{} a long piece...", black_box("and even longer argument. not sure why it has to be so long"))
```
```
 empty        25            28                      3   12.00%
 literal      35            29                     -6  -17.14%
 long         80            46                    -34  -42.50%
 long_rev     79            45                    -34  -43.04%
 long_rev_2   111           66                    -45  -40.54%
 short        73            46                    -27  -36.99%
 short_rev    74            76                      2    2.70%
 short_rev_2  107           108                     1    0.93%
 surround     142           65                    -77  -54.23%
 two_spaced   111           115                     4    3.60%
 worst_case   89            101                    12   13.48%
```
2017-02-03 20:09:36 +00:00
Michał Krasnoborski
0267529681 Merge remote-tracking branch 'upstream/master' into format-with-capacity 2017-02-03 17:48:07 +01:00
Guillaume Gomez
b7f1d7a4bd Update to last cargo version 2017-02-03 13:55:18 +01:00
bors
aed6410a7b Auto merge of #39418 - redox-os:redox_fs_ext, r=brson
Add dev and ino to MetadataExt

This adds .dev() and .ino() to MetadataExt on Redox
2017-02-03 11:42:32 +00:00
Guillaume Gomez
723eed3228 Update cargo version to last master 2017-02-03 11:08:20 +01:00
Guillaume Gomez
7c4b79c80a Update run-make/issue-22131 to new rustdoc --test format 2017-02-03 11:08:20 +01:00
Guillaume Gomez
f144795058 Set correct hoedown submodule branch 2017-02-03 11:08:20 +01:00
Guillaume Gomez
6756b72a1d Create new flag to test rustdoc --test 2017-02-03 11:08:20 +01:00
Guillaume Gomez
44b59be0f2 Move test from bootstrap to compiletest 2017-02-03 11:08:20 +01:00
Guillaume Gomez
aea6f3234a Put rustdoc --test ui check at the end of docs check 2017-02-03 11:08:20 +01:00
Guillaume Gomez
d97226c132 Add new rustdoc ui tests 2017-02-03 11:08:20 +01:00
Guillaume Gomez
62fb7fc54a Switch logic to Span instead of HashMap 2017-02-03 11:08:20 +01:00
Guillaume Gomez
409e8ba34e Move to my own hoedown repository 2017-02-03 11:08:19 +01:00
Guillaume Gomez
a0ad4adf59 Change thread name 2017-02-03 11:08:19 +01:00
Guillaume Gomez
5fe3915a05 Rework rustdoc test output a bit 2017-02-03 11:08:19 +01:00
Guillaume Gomez
59ac401b39 Truncate output example to 10 lines 2017-02-03 11:08:19 +01:00
Guillaume Gomez
902460d218 Add line number and filename in error message 2017-02-03 11:08:19 +01:00
ggomez
230234f3a8 Add information in case of markdown block code test failure 2017-02-03 11:08:19 +01:00
bors
f45992b300 Auto merge of #39415 - alexcrichton:fix-upload-dirs, r=brson
travis: Really delete the `doc` folder

Got two location to look at, be sure to delete them both.
2017-02-03 09:13:06 +00:00
bors
57ecd7aa4b Auto merge of #39329 - petrochenkov:rb2, r=alexcrichton
rustbuild: Build jemalloc and libbacktrace only once (take 2)

This is a rebase of https://github.com/rust-lang/rust/pull/38583 without any additions, but with implemented @alexcrichton's suggestions.
~~This includes `exists(Makefile)` => `cfg(stage0)` suggestion... but it will break cross-compilation, no? Are `libstd/liballoc_jemalloc` cross-compiled for `target != host` built during `stage0`?~~

r? @alexcrichton
2017-02-03 05:58:09 +00:00
Clar Charr
3cf485c963 Move rfind to DoubleEndedIterator, add tracking issue. 2017-02-03 00:01:52 -05:00
bors
5de2a24b2e Auto merge of #39287 - wesleywiser:move_cell, r=aturon
Extend Cell to work with non-Copy types

I'm not sure that I did this right but all of the tests pass.

I also had to move the `new()` function so that `Cell`s with non-`Copy` `T`s could be created. That wasn't in the RFC but I assume it needed to be done?
2017-02-03 03:23:35 +00:00
bors
7f294e4c18 Auto merge of #39466 - alexcrichton:fix, r=Manishearth
std: Fix IntoIter::as_mut_slice's signature

This was intended to require `&mut self`, not `&self`, otherwise it's unsound!

Closes #39465
2017-02-03 00:47:58 +00:00
bors
eedaa94e33 Auto merge of #39470 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 9 pull requests

- Successful merges: #38823, #39196, #39299, #39319, #39373, #39383, #39416, #39420, #39427
- Failed merges:
2017-02-02 21:58:10 +00:00
Guillaume Gomez
d09e4de640 Rollup merge of #39427 - steveklabnik:pliniker-mailmap, r=alexcrichton
update mailmap for @pliniker
2017-02-02 22:22:33 +01:00
Guillaume Gomez
a561ad831d Rollup merge of #39420 - oli-obk:sugg, r=pnkfelix
parser: use suggestions instead of helps with code in them
2017-02-02 22:22:29 +01:00
Guillaume Gomez
9559c4d823 Rollup merge of #39416 - tspiteri:ffi-unsafe-icon, r=brson
rustdoc: mark FFI functions with unsafety icon

Currently, in the list of functions, unsafe functions are marked with a superscript ⚠, but unsafe FFI functions are not. This patch treats unsafe FFI functions like other unsafe functions in this regard.
2017-02-02 22:22:28 +01:00
Guillaume Gomez
7bc322281d Rollup merge of #39383 - nagisa:mir-uninhabited-destinations, r=pnkfelix
Remove the workaround for gh32959

This workaround is no longer necessary as Rust, and by extension MIR, now support uninhabited type
properly. This removes the workaround for the gh32959 that was introduced in gh33267.

Fixes #32959
2017-02-02 22:22:26 +01:00
Guillaume Gomez
a768827c24 Rollup merge of #39373 - Mark-Simulacrum:remove-toprimitive, r=aturon
Remove ToPrimitive trait.

It is no longer used.
2017-02-02 22:22:24 +01:00
Guillaume Gomez
bcfa2f1cce Rollup merge of #39319 - nagisa:remove-rustsetpersonalityfn, r=pnkfelix
Remove unnecessary LLVMRustPersonalityFn binding

LLVM Core C bindings provide this function for all the versions back to what we support (3.7), and
helps to avoid this unnecessary builder->function transition every time. Also a negative diff.

Fixes #38462 (although it was pretty much fixed already)
2017-02-02 22:22:23 +01:00
Guillaume Gomez
b03436d2e3 Rollup merge of #39299 - federicomenaquintero:master, r=GuillaumeGomez
In std:rc, clarify the lack of mutability inside an Rc

Also, point to the example in Cell's docs for how to do it.
2017-02-02 22:22:22 +01:00
Guillaume Gomez
38ae9233b5 Rollup merge of #39196 - apasel422:nomicon, r=petrochenkov
Update nomicon to describe `#[may_dangle]`

CC #34761
r? @pnkfelix
2017-02-02 22:22:21 +01:00
Guillaume Gomez
5ada328d81 Rollup merge of #38823 - Freyskeyd:doc-missingInformationCfgTest, r=steveklabnik
Improve doc cfg(test) and tests directory

Hi,

I was facing a problem with my code organisation. I was using a tests directory and i defined some `#[cfg(test)]` in my `src/`. But i was not able to use it in my `tests` folder.

```bash
.
├── Cargo.lock
├── Cargo.toml
├── src
│   ├── lib.rs
│   └── test.rs
└── tests
    └── x.rs
```
> src/lib.rs
```rust
pub mod test;

fn tesst() {
    assert!(test::t());
}
```
> src/test.rs
```rust
pub fn t() -> bool { true }
```
> test/x.rs
```rust
extern crate testt;

use testt::test;
fn tesst() {
    assert!(test::t());
}
```

I was unable to compile using `cargo test`:
```bash
error[E0432]: unresolved import `testt::test`
 --> tests/x.rs:3:5
  |
3 | use testt::test;
  |     ^^^^^^^^^^^ no `test` in `testt`
```

If i remove the `tests` directory everything works fine. To use an utils module in your `tests` directory, you need to create a module in the directory (like `tests/utils.rs`). My `tests/x.rs` look like this now:

```rust
extern crate testt;

mod utils;

fn tesst() {
    assert!(utils::t());
}
```

And my tree:
```bash
.
├── Cargo.lock
├── Cargo.toml
├── src
│   └── lib.rs
└── tests
    ├── utils.rs
    └── x.rs
```

I think that thing must be documented in the book.

Ping:
- @badboy : Because he's the one who showed me the path
- @shahn : Because he helped me too to find the solution

Signed-off-by: Freyskeyd <simon.paitrault@iadvize.com>
2017-02-02 22:22:19 +01:00
Vadim Petrochenkov
b4abb72ef0 Fixup crate versions 2017-02-02 23:55:42 +03:00
Vadim Petrochenkov
a5b603b1bf Build libbacktrace/jemalloc only when their timestamps are older than sources 2017-02-02 22:40:42 +03:00
Vadim Petrochenkov
c0253304ea Fix build in cross-compilation scenarios 2017-02-02 22:40:42 +03:00
Vadim Petrochenkov
6c2ef5201a rustbuild: Build jemalloc and libbacktrace only once (take 2) 2017-02-02 22:40:42 +03:00
Alex Crichton
80f7db63b6 std: Fix IntoIter::as_mut_slice's signature
This was intended to require `&mut self`, not `&self`, otherwise it's unsound!

Closes #39465
2017-02-02 11:27:52 -08:00
bors
a47a6ea771 Auto merge of #39411 - tamird:match-arm-statics-ICE, r=alexcrichton
statics in match arm: compile with -g

Resubmission of #29700.

r? @alexcrichton
2017-02-02 18:20:37 +00:00
bors
1a2428fc88 Auto merge of #39402 - king6cong:master, r=nrc
comment rewording and argument unifying
2017-02-02 15:41:19 +00:00
bors
d5f54743db Auto merge of #39386 - tbu-:pr_pipe_less_syscalls, r=alexcrichton
Use less syscalls in `anon_pipe()`

Save a `ENOSYS` failure from `pipe2` and don't try again.

Use `cvt` instead of `cvt_r` for `pipe2` - `EINTR` is not an error
`pipe2` can return.
2017-02-02 13:04:53 +00:00
bors
3b24c70012 Auto merge of #39384 - wesleywiser:fix_fixmes, r=alexcrichton
Resolve a bunch of fixmes

Resolves 56 fixmes in test code related to `box` syntax.
2017-02-02 10:40:13 +00:00
bors
6abe64871e Auto merge of #39116 - mgattozzi:better-string-message, r=nrc
Add clearer error message using `&str + &str`

This is the first part of #39018. One of the common things for new users
coming from more dynamic languages like JavaScript, Python or Ruby is to
use `+` to concatenate strings. However, this doesn't work that way in
Rust unless the first type is a `String`. This commit adds a check for
this use case and outputs a new error as well as a suggestion to guide
the user towards the desired behavior. It also adds a new test case to
test the output of the error.
2017-02-02 07:39:07 +00:00