]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoRollup merge of #51317 - oli-obk:incremental_all_the_way, r=Mark-Simulacrum
Mark Simulacrum [Mon, 4 Jun 2018 00:18:04 +0000 (18:18 -0600)]
Rollup merge of #51317 - oli-obk:incremental_all_the_way, r=Mark-Simulacrum

Allow enabling incremental via config.toml

r? @QuietMisdreavus

6 years agoRollup merge of #51299 - faern:const-int-ops, r=oli-obk
Mark Simulacrum [Mon, 4 Jun 2018 00:18:03 +0000 (18:18 -0600)]
Rollup merge of #51299 - faern:const-int-ops, r=oli-obk

const fn integer operations

A follow up to #51171
Fixes #51267

Makes a lot of the integer methods (`swap_bytes`, `count_ones` etc) `const fn`s. See #51267 for a discussion about why this is wanted and the solution used.

6 years agoRollup merge of #51288 - Mark-Simulacrum:delete-is-import, r=eddyb
Mark Simulacrum [Mon, 4 Jun 2018 00:18:02 +0000 (18:18 -0600)]
Rollup merge of #51288 - Mark-Simulacrum:delete-is-import, r=eddyb

Remove rustdoc-specific is_import field from HIR

Fixes #47100.

I believe that there is no need to check for the name being the same, as this
part of rustdoc seems to be strictly interested in exploring "public modules."
Re-exports from the same module cannot visit another module; and, re-exports
cannot export items with a greater visibility than that item declares.
Therefore, I think this code is either sufficient, or in fact does more than
is necessary, depending on whether rustdoc cares about the re-export itself.

r? @eddyb

6 years agoAuto merge of #50338 - japaric:panic-impl, r=alexcrichton
bors [Sun, 3 Jun 2018 20:13:09 +0000 (20:13 +0000)]
Auto merge of #50338 - japaric:panic-impl, r=alexcrichton

implement #[panic_implementation]

This implements the `#[panic_implementation]` attribute as instructed in https://github.com/rust-lang/rust/issues/44489#issuecomment-381324623

I haven't run the full test suite yet but at least all the compile-fail tests pass.

r? @nagisa

6 years agoturn run-make test into a run-make-fulldeps test
Jorge Aparicio [Sun, 3 Jun 2018 17:57:49 +0000 (19:57 +0200)]
turn run-make test into a run-make-fulldeps test

6 years agoRemove is_import field
Mark Simulacrum [Sat, 2 Jun 2018 01:00:34 +0000 (19:00 -0600)]
Remove is_import field

6 years agoAuto merge of #50904 - collin5:b50509, r=Mark-Simulacrum
bors [Sun, 3 Jun 2018 17:16:13 +0000 (17:16 +0000)]
Auto merge of #50904 - collin5:b50509, r=Mark-Simulacrum

Clean up dependency tracking in Rustbuild [1/2]

Initial refactor of the `Mode` enum. Still a WIP
Ref  #50509

r? @Mark-Simulacrum

6 years agoimpl is_tool on Mode enum
Collins Abitekaniza [Sun, 27 May 2018 23:56:33 +0000 (02:56 +0300)]
impl is_tool on Mode enum

make is_tool inherent prop of mode

fix errors from rebase

resolve issues from review

6 years agoAuto merge of #51325 - japaric:miri-up, r=TimNN
bors [Sun, 3 Jun 2018 13:36:54 +0000 (13:36 +0000)]
Auto merge of #51325 - japaric:miri-up, r=TimNN

update the miri submodule

the submodule currently seems to be pointing to a miri branch that has been deleted.

r? @TimNN

6 years agoupdate the miri submodule to master
Jorge Aparicio [Sun, 3 Jun 2018 12:31:37 +0000 (14:31 +0200)]
update the miri submodule to master

6 years agoupdate the miri submodule
Jorge Aparicio [Sun, 3 Jun 2018 12:27:46 +0000 (14:27 +0200)]
update the miri submodule

6 years agofix tidy error
Jorge Aparicio [Tue, 29 May 2018 12:25:35 +0000 (14:25 +0200)]
fix tidy error

6 years agoadd more tests
Jorge Aparicio [Tue, 29 May 2018 10:33:11 +0000 (12:33 +0200)]
add more tests

