Commit Graph

78905 Commits

Author SHA1 Message Date
Collins Abitekaniza
42ee6d5fd5 refactor Mode enum 2018-06-03 04:59:54 +03:00
bors
3515dab431 Auto merge of #51310 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 6 pull requests

Successful merges:

 - #50167 ( Add as_nanos function to Duration)
 - #50919 (Provide more context for what the {f32,f64}::EPSILON values represent.)
 - #51124 (Reword {ptr,mem}::replace docs.)
 - #51147 (Stabilize SliceIndex trait.)
 - #51291 (Fix typos of ‘ambiguous’)
 - #51302 (Permit building rustdoc without compiler artifacts)

Failed merges:
2018-06-02 21:32:47 +00:00
Mark Simulacrum
dcfe311da8
Rollup merge of #51302 - Mark-Simulacrum:rustdoc-fast, r=QuietMisdreavus
Permit building rustdoc without compiler artifacts

None
2018-06-02 13:14:28 -06:00
Mark Simulacrum
d297f68603
Rollup merge of #51291 - evincarofautumn:master, r=oli-obk
Fix typos of ‘ambiguous’

I had trouble finding this code because of the typo after it was [referenced in a tweet](https://twitter.com/bstrie/status/1002751044605153280). Also fixes an identical but unrelated typo in a comment.
2018-06-02 13:14:27 -06:00
Mark Simulacrum
5a575b542d
Rollup merge of #51147 - tmccombs:sliceindex, r=SimonSapin
Stabilize SliceIndex trait.

CC #35729

According to recommendations in
https://github.com/rust-lang/rust/issues/35729#issuecomment-377784884
2018-06-02 13:14:25 -06:00
Mark Simulacrum
dd61a32459
Rollup merge of #51124 - frewsxcv:frewsxcv-replace, r=QuietMisdreavus
Reword {ptr,mem}::replace docs.

Fixes https://github.com/rust-lang/rust/issues/50657.
2018-06-02 13:14:24 -06:00
Mark Simulacrum
6ff9108e12
Rollup merge of #50919 - frewsxcv:frewsxcv-epsilon, r=steveklabnik
Provide more context for what the {f32,f64}::EPSILON values represent.

Introduce the 'machine epsilon' term because if one googles 'epsilon', they might stumble upon https://en.wikipedia.org/wiki/Epsilon_numbers_(mathematics) instead of https://en.wikipedia.org/wiki/Machine_epsilon
2018-06-02 13:14:23 -06:00
Mark Simulacrum
77c8bd0b4e
Rollup merge of #50167 - fintelia:duration-nanos, r=sfackler
Add as_nanos function to Duration

Duration has historically lacked a way to get the actual number of nanoseconds it contained as a normal Rust type because u64 was of insufficient range, and f64 of insufficient precision. The u128 type solves both issues, so I propose adding an `as_nanos` function to expose the capability.
2018-06-02 13:14:22 -06:00
Mark Simulacrum
cf24a1df33 Rustdoc itself no longer requires proc macros to build
This avoids a full compiler build in order to build and/or run tests for
rustdoc.
2018-06-02 09:32:22 -06:00
bors
4ecf12bf0e Auto merge of #51063 - mixi:musl-bootstrap, r=alexcrichton
Fix building rustc on and for musl hosts.

This fixes all problems I had when trying to compile rustc on a musl-based distribution (with `crt-static = false` in `config.toml`).

This is a fixed version of what ended up being #50105, making it possible to compile rustc on musl targets.

The differences to the old (now merged and subsequently reverted) pull request are:
 - The commit (6d9154a830) that caused the regression for which the original commits were reverted in #50709 is left out. This means the corresponding bug #36710 is still not fixed with `+crt-static`.
 - The test for issue 36710 is skipped for musl targets (until the issue is properly fixed).
 - Building cargo-vendor if `crt-static = false` is needed was broken (cargo-vendor links to some shared libraries if they exist on the system and this produces broken binaries with `+crt-static`)

CC @alexcrichton
2018-06-02 15:26:26 +00:00
bors
d830f46b77 Auto merge of #51274 - nikomatsakis:issue-46557-promote-ref-mut, r=eddyb
also check `let` arms and nested patterns for mutable borrows

Fixes #46557

r? @eddyb
2018-06-02 13:22:38 +00:00
bors
1b3d737716 Auto merge of #51015 - nikomatsakis:issue-50672-remove-extern-crate-idiom, r=alexcrichton
merge unused-extern-crate and unnecessary-extern-crate lints

Extend the `unused_extern_crates` lint to offer a suggestion to remove the extern crate and remove the `unnecessary_extern_crate` lint.

Still a few minor issues to fix:
- [x] this *does* now leave a blank line... (defer to https://github.com/rust-lang/rust/issues/51176)
  - idea: extend the span to be replaced by 1 character if the next character is a `\n`
- [x] what about macros? do we need to watch out for that? (defer to https://github.com/rust-lang/rust/issues/48704)
- [x] also it doesn't work for `extern crate foo; fn main() { foo::bar(); }`
  - this is subtle: the `foo` might be shadowing a glob import too, can't always remove
  - defer to https://github.com/rust-lang/rust/issues/51177
- [x] we also don't do the `pub use` rewrite thang (https://github.com/rust-lang/rust/issues/51013)

Spun off from https://github.com/rust-lang/rust/pull/51010

Fixes #50672

r? @alexcrichton
2018-06-02 11:14:14 +00:00
bors
2954cb5119 Auto merge of #50554 - clarcharr:from_bool, r=TimNN
Add From<bool> for int types

Fixes #46109.
2018-06-02 07:50:10 +00:00
Jon Purdy
562d97d978 Fix typos of 'ambiguous' 2018-06-02 00:20:00 -07:00
Corey Farwell
61b5bd25b5 Reword {ptr,mem}::replace docs.
Fixes https://github.com/rust-lang/rust/issues/50657.
2018-06-01 23:08:12 -04:00
bors
edae1cc38b Auto merge of #51270 - nicokoch:issue-51266, r=TimNN
fs: copy: Add EPERM to fallback error conditions

Fixes #51266
2018-06-02 03:06:26 +00:00
bors
5f7c9da0a7 Auto merge of #51287 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 5 pull requests

Successful merges:

 - #51135 (Tweak output on E0599 for assoc fn used as method)
 - #51152 (Replace `if` with `if and only if` in the definition dox of `Sync`)
 - #51262 (Add missing whitespace in num example)
 - #51272 (Remove feature flag from fs::read_to_string example)
 - #51286 (Pull 1.26.2 release notes into master)

Failed merges:
2018-06-02 00:58:29 +00:00
Mark Simulacrum
c8f9b7ce71
Rollup merge of #51286 - Mark-Simulacrum:1.26.2-release-notes, r=Mark-Simulacrum
Pull 1.26.2 release notes into master

None
2018-06-01 17:25:18 -06:00
Mark Simulacrum
29a4cd0629
Rollup merge of #51272 - steveklabnik:remove_feature_flag, r=QuietMisdreavus
Remove feature flag from fs::read_to_string example

This is stable, and so no longer needed
2018-06-01 17:25:17 -06:00
Mark Simulacrum
4959cb1fca
Rollup merge of #51262 - GuillaumeGomez:add-missing-whitespace, r=QuietMisdreavus
Add missing whitespace in num example

r? @QuietMisdreavus
2018-06-01 17:25:16 -06:00
Mark Simulacrum
b6013b2ef5
Rollup merge of #51152 - crlf0710:patch-1, r=kennytm
Replace `if` with `if and only if` in the definition dox of `Sync`

The old text was: "The precise definition is: a type `T` is `Sync` if `&T` is Send."

Since we've also got
```
impl<'a, T> Send for &'a T
where
    T: Sync + ?Sized,
```
I purpose we can change the `if` to `if and only if` to make it more precise.
2018-06-01 17:25:14 -06:00
Mark Simulacrum
361a82ca7b
Rollup merge of #51135 - estebank:sugg-7575, r=oli-obk
Tweak output on E0599 for assoc fn used as method

 - Use suggestion instead of `help` when possible
 - Add primary span label
 - Remove incorrect `help` suggestion using incorrect syntax
 - Do not refer to only one possible candidate as `candidate #1`, refer to it as `the candidate`
2018-06-01 17:25:13 -06:00
Mark Simulacrum
21423ec313 Pull in release notes from stable 2018-06-01 17:23:52 -06:00
bors
bfa41f2801 Auto merge of #50108 - Zoxc:sync-gcx, r=mw
Make GlobalCtxt thread-safe

r? @michaelwoerister
2018-06-01 22:49:43 +00:00
Clar Charr
b1797d57ff Add @ithinuel's tests from #50597 2018-06-01 17:46:19 -04:00
Clar Charr
7fe56e81b7 Fix ambiguity in Result test 2018-06-01 17:46:19 -04:00
Clar Charr
8c3bdcc35a Add From<bool> for int types 2018-06-01 17:46:19 -04:00
bors
aa094a43cc Auto merge of #51163 - Amanieu:hashmap_layout, r=SimonSapin
Simplify HashMap layout calculation by using Layout

`RawTable` uses a single allocation to hold both the array of hashes and the array of key/value pairs. This PR changes `RawTable` to use `Layout` when calculating the amount of memory to allocate instead of performing the calculation manually.

r? @SimonSapin
2018-06-01 18:25:19 +00:00
Amanieu d'Antras
c6bebf4554 Simplify HashMap layout calculation by using Layout 2018-06-01 17:24:03 +01:00
bors
747e655010 Auto merge of #50340 - Emerentius:master, r=alexcrichton
optimize joining for slices

This improves the speed of string joining up to 3x.
It removes the boolean flag check every iteration, eliminates repeated bounds checks and adds a fast paths for small separators up to a len of 4 bytes
These optimizations gave me ~10%, ~50% and ~80% improvements respectively over the previous speed. Those are multiplicative.

3x improvement happens for the optimal case of joining many small strings together in my microbenchmarks. Improvements flatten out for larger strings of course as more time is spent copying bits around. I've run a few benchmarks [with this code](https://github.com/Emerentius/join_bench). They are pretty noise despite high iteration counts, but in total one can see the trends.

```
len_separator  len_string   n_strings     speedup
           4          10          10        2.38
           4          10         100        3.41
           4          10        1000        3.43
           4          10       10000        3.25
           4         100          10        2.23
           4         100         100        2.73
           4         100        1000        1.33
           4         100       10000        1.14
           4        1000          10        1.33
           4        1000         100        1.15
           4        1000        1000        1.08
           4        1000       10000        1.04
          10          10          10        1.61
          10          10         100        1.74
          10          10        1000        1.77
          10          10       10000        1.75
          10         100          10        1.58
          10         100         100        1.65
          10         100        1000        1.24
          10         100       10000        1.12
          10        1000          10        1.23
          10        1000         100        1.11
          10        1000        1000        1.05
          10        1000       10000       0.997
         100          10          10        1.66
         100          10         100        1.78
         100          10        1000        1.28
         100          10       10000        1.16
         100         100          10        1.37
         100         100         100        1.26
         100         100        1000        1.09
         100         100       10000         1.0
         100        1000          10        1.19
         100        1000         100        1.12
         100        1000        1000        1.05
         100        1000       10000        1.12
```

The string joining with small or empty separators is now ~50% faster than the old concatenation (small strings). The same approach can also improve the performance of joining into vectors.

If this approach is acceptable, I can apply it for concatenation and for vectors as well. Alternatively, concat could just call `.join("")`.
2018-06-01 16:16:30 +00:00
Emerentius
12bd288746 incorporate changes from code review
further reduce unsafe fn calls
reduce right drift
assert! sufficient capacity
2018-06-01 17:13:26 +02:00
Emerentius
d0d0885c3f compacts join code 2018-06-01 17:13:25 +02:00
Emerentius
b2fd7da0cf add more join tests
old tests cover the new fast path of str joining already
this adds tests for joining into Strings with long separators (>4 byte) and
for joining into Vec<T>, T: Clone + !Copy. Vec<T: Copy> will be
specialised when specialisation type inference bugs are fixed.
2018-06-01 17:13:25 +02:00
Emerentius
d866082050 optimize joining and concatenation for slices
for both Vec<T> and String
- eliminates the boolean first flag in fn join()

for String only
- eliminates repeated bounds checks in join(), concat()
- adds fast paths for small string separators up to a len of 4 bytes
2018-06-01 17:13:24 +02:00
Niko Matsakis
b37cc851e6 rework to report errors from crates in a consistent order
We first collect unused crates into a map and then walk all extern
crates in crate order.
2018-06-01 11:00:18 -04:00
Niko Matsakis
8b39808ffe merge UNNECESSARY_EXTERN_CRATE and UNUSED_EXTERN_CRATES 2018-06-01 11:00:18 -04:00
Niko Matsakis
d5010ecf44 extend unused_extern_crates lint with a suggestion to remove 2018-06-01 11:00:18 -04:00
Niko Matsakis
a667049c33 also check let arms and nested patterns for mutable borrows 2018-06-01 10:06:02 -04:00
bors
f913231290 Auto merge of #51264 - glandium:oom, r=alexcrichton
Make the OOM hook return `()` rather than `!`

Per discussion in https://github.com/rust-lang/rust/issues/51245#issuecomment-393651083

This allows more flexibility in what can be done with the API. This also
splits `rtabort!` into `dumb_print` happening in the default hook and
`abort_internal`, happening in the actual oom handler after calling the
hook. Registering an empty function thus makes the oom handler not print
anything but still abort.

Cc: @alexcrichton
2018-06-01 14:05:57 +00:00
John Kåre Alsaker
2119d04b2d Add Sync impl for Slice 2018-06-01 15:22:37 +02:00
John Kåre Alsaker
461fa8495e Update Cargo.lock 2018-06-01 15:00:17 +02:00
John Kåre Alsaker
c6dbb14097 Assert that GlobalCtxt is Sync 2018-06-01 14:57:08 +02:00
John Kåre Alsaker
d402d2d0d4 Have worker-local GlobalArenas 2018-06-01 14:57:08 +02:00
John Kåre Alsaker
969296b79b Add a WorkerLocal abstraction 2018-06-01 14:57:07 +02:00
John Kåre Alsaker
b7aabaa3fc Update recursion limits 2018-06-01 14:56:01 +02:00
John Kåre Alsaker
85acb1d046 Ensure ImplicitCtxt is Sync 2018-06-01 14:55:58 +02:00
John Kåre Alsaker
9eb4f7329b Fix optimization_fuel 2018-06-01 14:55:55 +02:00
John Kåre Alsaker
d6c63ec949 Fix OneThread 2018-06-01 14:55:54 +02:00
steveklabnik
48bd07e3a9 Remove feature flag from fs::read_to_string example
This is stable, and so no longer needed
2018-06-01 08:24:36 -04:00
bors
577a5b2703 Auto merge of #51181 - mbrubeck:prelude, r=petrochenkov
Add std/core to prelude if extern_prelude enabled

Fixes #50605
2018-06-01 10:48:14 +00:00