Commit Graph

79247 Commits

Author SHA1 Message Date
Collins Abitekaniza
42ee6d5fd5 refactor Mode enum 2018-06-03 04:59:54 +03:00
Mark Simulacrum
c09cad1f28
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.
2018-06-02 19:55:10 -06:00
Mark Simulacrum
a689b2d8ac
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
2018-06-02 19:55:09 -06:00
Mark Simulacrum
5bbe1ebe00
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.
2018-06-02 19:55:08 -06:00
Mark Simulacrum
0c695e01da
Rollup merge of #51297 - GuillaumeGomez:fix-run-but-style, r=QuietMisdreavus
Fix run button style

r? @QuietMisdreavus
2018-06-02 19:55:07 -06:00
Mark Simulacrum
4ce7ef5f59
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
2018-06-02 19:55:06 -06:00
Mark Simulacrum
a6ab2153f6
Rollup merge of #51143 - Mark-Simulacrum:issue-50826, r=cramertj
Specify that packed types must derive, not implement, Copy
2018-06-02 19:55:04 -06:00
Linus Färnstrand
7df009922b Pass literal through black_box 2018-06-03 03:13:29 +02:00
Corey Farwell
dd88f88c02 Copy changes from HashMap over to BTreeMap. 2018-06-02 20:44:15 -04:00
bors
251ec62a13 Auto merge of #50953 - GuillaumeGomez:attributes-in-other-places, r=QuietMisdreavus
Add attributes for trait and methods as well

Fixes #48485.

r? @QuietMisdreavus
2018-06-03 00:31:13 +00:00
Oliver Schneider
7a52f1c7cf Allow enabling incremental via config.toml 2018-06-03 00:13:27 +02:00
Corey Farwell
a86f556ee3 Add a couple lines describing differences between into_mut/get_mut. 2018-06-02 18:07:23 -04:00
Thayne McCombs
87941b079a Stabilize iterator_repeat_with
Fixes #48169
2018-06-02 15:52:09 -06:00
Oliver Schneider
47f37d67f1 Correctly access ScalarPair fields during const eval 2018-06-02 23:34:25 +02: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
Guillaume Gomez
26ad95c9d4 Add attributes for trait and methods as well 2018-06-02 23:26:46 +02:00
Andy Russell
9eb70c3cf5
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.
2018-06-02 16:58:49 -04:00
Nikita Popov
4f4f7dfc00 Generate br for all two target SwitchInts
Instead of only for booleans. This means that if let also becomes
a br.

Apart from making the IR slightly simpler, this is supported by
FastISel.
2018-06-02 22:21:01 +02:00
Phlosioneer
ed1a8fff62 Fixed typo 2018-06-02 15:51:44 -04:00
Phlosioneer
1bc6c4b10e 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.
2018-06-02 15:51:39 -04: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
kennytm
0ff8d40fa1
impl Default for &mut str 2018-06-03 00:29:50 +08: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
gnzlbg
2d7cd70b1a add missing inline's and optimizations 2018-06-02 16:46:25 +02:00
gnzlbg
6ff67ee0d7 remove debug_assert in padding_needed_for 2018-06-02 16:03:33 +02:00
Mark Simulacrum
5c374739b6 Specify that packed types must derive, not implement, Copy 2018-06-02 07:24:34 -06: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
Linus Färnstrand
490c57b156 Add test for const endianess conversion 2018-06-02 14:31:33 +02:00
dylan_DPC
bc7416213c fixed feature gate to right place 2018-06-02 17:58:06 +05:30
Vytautas Astrauskas
265b04df9a Change the log level of the message reporting the selected Polonius algorithm to debug. 2018-06-02 14:20:04 +02:00
Vytautas Astrauskas
1404c00eb0 Allow choosing Polonius algorithm via environment variable POLONIUS_ALGORITHM. 2018-06-02 14:17:12 +02:00
dylan_DPC
b78457f0fb Stabilize unit tests with non-() return type 2018-06-02 17:27:37 +05:30
Linus Färnstrand
8a27c19c92 Make integer methods non-const in stage0 2018-06-02 13:57:31 +02:00
Guillaume Gomez
7585632052 Fix run button style 2018-06-02 13:47:42 +02: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
Linus Färnstrand
1b9ab8939e Make most integer operations const fns 2018-06-02 12:03:10 +02: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