6 years agoreject `fn panic_impl<T>(_: &PanicInfo) -> !`
Jorge Aparicio [Tue, 29 May 2018 09:23:00 +0000 (11:23 +0200)]
reject `fn panic_impl<T>(_: &PanicInfo) -> !`

6 years agoremove #[unwind(allowed)]
Jorge Aparicio [Wed, 16 May 2018 17:56:24 +0000 (19:56 +0200)]
remove #[unwind(allowed)]

not required because this is a Rust function

6 years agofix after rebase
Jorge Aparicio [Wed, 16 May 2018 17:55:57 +0000 (19:55 +0200)]
fix after rebase

6 years agoundo payload in core::panic! changes
Jorge Aparicio [Wed, 16 May 2018 12:07:58 +0000 (14:07 +0200)]
undo payload in core::panic! changes

6 years agodocument that `panic_impl` never passes the FFI boundary
Jorge Aparicio [Tue, 1 May 2018 01:04:42 +0000 (03:04 +0200)]
document that `panic_impl` never passes the FFI boundary

6 years agoremove unused `struct NoPayload`
Jorge Aparicio [Tue, 1 May 2018 01:03:20 +0000 (03:03 +0200)]
remove unused `struct NoPayload`

6 years agoformat payload if possible instead of returning "Box<Any>"
Jorge Aparicio [Tue, 1 May 2018 01:02:39 +0000 (03:02 +0200)]
format payload if possible instead of returning "Box<Any>"

6 years agos/panic_fmt/panic_impl/g in docs
Jorge Aparicio [Mon, 30 Apr 2018 08:57:11 +0000 (10:57 +0200)]
s/panic_fmt/panic_impl/g in docs

6 years agoimplement #[panic_implementation]
Jorge Aparicio [Mon, 30 Apr 2018 08:55:24 +0000 (10:55 +0200)]
implement #[panic_implementation]

6 years agoIgnore i128 test on asmjs
Linus Färnstrand [Sun, 3 Jun 2018 09:18:24 +0000 (11:18 +0200)]
Ignore i128 test on asmjs

6 years agocommand line args trump config.toml settings
Oliver Schneider [Sun, 3 Jun 2018 06:44:56 +0000 (08:44 +0200)]
command line args trump config.toml settings

6 years agoAuto merge of #51319 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
bors [Sun, 3 Jun 2018 03:13:43 +0000 (03:13 +0000)]
Auto merge of #51319 - Mark-Simulacrum:rollup, r=Mark-Simulacrum

Rollup of 6 pull requests

Successful merges:

 - #51143 (Specify that packed types must derive, not implement, Copy)
 - #51226 (Make Layout's align a NonZeroUsize)
 - #51297 (Fix run button style)
 - #51306 (impl Default for &mut str)
 - #51312 (Clarify the difference between get_mut and into_mut for OccupiedEntry)
 - #51313 (use type name in E0599 enum variant suggestion)

Failed merges:

6 years agorefactor mode to ToolRustc for Rls & Rustfmt
Collins Abitekaniza [Sun, 27 May 2018 23:02:58 +0000 (02:02 +0300)]
refactor mode to ToolRustc for Rls & Rustfmt

6 years agothread tool modes through
Collins Abitekaniza [Sun, 27 May 2018 22:09:43 +0000 (01:09 +0300)]
thread tool modes through

6 years agorefactor, make requested changes
Collins Abitekaniza [Thu, 24 May 2018 00:20:47 +0000 (03:20 +0300)]
refactor, make requested changes

6 years agorefactor Mode enum
Collins Abitekaniza [Sat, 19 May 2018 20:04:41 +0000 (23:04 +0300)]
refactor Mode enum

6 years agoRollup merge of #51313 - euclio:variant-name-suggestion-fix, r=oli-obk
Mark Simulacrum [Sun, 3 Jun 2018 01:55:10 +0000 (19:55 -0600)]
Rollup merge of #51313 - euclio:variant-name-suggestion-fix, r=oli-obk

use type name in E0599 enum variant suggestion

Also, rename the variable from "type_str" to "item_kind" to avoid
the ambiguity that caused this bug.

6 years agoRollup merge of #51312 - frewsxcv:clarify-hash-map-entry-get-mut, r=dtolnay
Mark Simulacrum [Sun, 3 Jun 2018 01:55:09 +0000 (19:55 -0600)]
Rollup merge of #51312 - frewsxcv:clarify-hash-map-entry-get-mut, r=dtolnay

Clarify the difference between get_mut and into_mut for OccupiedEntry

The examples for both hash_map::OccupiedEntry::get_mut and
hash_map::OccupiedEntry::into_mut were almost identical. This led to some
confusion over the difference, namely why you would ever use get_mut when
into_mut gives alonger lifetime. Reddit thread:
https://www.reddit.com/r/rust/comments/8a5swr/why_does_hashmaps

This commit adds two lines and a comment to the example, to show that the
entry object can be re-used after calling get_mut.

Closes https://github.com/rust-lang/rust/issues/49745

6 years agoRollup merge of #51306 - kennytm:impl-default-for-mut-str, r=SimonSapin
Mark Simulacrum [Sun, 3 Jun 2018 01:55:08 +0000 (19:55 -0600)]
Rollup merge of #51306 - kennytm:impl-default-for-mut-str, r=SimonSapin

impl Default for &mut str

Rationale: There is already `impl Default for &mut [T]`.

Note: This impl is insta-stable.

6 years agoRollup merge of #51297 - GuillaumeGomez:fix-run-but-style, r=QuietMisdreavus
Mark Simulacrum [Sun, 3 Jun 2018 01:55:07 +0000 (19:55 -0600)]
Rollup merge of #51297 - GuillaumeGomez:fix-run-but-style, r=QuietMisdreavus

Fix run button style

r? @QuietMisdreavus

6 years agoRollup merge of #51226 - gnzlbg:nonzero_align, r=SimonSapin
Mark Simulacrum [Sun, 3 Jun 2018 01:55:06 +0000 (19:55 -0600)]
Rollup merge of #51226 - gnzlbg:nonzero_align, r=SimonSapin

Make Layout's align a NonZeroUsize

This PR makes the `Layout`'s align field a `NonZeroUsize` since it cannot ever be zero, not even while building a `Layout`. It also contains some drive-by minor cleanups over the docs and the code, like updating the documented error types, or using the `size()` and `align()` methods instead of accessing the fields directly (the latter was required for the `NonZeroUsize` change anyways).

r? @SimonSapin

cc @Amanieu

6 years agoRollup merge of #51143 - Mark-Simulacrum:issue-50826, r=cramertj
Mark Simulacrum [Sun, 3 Jun 2018 01:55:04 +0000 (19:55 -0600)]
Rollup merge of #51143 - Mark-Simulacrum:issue-50826, r=cramertj

Specify that packed types must derive, not implement, Copy

6 years agoPass literal through black_box
Linus Färnstrand [Sun, 3 Jun 2018 01:13:29 +0000 (03:13 +0200)]
Pass literal through black_box

6 years agoCopy changes from HashMap over to BTreeMap.
Corey Farwell [Sat, 2 Jun 2018 20:06:17 +0000 (16:06 -0400)]
Copy changes from HashMap over to BTreeMap.

6 years agoAuto merge of #50953 - GuillaumeGomez:attributes-in-other-places, r=QuietMisdreavus
bors [Sun, 3 Jun 2018 00:31:13 +0000 (00:31 +0000)]
Auto merge of #50953 - GuillaumeGomez:attributes-in-other-places, r=QuietMisdreavus

Add attributes for trait and methods as well

Fixes #48485.

r? @QuietMisdreavus

6 years agoAllow enabling incremental via config.toml
Oliver Schneider [Sat, 2 Jun 2018 22:13:27 +0000 (00:13 +0200)]
Allow enabling incremental via config.toml

6 years agoAdd a couple lines describing differences between into_mut/get_mut.
Corey Farwell [Sat, 2 Jun 2018 20:04:53 +0000 (16:04 -0400)]
Add a couple lines describing differences between into_mut/get_mut.

6 years agoAuto merge of #51310 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
bors [Sat, 2 Jun 2018 21:32:47 +0000 (21:32 +0000)]
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:

6 years agoAdd attributes for trait and methods as well
Guillaume Gomez [Mon, 21 May 2018 22:31:45 +0000 (00:31 +0200)]
Add attributes for trait and methods as well

6 years agouse type name in E0599 enum variant suggestion
Andy Russell [Sat, 2 Jun 2018 20:23:26 +0000 (16:23 -0400)]
use type name in E0599 enum variant suggestion

Also, rename the variable from "type_str" to "item_kind" to avoid
the ambiguity that caused this bug.

6 years agoFixed typo
Phlosioneer [Fri, 6 Apr 2018 21:10:35 +0000 (17:10 -0400)]
Fixed typo

6 years agoClarify the difference between get_mut and into_mut for OccupiedEntry
Phlosioneer [Fri, 6 Apr 2018 19:32:54 +0000 (15:32 -0400)]
Clarify the difference between get_mut and into_mut for OccupiedEntry

The examples for both hash_map::OccupiedEntry::get_mut and
hash_map::OccupiedEntry::into_mut were almost identical. This led
to some confusion over the difference, namely why you would ever
use get_mut when into_mut gives alonger lifetime. Reddit thread:
https://www.reddit.com/r/rust/comments/8a5swr/why_does_hashmaps

This commit adds two lines and a comment to the example, to show
that the entry object can be re-used after calling get_mut.

6 years agoRollup merge of #51302 - Mark-Simulacrum:rustdoc-fast, r=QuietMisdreavus
Mark Simulacrum [Sat, 2 Jun 2018 19:14:28 +0000 (13:14 -0600)]
Rollup merge of #51302 - Mark-Simulacrum:rustdoc-fast, r=QuietMisdreavus

Permit building rustdoc without compiler artifacts

None

6 years agoRollup merge of #51291 - evincarofautumn:master, r=oli-obk
Mark Simulacrum [Sat, 2 Jun 2018 19:14:27 +0000 (13:14 -0600)]
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.

6 years agoRollup merge of #51147 - tmccombs:sliceindex, r=SimonSapin
Mark Simulacrum [Sat, 2 Jun 2018 19:14:25 +0000 (13:14 -0600)]
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

6 years agoRollup merge of #51124 - frewsxcv:frewsxcv-replace, r=QuietMisdreavus
Mark Simulacrum [Sat, 2 Jun 2018 19:14:24 +0000 (13:14 -0600)]
Rollup merge of #51124 - frewsxcv:frewsxcv-replace, r=QuietMisdreavus

Reword {ptr,mem}::replace docs.

Fixes https://github.com/rust-lang/rust/issues/50657.

6 years agoRollup merge of #50919 - frewsxcv:frewsxcv-epsilon, r=steveklabnik
Mark Simulacrum [Sat, 2 Jun 2018 19:14:23 +0000 (13:14 -0600)]
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

6 years agoRollup merge of #50167 - fintelia:duration-nanos, r=sfackler
Mark Simulacrum [Sat, 2 Jun 2018 19:14:22 +0000 (13:14 -0600)]
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.

6 years agoimpl Default for &mut str
kennytm [Sat, 2 Jun 2018 16:29:50 +0000 (00:29 +0800)]
impl Default for &mut str

6 years agoRustdoc itself no longer requires proc macros to build
Mark Simulacrum [Sat, 2 Jun 2018 13:50:35 +0000 (07:50 -0600)]
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.

6 years agoAuto merge of #51063 - mixi:musl-bootstrap, r=alexcrichton
bors [Sat, 2 Jun 2018 15:26:26 +0000 (15:26 +0000)]
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 (6d9154a830dd9773fe8a4e34e1fc3dfb1ca6f935) 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

6 years agoadd missing inline's and optimizations
gnzlbg [Sat, 2 Jun 2018 14:11:57 +0000 (16:11 +0200)]
add missing inline's and optimizations

6 years agoremove debug_assert in padding_needed_for
gnzlbg [Sat, 2 Jun 2018 14:03:33 +0000 (16:03 +0200)]
remove debug_assert in padding_needed_for

6 years agoSpecify that packed types must derive, not implement, Copy
Mark Simulacrum [Mon, 28 May 2018 23:54:12 +0000 (17:54 -0600)]
Specify that packed types must derive, not implement, Copy

6 years agoAuto merge of #51274 - nikomatsakis:issue-46557-promote-ref-mut, r=eddyb
bors [Sat, 2 Jun 2018 13:22:38 +0000 (13:22 +0000)]
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

6 years agoAdd test for const endianess conversion
Linus Färnstrand [Tue, 29 May 2018 09:39:26 +0000 (11:39 +0200)]
Add test for const endianess conversion

6 years agoMake integer methods non-const in stage0
Linus Färnstrand [Sat, 2 Jun 2018 09:24:32 +0000 (11:24 +0200)]
Make integer methods non-const in stage0

6 years agoFix run button style
Guillaume Gomez [Sat, 2 Jun 2018 11:47:42 +0000 (13:47 +0200)]
Fix run button style

6 years agoAuto merge of #51015 - nikomatsakis:issue-50672-remove-extern-crate-idiom, r=alexcrichton
bors [Sat, 2 Jun 2018 11:14:14 +0000 (11:14 +0000)]
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

6 years agoMake most integer operations const fns
Linus Färnstrand [Tue, 29 May 2018 09:42:13 +0000 (11:42 +0200)]
Make most integer operations const fns

6 years agoAuto merge of #50554 - clarcharr:from_bool, r=TimNN
bors [Sat, 2 Jun 2018 07:50:10 +0000 (07:50 +0000)]
Auto merge of #50554 - clarcharr:from_bool, r=TimNN

Add From<bool> for int types

Fixes #46109.

6 years agoFix typos of 'ambiguous'
Jon Purdy [Sat, 2 Jun 2018 07:20:00 +0000 (00:20 -0700)]
Fix typos of 'ambiguous'

6 years agoReword {ptr,mem}::replace docs.
Corey Farwell [Mon, 28 May 2018 12:36:14 +0000 (08:36 -0400)]
Reword {ptr,mem}::replace docs.

Fixes https://github.com/rust-lang/rust/issues/50657.

6 years agoAuto merge of #51270 - nicokoch:issue-51266, r=TimNN
bors [Sat, 2 Jun 2018 03:06:26 +0000 (03:06 +0000)]
Auto merge of #51270 - nicokoch:issue-51266, r=TimNN

fs: copy: Add EPERM to fallback error conditions

Fixes #51266

6 years agoAuto merge of #51287 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
bors [Sat, 2 Jun 2018 00:58:29 +0000 (00:58 +0000)]
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:

6 years agoRollup merge of #51286 - Mark-Simulacrum:1.26.2-release-notes, r=Mark-Simulacrum
Mark Simulacrum [Fri, 1 Jun 2018 23:25:18 +0000 (17:25 -0600)]
Rollup merge of #51286 - Mark-Simulacrum:1.26.2-release-notes, r=Mark-Simulacrum

Pull 1.26.2 release notes into master

None

6 years agoRollup merge of #51272 - steveklabnik:remove_feature_flag, r=QuietMisdreavus
Mark Simulacrum [Fri, 1 Jun 2018 23:25:17 +0000 (17:25 -0600)]
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

6 years agoRollup merge of #51262 - GuillaumeGomez:add-missing-whitespace, r=QuietMisdreavus
Mark Simulacrum [Fri, 1 Jun 2018 23:25:16 +0000 (17:25 -0600)]
Rollup merge of #51262 - GuillaumeGomez:add-missing-whitespace, r=QuietMisdreavus

Add missing whitespace in num example

r? @QuietMisdreavus

6 years agoRollup merge of #51152 - crlf0710:patch-1, r=kennytm
Mark Simulacrum [Fri, 1 Jun 2018 23:25:14 +0000 (17:25 -0600)]
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.

6 years agoRollup merge of #51135 - estebank:sugg-7575, r=oli-obk
Mark Simulacrum [Fri, 1 Jun 2018 23:25:13 +0000 (17:25 -0600)]
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`

6 years agoPull in release notes from stable
Mark Simulacrum [Fri, 1 Jun 2018 23:23:52 +0000 (17:23 -0600)]
Pull in release notes from stable

6 years agoAuto merge of #50108 - Zoxc:sync-gcx, r=mw
bors [Fri, 1 Jun 2018 22:49:43 +0000 (22:49 +0000)]
Auto merge of #50108 - Zoxc:sync-gcx, r=mw

Make GlobalCtxt thread-safe

r? @michaelwoerister

6 years agoAdd @ithinuel's tests from #50597
Clar Charr [Sun, 20 May 2018 18:56:46 +0000 (14:56 -0400)]
Add @ithinuel's tests from #50597

6 years agoFix ambiguity in Result test
Clar Charr [Sun, 20 May 2018 18:52:08 +0000 (14:52 -0400)]
Fix ambiguity in Result test

6 years agoAdd From<bool> for int types
Clar Charr [Wed, 9 May 2018 01:38:22 +0000 (21:38 -0400)]
Add From<bool> for int types

6 years agoAuto merge of #51163 - Amanieu:hashmap_layout, r=SimonSapin
bors [Fri, 1 Jun 2018 18:25:19 +0000 (18:25 +0000)]
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

6 years agoSimplify HashMap layout calculation by using Layout
Amanieu d'Antras [Tue, 29 May 2018 11:09:09 +0000 (13:09 +0200)]
Simplify HashMap layout calculation by using Layout

6 years agoAuto merge of #50340 - Emerentius:master, r=alexcrichton
bors [Fri, 1 Jun 2018 16:16:30 +0000 (16:16 +0000)]
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("")`.

6 years agoincorporate changes from code review
Emerentius [Fri, 25 May 2018 21:53:22 +0000 (23:53 +0200)]
incorporate changes from code review

further reduce unsafe fn calls
reduce right drift
assert! sufficient capacity

6 years agocompacts join code
Emerentius [Wed, 23 May 2018 05:20:37 +0000 (07:20 +0200)]
compacts join code

6 years agoadd more join tests
Emerentius [Mon, 7 May 2018 15:37:13 +0000 (17:37 +0200)]
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.

6 years agooptimize joining and concatenation for slices
Emerentius [Mon, 30 Apr 2018 11:09:10 +0000 (13:09 +0200)]
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

6 years agorework to report errors from crates in a consistent order
Niko Matsakis [Tue, 29 May 2018 15:31:34 +0000 (11:31 -0400)]
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.

6 years agomerge UNNECESSARY_EXTERN_CRATE and UNUSED_EXTERN_CRATES
Niko Matsakis [Fri, 25 May 2018 20:53:49 +0000 (16:53 -0400)]
merge UNNECESSARY_EXTERN_CRATE and UNUSED_EXTERN_CRATES

6 years agoextend `unused_extern_crates` lint with a suggestion to remove
Niko Matsakis [Wed, 23 May 2018 23:25:59 +0000 (19:25 -0400)]
extend `unused_extern_crates` lint with a suggestion to remove

6 years agoalso check `let` arms and nested patterns for mutable borrows
Niko Matsakis [Fri, 1 Jun 2018 13:41:44 +0000 (09:41 -0400)]
also check `let` arms and nested patterns for mutable borrows

6 years agoAuto merge of #51264 - glandium:oom, r=alexcrichton
bors [Fri, 1 Jun 2018 14:05:57 +0000 (14:05 +0000)]
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
6 years agoAdd Sync impl for Slice
John Kåre Alsaker [Fri, 1 Jun 2018 13:22:37 +0000 (15:22 +0200)]
Add Sync impl for Slice

6 years agoUpdate Cargo.lock
John Kåre Alsaker [Fri, 1 Jun 2018 13:00:17 +0000 (15:00 +0200)]
Update Cargo.lock

6 years agoAssert that GlobalCtxt is Sync
John Kåre Alsaker [Fri, 20 Apr 2018 10:47:19 +0000 (12:47 +0200)]
Assert that GlobalCtxt is Sync

6 years agoHave worker-local GlobalArenas
John Kåre Alsaker [Mon, 22 Jan 2018 13:31:23 +0000 (14:31 +0100)]
Have worker-local GlobalArenas

6 years agoAdd a WorkerLocal abstraction
John Kåre Alsaker [Fri, 11 May 2018 14:28:28 +0000 (16:28 +0200)]
Add a WorkerLocal abstraction

6 years agoUpdate recursion limits
John Kåre Alsaker [Sat, 3 Mar 2018 05:22:19 +0000 (06:22 +0100)]
Update recursion limits

6 years agoEnsure ImplicitCtxt is Sync
John Kåre Alsaker [Wed, 25 Apr 2018 23:03:54 +0000 (01:03 +0200)]
Ensure ImplicitCtxt is Sync

6 years agoFix optimization_fuel
John Kåre Alsaker [Tue, 17 Apr 2018 18:09:40 +0000 (20:09 +0200)]
Fix optimization_fuel

6 years agoFix OneThread
John Kåre Alsaker [Fri, 20 Apr 2018 21:50:10 +0000 (23:50 +0200)]
Fix OneThread

6 years agoRemove feature flag from fs::read_to_string example
steveklabnik [Fri, 1 Jun 2018 12:24:36 +0000 (08:24 -0400)]
Remove feature flag from fs::read_to_string example

This is stable, and so no longer needed