]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoFix ICE with `main`'s return type containing lifetimes
Shotaro Yamada [Thu, 5 Apr 2018 13:50:48 +0000 (22:50 +0900)]
Fix ICE with `main`'s return type containing lifetimes

6 years agoAuto merge of #48647 - alexcrichton:update-sccache, r=kennytm
bors [Tue, 3 Apr 2018 22:21:37 +0000 (22:21 +0000)]
Auto merge of #48647 - alexcrichton:update-sccache, r=kennytm

Update sccache to its master branch

Ideally I'd like to soon enable sccache for rustbuild itself and some of the
stage0 tools, but for that to work we'll need some better Rust support than the
pretty old version we were previously using!

6 years agoAuto merge of #49447 - pnkfelix:remove-cfg-const-pat-hack-47295, r=nikomatsakis
bors [Tue, 3 Apr 2018 11:50:11 +0000 (11:50 +0000)]
Auto merge of #49447 - pnkfelix:remove-cfg-const-pat-hack-47295, r=nikomatsakis

Remove adjacent all-const match arm hack.

An old fix for moves-in-guards had a hack for adjacent all-const match arms.

The hack was explained in a comment, which you can see here:
https://github.com/rust-lang/rust/pull/22580/files#diff-402a0fa4b3c6755c5650027c6d4cf1efR497

But hack was incomplete (and thus unsound), as pointed out here:
https://github.com/rust-lang/rust/issues/47295#issuecomment-357108458

Plus, it is likely to be at least tricky to reimplement this hack in
the new NLL borrowck.

So rather than try to preserve the hack, we want to try to just remove
it outright. (At least to see the results of a crater run.)

[breaking-change]

This is a breaking-change, but our hope is that no one is actually
relying on such an extreme special case. (We hypothesize the hack was
originally added to accommodate a file in our own test suite, not code
in the wild.)

6 years agoAuto merge of #49348 - bobtwinkles:extend_2pb, r=nikomatsakis
bors [Tue, 3 Apr 2018 09:11:35 +0000 (09:11 +0000)]
Auto merge of #49348 - bobtwinkles:extend_2pb, r=nikomatsakis

Extend two-phase borrows to apply to method receiver autorefs

Fixes #48598 by permitting two-phase borrows on the autorefs created when functions and methods.

6 years agoAuto merge of #49098 - matklad:find_map, r=KodrAus
bors [Tue, 3 Apr 2018 06:28:41 +0000 (06:28 +0000)]
Auto merge of #49098 - matklad:find_map, r=KodrAus

Add Iterator::find_map

I'd like to propose to add `find_map` method to the `Iterator`: an occasionally useful utility, which relates to `filter_map` in the same way that `find` relates to `filter`.

`find_map` takes an `Option`-returning function, applies it to the elements of the iterator, and returns the first non-`None` result. In other words, `find_map(f) == filter_map(f).next()`.

Why do we want to add a function to the `Iterator`, which can be trivially expressed as a combination of existing ones? Observe that `find(f) == filter(f).next()`, so, by the same logic, `find` itself is unnecessary!

The more positive argument is that desugaring of  `find[_map]` in terms of `filter[_map]().next()` is not super obvious, because the `filter` operation reads as if it is applies to the whole collection, although in reality we are interested only in the first element. That is, the jump from "I need a **single** result" to "let's use a function which maps **many** values to **many** values" is a non-trivial speed-bump, and causes friction when reading and writing code.

Does the need for `find_map` arise in practice? Yes!

* Anecdotally, I've more than once searched the docs for the function with `[T] -> (T -> Option<U>) -> Option<U>` signature.
* The direct cause for this PR was [this](https://github.com/rust-lang/cargo/pull/5187/files/1291c50e86ed4b31db0c76de03a47a5d0074bbd7#r174934173) discussion in Cargo, which boils down to "there's some pattern that we try to express here, but current approaches looks non-pretty" (and the pattern is `filter_map`
* There are several `filter_map().next` combos in Cargo: [[1]](https://github.com/rust-lang/cargo/blob/545a4a2c930916cc9c3dc1716fb7a33299e4062b/src/cargo/ops/cargo_new.rs#L585), [[2]](https://github.com/rust-lang/cargo/blob/545a4a2c930916cc9c3dc1716fb7a33299e4062b/src/cargo/core/resolver/mod.rs#L1130), [[3]](https://github.com/rust-lang/cargo/blob/545a4a2c930916cc9c3dc1716fb7a33299e4062b/src/cargo/ops/cargo_rustc/mod.rs#L1086).
* I've also needed similar functionality in `Kotlin` several times. There, it is expressed as `mapNotNull {}.firstOrNull`, as can be seen [here](https://github.com/intellij-rust/intellij-rust/blob/ee8bdb4e073fd07142fc6e1853ca288c57495e69/src/main/kotlin/org/rust/cargo/project/model/impl/CargoProjectImpl.kt#L154), [here](https://github.com/intellij-rust/intellij-rust/blob/ee8bdb4e073fd07142fc6e1853ca288c57495e69/src/main/kotlin/org/rust/lang/core/resolve/ImplLookup.kt#L444) [here](https://github.com/intellij-rust/intellij-rust/blob/ee8bdb4e073fd07142fc6e1853ca288c57495e69/src/main/kotlin/org/rust/ide/inspections/RsLint.kt#L38) and [here](https://github.com/intellij-rust/intellij-rust/blob/ee8bdb4e073fd07142fc6e1853ca288c57495e69/src/main/kotlin/org/rust/cargo/toolchain/RustToolchain.kt#L74) (and maybe in some other cases as well)

Note that it is definitely not among the most popular functions (it definitely is less popular than `find`), but, for example it (in case of Cargo) seems to be more popular than `rposition` (1 occurrence), `step_by` (zero occurrences) and `nth` (three occurrences as `nth(0)` which probably should be replaced with `next`).

Do we necessary need this function in `std`? Could we move it to itertools? That is possible, but observe that `filter`, `filter_map`, `find` and `find_map` together really form a complete table:

|||
|-------|---------|
| filter| find|
|filter_map|find_map|

It would be somewhat unsatisfying to have one quarter of this table live elsewhere :) Also, if `Itertools` adds an `find_map` method, it would be more difficult to move it to std due to name collision.

Hm, at this point I've searched for `filter_map` the umpteenth time, and, strangely, this time I do find this RFC: https://github.com/rust-lang/rfcs/issues/1801. I guess this could be an implementation though? :)

To sum up:

Pro:
  - complete the symmetry with existing method
  - codify a somewhat common non-obvious pattern

Contra:
  - niche use case
  - we can, and do, live without it

6 years agoAuto merge of #49590 - alexcrichton:update-deps, r=Mark-Simulacrum
bors [Mon, 2 Apr 2018 22:37:15 +0000 (22:37 +0000)]
Auto merge of #49590 - alexcrichton:update-deps, r=Mark-Simulacrum

Bump to 1.27.0

Also update some `Cargo.lock` dependencies, finishing up some final steps of our
[release process]!

This doesn't update the bootstrap compiler just yet but that will come in a
follow-up PR.

[release process]: https://forge.rust-lang.org/release-process.html

6 years agoAdd Iterator::find_map
Aleksey Kladov [Fri, 16 Mar 2018 16:38:25 +0000 (19:38 +0300)]
Add Iterator::find_map

6 years agoBump to 1.27.0
Alex Crichton [Mon, 2 Apr 2018 15:43:55 +0000 (08:43 -0700)]
Bump to 1.27.0

Also update some `Cargo.lock` dependencies, finishing up some final steps of our
[release process]!

This doesn't update the bootstrap compiler just yet but that will come in a
follow-up PR.

[release process]: https://forge.rust-lang.org/release-process.html

6 years agoUpdate sccache to its master branch
Alex Crichton [Thu, 1 Mar 2018 22:50:50 +0000 (14:50 -0800)]
Update sccache to its master branch

Ideally I'd like to soon enable sccache for rustbuild itself and some of the
stage0 tools, but for that to work we'll need some better Rust support than the
pretty old version we were previously using!

6 years agoAuto merge of #49252 - Manishearth:easy-feature-flag, r=nikomatsakis
bors [Mon, 2 Apr 2018 18:14:09 +0000 (18:14 +0000)]
Auto merge of #49252 - Manishearth:easy-feature-flag, r=nikomatsakis

Easy edition feature flag

We no longer gate features on epochs; instead we have a `#![feature(rust_2018_preview)]` that flips on a bunch of features (currently dyn_trait).

Based on #49001 to avoid merge conflicts

r? @nikomatsakis

6 years agoAuto merge of #49124 - abonander:attr-macro-stmt-expr, r=abonander
bors [Mon, 2 Apr 2018 10:38:28 +0000 (10:38 +0000)]
Auto merge of #49124 - abonander:attr-macro-stmt-expr, r=abonander

Expand Attributes on Statements and Expressions

This enables attribute-macro expansion on statements and expressions while retaining the `stmt_expr_attributes` feature requirement for attributes on expressions.

closes #41475
cc #38356  @petrochenkov @jseyfried
r? @nrc

6 years agoExpand attribute macros on statements and expressions.
Austin Bonander [Fri, 16 Mar 2018 06:20:56 +0000 (23:20 -0700)]
Expand attribute macros on statements and expressions.

Retains the `stmt_expr_attributes` feature requirement for attributes on expressions.

closes #41475
cc #38356

6 years agoAuto merge of #49580 - glandium:core-heap, r=SimonSapin
bors [Mon, 2 Apr 2018 08:07:10 +0000 (08:07 +0000)]
Auto merge of #49580 - glandium:core-heap, r=SimonSapin

Use Alloc and Layout from core::heap.

94d1970bba87f2d2893f6e934e4c3f02ed50604d moved the alloc::allocator
module to core::heap, moving e.g. Alloc and Layout out of the alloc
crate. While alloc::heap reexports them, it's better to use them from
where they really come from.

6 years agoUse Alloc and Layout from core::heap.
Mike Hommey [Mon, 2 Apr 2018 07:05:30 +0000 (16:05 +0900)]
Use Alloc and Layout from core::heap.

94d1970bba87f2d2893f6e934e4c3f02ed50604d moved the alloc::allocator
module to core::heap, moving e.g. Alloc and Layout out of the alloc
crate. While alloc::heap reexports them, it's better to use them from
where they really come from.

6 years agoAuto merge of #49574 - tmccombs:stabilize-getpid, r=sfackler
bors [Mon, 2 Apr 2018 05:48:33 +0000 (05:48 +0000)]
Auto merge of #49574 - tmccombs:stabilize-getpid, r=sfackler

Stabilize `std::process::id()`

Fixes #44971

6 years agoStabilize `std::process::id()`
Thayne McCombs [Mon, 2 Apr 2018 03:40:56 +0000 (21:40 -0600)]
Stabilize `std::process::id()`

Fixes #44971

6 years agoAuto merge of #49571 - anderspitman:patch-1, r=frewsxcv
bors [Mon, 2 Apr 2018 03:24:51 +0000 (03:24 +0000)]
Auto merge of #49571 - anderspitman:patch-1, r=frewsxcv

Update drop.rs

6 years agoUpdate drop.rs
Anders Pitman [Sun, 1 Apr 2018 23:19:42 +0000 (16:19 -0700)]
Update drop.rs

6 years agoAuto merge of #49561 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
bors [Sun, 1 Apr 2018 16:34:27 +0000 (16:34 +0000)]
Auto merge of #49561 - Mark-Simulacrum:rollup, r=Mark-Simulacrum

Rollup of 3 pull requests

- Successful merges: #49451, #49498, #49549
- Failed merges:

6 years agoRollup merge of #49549 - Mark-Simulacrum:bootstrap-cleanup, r=alexcrichton
Mark Simulacrum [Sun, 1 Apr 2018 16:04:57 +0000 (18:04 +0200)]
Rollup merge of #49549 - Mark-Simulacrum:bootstrap-cleanup, r=alexcrichton

Remove filetime dep from build_helper

r? @alexcrichton

6 years agoRollup merge of #49498 - Manishearth:clippyup, r=oli-obk
Mark Simulacrum [Sun, 1 Apr 2018 16:04:56 +0000 (18:04 +0200)]
Rollup merge of #49498 - Manishearth:clippyup, r=oli-obk

Update clippy

r? @oli-obk

6 years agoRollup merge of #49451 - QuietMisdreavus:epoch-doctests, r=GuillaumeGomez
Mark Simulacrum [Sun, 1 Apr 2018 16:04:54 +0000 (18:04 +0200)]
Rollup merge of #49451 - QuietMisdreavus:epoch-doctests, r=GuillaumeGomez

rustdoc: add an --edition flag to compile docs/doctests with a certain edition

To correspond with the 2018 edition, this adds a (currently unstable) `--edition` flag to rustdoc that makes it compile crates and doctests with the given edition. Once this lands, Cargo should be updated to pass this flag when the edition configuration option is given.

6 years agoAuto merge of #49478 - Phlosioneer:fix-windows-file-not-found, r=petrochenkov
bors [Sun, 1 Apr 2018 12:54:02 +0000 (12:54 +0000)]
Auto merge of #49478 - Phlosioneer:fix-windows-file-not-found, r=petrochenkov

Fix escaped backslash in windows file not found message

When a module is declared, but no matching file exists, rustc gives
an error like `help: name the file either foo.rs or foo/mod.rs inside
the directory "src/bar"`. However, at on windows, the backslash was
double-escaped when naming the directory.

It did this because the string was printed in debug mode (`"{:?}"`) to
surround it with quotes. However, it should just be printed like any
other directory in an error message and surrounded by escaped quotes,
rather than relying on the debug print to add quotes (`"\"{}\""`).

I also checked the test suite to see if this output is being correctly tested. It's not - it only tests up to the word "directory". Presumably this is so that the test is not dependent on its exact position in the source tree. I don't know a better way to test this, unless the test suite supports regex?

6 years agoRemove filetime dep from build_helper
Mark Simulacrum [Sun, 1 Apr 2018 02:32:40 +0000 (20:32 -0600)]
Remove filetime dep from build_helper

6 years agoAuto merge of #49418 - frewsxcv:frewsxcv-network-order, r=TimNN
bors [Sun, 1 Apr 2018 10:09:58 +0000 (10:09 +0000)]
Auto merge of #49418 - frewsxcv:frewsxcv-network-order, r=TimNN

Clarify network byte order conversions for integer / IP address conversions.

Opened primarily to address https://github.com/rust-lang/rust/issues/48819.

Also added a few other conversion docs/examples.

6 years agoAuto merge of #49545 - alexcrichton:proc-macro-fixes, r=eddyb
bors [Sun, 1 Apr 2018 07:22:28 +0000 (07:22 +0000)]
Auto merge of #49545 - alexcrichton:proc-macro-fixes, r=eddyb

proc_macro: Tweak doc comments and negative literals

This commit tweaks the tokenization of a doc comment to use `#[doc = "..."]`
like `macro_rules!` does (instead of treating it as a `Literal` token).
Additionally it fixes treatment of negative literals in the compiler, for
exapmle `Literal::i32(-1)`. The current fix is a bit of a hack around the
current compiler implementation, providing a fix at the proc-macro layer rather
than the libsyntax layer.

Closes #48889

6 years agoAuto merge of #49530 - petrhosek:empty-extra-flags, r=cramertj
bors [Sun, 1 Apr 2018 05:09:48 +0000 (05:09 +0000)]
Auto merge of #49530 - petrhosek:empty-extra-flags, r=cramertj

Only include space in RUSTFLAGS extra flags if not empty

When the RUSTFLAGS_STAGE_{1,2} is not set, including a space means
the string will always be non-empty and RUSTFLAGS will be always be
reset which breaks other ways of setting these such as through config
in CARGO_HOME.

6 years agoAuto merge of #49522 - mbrubeck:fs_read, r=SimonSapin
bors [Sun, 1 Apr 2018 02:44:45 +0000 (02:44 +0000)]
Auto merge of #49522 - mbrubeck:fs_read, r=SimonSapin

Rename fs::read_string to read_to_string and stabilize

As approved in https://github.com/rust-lang/rust/issues/46588#issuecomment-377530365

Closes #46588.

6 years agoAuto merge of #49527 - petrhosek:fast-submodules, r=alexcrichton
bors [Sun, 1 Apr 2018 00:22:45 +0000 (00:22 +0000)]
Auto merge of #49527 - petrhosek:fast-submodules, r=alexcrichton

Handle fast-submodules option correctly

This option was introduced in 72cb109bec8, but it uses two different
spellings (`fast-submodule` in `bootstrap.py` vs `fast-submodules` in
`config.toml.example`) and isn't handled by Rust bootstrap which means
that any attempt to set this flag fails.

6 years agoproc_macro: Tweak doc comments and negative literals
Alex Crichton [Fri, 30 Mar 2018 09:55:54 +0000 (02:55 -0700)]
proc_macro: Tweak doc comments and negative literals

This commit tweaks the tokenization of a doc comment to use `#[doc = "..."]`
like `macro_rules!` does (instead of treating it as a `Literal` token).
Additionally it fixes treatment of negative literals in the compiler, for
exapmle `Literal::i32(-1)`. The current fix is a bit of a hack around the
current compiler implementation, providing a fix at the proc-macro layer rather
than the libsyntax layer.

6 years agoAuto merge of #49521 - mbrubeck:fs_read_write_bytes, r=TimNN
bors [Sat, 31 Mar 2018 17:58:50 +0000 (17:58 +0000)]
Auto merge of #49521 - mbrubeck:fs_read_write_bytes, r=TimNN

fs_read_write_bytes stabilized in 1.26.0

Fix the stabilization attributes from #49422 because it merged before 1.26 branched to beta.

r? @TimNN

6 years agoAuto merge of #49501 - sfackler:unix-epoch-assoc-const, r=alexcrichton
bors [Sat, 31 Mar 2018 15:33:28 +0000 (15:33 +0000)]
Auto merge of #49501 - sfackler:unix-epoch-assoc-const, r=alexcrichton

Make UNIX_EPOCH an associated constant of SystemTime

It's not very discoverable as a separate const in the module.

r? @alexcrichton

6 years agoAuto merge of #49500 - oli-obk:mir_dep_graph, r=michaelwoerister
bors [Sat, 31 Mar 2018 12:50:13 +0000 (12:50 +0000)]
Auto merge of #49500 - oli-obk:mir_dep_graph, r=michaelwoerister

Introduce an edge from a const eval to the MIR of all statics it depends on

r? @michaelwoerister

6 years agoAuto merge of #49481 - SimonSapin:core-heap, r=alexcrichton
bors [Sat, 31 Mar 2018 09:11:21 +0000 (09:11 +0000)]
Auto merge of #49481 - SimonSapin:core-heap, r=alexcrichton

Move the alloc::allocator module to core::heap

This is the `Alloc` trait and its dependencies.

6 years agoAuto merge of #49201 - Phlosioneer:add-trivial-size-hints, r=SimonSapin
bors [Sat, 31 Mar 2018 06:40:56 +0000 (06:40 +0000)]
Auto merge of #49201 - Phlosioneer:add-trivial-size-hints, r=SimonSapin

Implement some trivial size_hints for various iterators

This also implements ExactSizeIterator where applicable.

Addresses most of the Iterator traits mentioned in #23708.

I intend to do more, but I don't want to make the PR too large.

6 years agoCommit code for option size hint
Phlosioneer [Sat, 31 Mar 2018 05:13:02 +0000 (01:13 -0400)]
Commit code for option size hint

6 years agoAuto merge of #49472 - nikomatsakis:nll-optimize-constraint-prop-1, r=pnkfelix
bors [Sat, 31 Mar 2018 04:09:43 +0000 (04:09 +0000)]
Auto merge of #49472 - nikomatsakis:nll-optimize-constraint-prop-1, r=pnkfelix

optimize NLL constraint propagation a little

Removes a bone-headed hot spot in NLL constant propagation; we were re-allocating the stack vector and hashmap as we repeated the DFS. This change shares those resources across each call.

It also modifies the constraint list to be a linked list; arguably I should revert that, though, as this didn't turn out to be a perf hit and perhaps the old code was clearer? (Still, the new style appeals to me.)

r? @pnkfelix

6 years agoOnly include space in RUSTFLAGS extra flags if not empty
Petr Hosek [Sat, 31 Mar 2018 02:37:08 +0000 (19:37 -0700)]
Only include space in RUSTFLAGS extra flags if not empty

When the RUSTFLAGS_STAGE_{1,2} is not set, including a space means
the string will always be non-empty and RUSTFLAGS will be always be
reset which breaks other ways of setting these such as through config
in CARGO_HOME.

6 years agoAuto merge of #49459 - GuillaumeGomez:primitive-intra-links, r=QuietMisdreavus
bors [Sat, 31 Mar 2018 01:34:15 +0000 (01:34 +0000)]
Auto merge of #49459 - GuillaumeGomez:primitive-intra-links, r=QuietMisdreavus

Add primitive intra-links

Part of #43466.

r? @QuietMisdreavus

6 years agoHandle fast-submodules option correctly
Petr Hosek [Fri, 30 Mar 2018 23:42:57 +0000 (16:42 -0700)]
Handle fast-submodules option correctly

This option was introduced in 72cb109bec8, but it uses two different
spellings (fast-submodule vs fast-submodules) and isn't handled by
Rust bootstrap which means that any attempt to set this flag fails.

6 years agoAuto merge of #49324 - SimonSapin:unsigned, r=alexcrichton
bors [Fri, 30 Mar 2018 19:11:15 +0000 (19:11 +0000)]
Auto merge of #49324 - SimonSapin:unsigned, r=alexcrichton

Deprecate signed std::num::NonZeroI* with a call for use cases

CC https://github.com/rust-lang/rust/issues/49137#issuecomment-375823481

6 years agoRename fs::read_string to read_to_string and stabilize
Matt Brubeck [Fri, 30 Mar 2018 16:48:18 +0000 (09:48 -0700)]
Rename fs::read_string to read_to_string and stabilize

6 years agofs_read_write_bytes stabilized in 1.26.0
Matt Brubeck [Fri, 30 Mar 2018 16:55:52 +0000 (09:55 -0700)]
fs_read_write_bytes stabilized in 1.26.0

6 years agoAuto merge of #49518 - SimonSapin:prelude, r=alexcrichton
bors [Fri, 30 Mar 2018 16:44:15 +0000 (16:44 +0000)]
Auto merge of #49518 - SimonSapin:prelude, r=alexcrichton

Revert "Add TryFrom and TryInto to the prelude"

This reverts commit 09008cc23ff6395c2c928f3690e07d7389d08ebc.

This addition landed in https://github.com/rust-lang/rust/pull/49305 and turned out to break crates that had their own copy of `TryFrom` in order to use it on the Stable channel :(

We’ll explore the possibility of the 2018 edition having a different prelude that includes this traits. However per the editions RFC this requires implementing a warning in the 2015 edition for code that *would* break.

6 years agoDeprecate signed std::num::NonZeroI* with a call for use cases
Simon Sapin [Sat, 24 Mar 2018 10:15:10 +0000 (11:15 +0100)]
Deprecate signed std::num::NonZeroI* with a call for use cases

6 years agoAuto merge of #49425 - alexcrichton:disallow-inline-always, r=petrochenkov
bors [Fri, 30 Mar 2018 14:11:35 +0000 (14:11 +0000)]
Auto merge of #49425 - alexcrichton:disallow-inline-always, r=petrochenkov

rustc: Forbid #[inline(always)] with #[target_feature]

Once a target feature is enabled for a function that means that it in general
can't be inlined into other functions which don't have that target feature
enabled. This can cause both safety and LLVM issues if we were to actually
inline it, so `#[inline(always)]` both can't be respected and would be an error
if we did so!

Today LLVM doesn't inline functions with different `#[target_feature]`
annotations, but it turns out that if one is tagged with `#[inline(always)]`
it'll override this and cause scary LLVM error to arise!

This commit fixes this issue by forbidding these two attributes to be used in
conjunction with one another.

Closes rust-lang-nursery/stdsimd#404

6 years agoRevert "Add TryFrom and TryInto to the prelude"
Simon Sapin [Fri, 30 Mar 2018 13:54:05 +0000 (15:54 +0200)]
Revert "Add TryFrom and TryInto to the prelude"

This reverts commit 09008cc23ff6395c2c928f3690e07d7389d08ebc.

6 years agoFix doctest
Steven Fackler [Fri, 30 Mar 2018 13:35:36 +0000 (15:35 +0200)]
Fix doctest

6 years agoAdd an explanation for the `create_depgraph_edges`
Oliver Schneider [Fri, 30 Mar 2018 11:57:11 +0000 (13:57 +0200)]
Add an explanation for the `create_depgraph_edges`

6 years agoAuto merge of #49403 - oli-obk:try2, r=eddyb
bors [Fri, 30 Mar 2018 11:48:10 +0000 (11:48 +0000)]
Auto merge of #49403 - oli-obk:try2, r=eddyb

Trim discriminants to their final type size

r? @eddyb

fixes  #49181

6 years agoMake UNIX_EPOCH an associated constant of SystemTime
Steven Fackler [Fri, 30 Mar 2018 10:01:36 +0000 (12:01 +0200)]
Make UNIX_EPOCH an associated constant of SystemTime

It's not very discoverable as a separate const in the module.

6 years agoIntroduce an edge from a const eval to the MIR of all statics it depends on
Oliver Schneider [Fri, 30 Mar 2018 10:31:48 +0000 (12:31 +0200)]
Introduce an edge from a const eval to the MIR of all statics it depends on

6 years agoAuto merge of #49424 - oli-obk:stable_allocid_hash, r=michaelwoerister
bors [Fri, 30 Mar 2018 09:11:08 +0000 (09:11 +0000)]
Auto merge of #49424 - oli-obk:stable_allocid_hash, r=michaelwoerister

Fix stable hashing of AllocIds

r? @michaelwoerister

fixes #49081

6 years agoBump lockfile
Manish Goregaokar [Fri, 30 Mar 2018 09:08:58 +0000 (11:08 +0200)]
Bump lockfile

6 years agoUpdate clippy
Manish Goregaokar [Fri, 30 Mar 2018 09:08:06 +0000 (11:08 +0200)]
Update clippy

6 years agoAuto merge of #49422 - mbrubeck:fs_read, r=TimNN
bors [Fri, 30 Mar 2018 06:49:33 +0000 (06:49 +0000)]
Auto merge of #49422 - mbrubeck:fs_read, r=TimNN

Stabilize fs::read and fs::write

As discussed in https://github.com/rust-lang/rust/issues/46588#issuecomment-373956283

6 years agoAuto merge of #49489 - kennytm:rollup, r=kennytm
bors [Fri, 30 Mar 2018 04:17:05 +0000 (04:17 +0000)]
Auto merge of #49489 - kennytm:rollup, r=kennytm

Rollup of 10 pull requests

- Successful merges: #49443, #49445, #49446, #49463, #49464, #49466, #49468, #49473, #49484, #49486
- Failed merges:

6 years agoAuto merge of #49412 - GuillaumeGomez:hide-type-decl, r=QuietMisdreavus
bors [Fri, 30 Mar 2018 01:45:54 +0000 (01:45 +0000)]
Auto merge of #49412 - GuillaumeGomez:hide-type-decl, r=QuietMisdreavus

Hide type declarations by default

I'm not very happy for the moment about the rendering but the bases are here:

<img width="610" alt="screen shot 2018-03-27 at 11 56 27" src="https://user-images.githubusercontent.com/3050060/37960492-0e045954-31b6-11e8-9cea-1ef8a3f980c4.png">

r? @QuietMisdreavus

6 years agoRollup merge of #49486 - oconnor663:releases_typo, r=steveklabnik
kennytm [Thu, 29 Mar 2018 23:31:20 +0000 (01:31 +0200)]
Rollup merge of #49486 - oconnor663:releases_typo, r=steveklabnik

correct a typo in RELEASES.md

6 years agoRollup merge of #49484 - cuviper:ignore-ibm-stack-probes, r=alexcrichton
kennytm [Thu, 29 Mar 2018 23:31:19 +0000 (01:31 +0200)]
Rollup merge of #49484 - cuviper:ignore-ibm-stack-probes, r=alexcrichton

Ignore stack-probes tests on powerpc/s390x too

We only support stack probes on x86 and x86_64.
Other arches are already ignored.

6 years agoRollup merge of #49473 - joshtriplett:nonnull-size, r=steveklabnik
kennytm [Thu, 29 Mar 2018 23:31:18 +0000 (01:31 +0200)]
Rollup merge of #49473 - joshtriplett:nonnull-size, r=steveklabnik

src/libcore/ptr.rs: Fix documentation for size of `Option<NonNull<T>>`

Seems more useful to say that it has the same size as `*mut T`.

6 years agoRollup merge of #49468 - glandium:cleanup, r=pnkfelix
kennytm [Thu, 29 Mar 2018 23:31:17 +0000 (01:31 +0200)]
Rollup merge of #49468 - glandium:cleanup, r=pnkfelix

Remove unnecessary use core::hash in liballoc/boxed.rs

It' only used for hash::Hasher, but Hasher is also imported.

6 years agoRollup merge of #49466 - glandium:master, r=rkruppe
kennytm [Thu, 29 Mar 2018 23:31:16 +0000 (01:31 +0200)]
Rollup merge of #49466 - glandium:master, r=rkruppe

Use f{32,64}::to_bits for is_zero test in vec::SpecFromElem

vec::SpecFromElem provides an optimization to use calloc to fill a Vec
when the element given to fill the Vec is represented by 0.

For floats, the test for that currently used is `x == 0. &&
x.is_sign_positive()`. When compiled in a standalone function, rustc
generates the following assembly:

```
  xorps xmm1, xmm1
  ucomisd xmm0, xmm1
  setnp al
  sete cl
  and cl, al
  movq rax, xmm0
  test rax, rax
  setns al
  and al, cl
  ret
```

A simpler test telling us whether the value is represented by 0, is
`x.to_bits() == 0`, which rustc compiles to:

```
  movq rax, xmm0
  test rax, rax
  sete al
  ret
```

Not that the test is hot in any way, but it also makes it clearer what
the intent in the rust code is.

6 years agoRollup merge of #49464 - ollie27:rustbuild_junction_handle_leak, r=alexcrichton
kennytm [Thu, 29 Mar 2018 23:31:15 +0000 (01:31 +0200)]
Rollup merge of #49464 - ollie27:rustbuild_junction_handle_leak, r=alexcrichton

rustbuild: Don't leak file handles when creating junctions on Windows

This fixes building the compiler docs because stage1-rustc\x86_64-pc-windows-msvc\doc is used twice which doesn't work if we still have a handle from the first time.

6 years agoRollup merge of #49463 - tinaun:patch-2, r=alexcrichton
kennytm [Thu, 29 Mar 2018 23:31:14 +0000 (01:31 +0200)]
Rollup merge of #49463 - tinaun:patch-2, r=alexcrichton

Don't mention unstable constructors in release notes

6 years agoRollup merge of #49446 - frewsxcv:frewsxcv-mention-optiono, r=GuillaumeGomez
kennytm [Thu, 29 Mar 2018 23:31:13 +0000 (01:31 +0200)]
Rollup merge of #49446 - frewsxcv:frewsxcv-mention-optiono, r=GuillaumeGomez

Explicitly mention `Option` in `?` error message.

Save users the time/effort of having to lookup what types implement
the `Try` trait.

6 years agoRollup merge of #49445 - GuillaumeGomez:light-theme, r=QuietMisdreavus
kennytm [Thu, 29 Mar 2018 23:31:12 +0000 (01:31 +0200)]
Rollup merge of #49445 - GuillaumeGomez:light-theme, r=QuietMisdreavus

Rename main theme into light theme

r? @QuietMisdreavus

6 years agoRollup merge of #49443 - GuillaumeGomez:fix-tooltip-position, r=QuietMisdreavus
kennytm [Thu, 29 Mar 2018 23:31:10 +0000 (01:31 +0200)]
Rollup merge of #49443 - GuillaumeGomez:fix-tooltip-position, r=QuietMisdreavus

Fix tooltip position

r? @QuietMisdreavus

6 years agoAuto merge of #49316 - alexcrichton:start-group-end-group, r=michaelwoerister
bors [Thu, 29 Mar 2018 23:19:52 +0000 (23:19 +0000)]
Auto merge of #49316 - alexcrichton:start-group-end-group, r=michaelwoerister

rustc: Group linked libraries where needed

This commit fixes a longstanding issue with the compiler with circular
dependencies between libcore and libstd. The `core` crate requires at least one
symbol, the ability to unwind. The `std` crate is the crate which actually
defines this symbol, but the `std` crate also depends on the `core` crate.

This circular dependency is in general disallowed in Rust as crates cannot have
cycles amongst them. A special exception is made just for core/std, but this is
also unfortunately incompatible with how GNU linkers work. GNU linkers will
process undefined symbols in a left-to-right fashion, only actually linking an
rlib like libstd if there are any symbols used from it. This strategy is
incompatible with circular dependencies because if we otherwise don't use
symbols from libstd we don't discover that we needed it until we're later
processing libcore's symbols!

To fix this GNU linkers support the `--start-group` and `--end-group` options
which indicate "libraries between these markers may have circular dependencies
amongst them. The linker invocation has been updated to automatically pass these
arguments when we're invoking a GNU linker and automatically calculate where the
arguments need to go (around libstd and libcore)

Closes #18807
Closes #47074

6 years agorustc: Group linked libraries where needed
Alex Crichton [Fri, 23 Mar 2018 21:33:22 +0000 (14:33 -0700)]
rustc: Group linked libraries where needed

This commit fixes a longstanding issue with the compiler with circular
dependencies between libcore and libstd. The `core` crate requires at least one
symbol, the ability to unwind. The `std` crate is the crate which actually
defines this symbol, but the `std` crate also depends on the `core` crate.

This circular dependency is in general disallowed in Rust as crates cannot have
cycles amongst them. A special exception is made just for core/std, but this is
also unfortunately incompatible with how GNU linkers work. GNU linkers will
process undefined symbols in a left-to-right fashion, only actually linking an
rlib like libstd if there are any symbols used from it. This strategy is
incompatible with circular dependencies because if we otherwise don't use
symbols from libstd we don't discover that we needed it until we're later
processing libcore's symbols!

To fix this GNU linkers support the `--start-group` and `--end-group` options
which indicate "libraries between these markers may have circular dependencies
amongst them. The linker invocation has been updated to automatically pass these
arguments when we're invoking a GNU linker and automatically calculate where the
arguments need to go (around libstd and libcore)

Closes #18807
Closes #47074

6 years agocorrect a typo in RELEASES.md
Jack O'Connor [Thu, 29 Mar 2018 18:20:21 +0000 (14:20 -0400)]
correct a typo in RELEASES.md

6 years agoapply pnkfelix nits
Niko Matsakis [Thu, 29 Mar 2018 15:28:36 +0000 (11:28 -0400)]
apply pnkfelix nits

6 years agodocument reason for #[inline(never)] annotation
Niko Matsakis [Thu, 29 Mar 2018 07:45:05 +0000 (03:45 -0400)]
document reason for #[inline(never)] annotation

6 years agoamortize dfs storage creation
Niko Matsakis [Thu, 29 Mar 2018 07:37:29 +0000 (03:37 -0400)]
amortize dfs storage creation

6 years agoremove dependency map and instead use a linked list of constraints
Niko Matsakis [Thu, 29 Mar 2018 06:43:58 +0000 (02:43 -0400)]
remove dependency map and instead use a linked list of constraints

6 years agoIgnore stack-probes tests on powerpc/s390x too
Josh Stone [Thu, 29 Mar 2018 17:25:32 +0000 (10:25 -0700)]
Ignore stack-probes tests on powerpc/s390x too

We only support stack probes on x86 and x86_64.
Other arches are already ignored.

6 years agoMove the alloc::allocator module to core::heap
Simon Sapin [Wed, 28 Mar 2018 20:37:37 +0000 (22:37 +0200)]
Move the alloc::allocator module to core::heap

This is the `Alloc` trait and its dependencies.

6 years agoRename main theme into light theme
Guillaume Gomez [Wed, 28 Mar 2018 09:18:45 +0000 (11:18 +0200)]
Rename main theme into light theme

6 years agoAdd primitive intra-links
Guillaume Gomez [Wed, 28 Mar 2018 15:32:15 +0000 (17:32 +0200)]
Add primitive intra-links

6 years agoAuto merge of #49163 - SimonSapin:range-bounds, r=alexcrichton
bors [Thu, 29 Mar 2018 11:34:17 +0000 (11:34 +0000)]
Auto merge of #49163 - SimonSapin:range-bounds, r=alexcrichton

Rename RangeArgument to RangeBounds, move it and Bound to libcore

As proposed in the tracking issue: https://github.com/rust-lang/rust/issues/30877

Changes to *stable* items:

* `core::ops::Bound` / `std::ops::Bound` is new
* `std::collections::Bound` is a deprecated reexport of it (does this actually cause a warning?)

Changes to *unstable* items

* `alloc::Bound` is gone
* `alloc::range::RangeArgument` is moved to `core::ops::RangeBounds` / `std::ops::RangeBounds`
* `alloc::range` is gone
* `std::collections::range::RangeArgument` is deprecated reexport, to be removed later
* `std::collections::range` is deprecated, to be removed later
* `impl RangeBounds<T> for Range{,From,To,Inclusive,ToInclusive}<&T>` are added

The idea of replacing this trait with a type to be used with `Into<_>` is left for future consideration / work.

(Fixes https://github.com/rust-lang-nursery/rust-clippy/issues/2552.)

6 years agoFix escaped backslash in windows file not found message
Phlosioneer [Thu, 29 Mar 2018 11:03:24 +0000 (07:03 -0400)]
Fix escaped backslash in windows file not found message

When a module is declared, but no matching file exists, rustc gives
an error like 'help: name the file either foo.rs or foo/mod.rs inside
the directory "src/bar"'. However, at on windows, the backslash was
double-escaped when naming the directory.

It did this because the string was printed in debug mode ( "{:?}" ) to
surround it with quotes. However, it should just be printed like any
other directory in an error message and surrounded by escaped quotes,
rather than relying on the debug print to add quotes ( "\"{}\"" ).

6 years agoUpdate clippy
Manish Goregaokar [Thu, 29 Mar 2018 11:13:49 +0000 (13:13 +0200)]
Update clippy

6 years agoHide the Bound type in docs at its deprecated location in std::collections
Simon Sapin [Tue, 27 Mar 2018 20:05:32 +0000 (22:05 +0200)]
Hide the Bound type in docs at its deprecated location in std::collections

6 years agoHide the deprecated std::collections::range module from docs
Simon Sapin [Fri, 23 Mar 2018 18:44:51 +0000 (19:44 +0100)]
Hide the deprecated std::collections::range module from docs

6 years agoimpl RangeBounds<T> for Range{,From,To,Inclusive,ToInclusive}<&T>
Simon Sapin [Tue, 20 Mar 2018 18:46:11 +0000 (19:46 +0100)]
impl RangeBounds<T> for Range{,From,To,Inclusive,ToInclusive}<&T>

6 years agoMove RangeArguments to {core::std}::ops and rename to RangeBounds
Simon Sapin [Mon, 19 Mar 2018 08:26:29 +0000 (09:26 +0100)]
Move RangeArguments to {core::std}::ops and rename to RangeBounds

These unstable items are deprecated:

* The `std::collections::range::RangeArgument` reexport
* The `std::collections::range` module.

6 years agoMove alloc::Bound to {core,std}::ops
Simon Sapin [Mon, 19 Mar 2018 08:01:17 +0000 (09:01 +0100)]
Move alloc::Bound to {core,std}::ops

The stable reexport `std::collections::Bound` is now deprecated.

Another deprecated reexport could be added in `alloc`,
but that crate is unstable.

6 years agoAuto merge of #49471 - matklad:cargo-rustdoc, r=alexcrichton
bors [Thu, 29 Mar 2018 08:17:52 +0000 (08:17 +0000)]
Auto merge of #49471 - matklad:cargo-rustdoc, r=alexcrichton

Update Cargo

This includes https://github.com/rust-lang/cargo/pull/5255 which fixed regression in `cargo rustdoc` command.

If beta branches before this is merged, we'll need to backport as well

6 years agosrc/libcore/ptr.rs: Fix documentation for size of `Option<NonNull<T>>`
Josh Triplett [Thu, 29 Mar 2018 07:43:26 +0000 (09:43 +0200)]
src/libcore/ptr.rs: Fix documentation for size of `Option<NonNull<T>>`

Seems more useful to say that it has the same size as `*mut T`.

6 years agoadd `#[inline(never)]` annotations
Niko Matsakis [Thu, 29 Mar 2018 06:43:14 +0000 (02:43 -0400)]
add `#[inline(never)]` annotations

6 years agoUpdate Cargo
Aleksey Kladov [Thu, 29 Mar 2018 07:34:55 +0000 (10:34 +0300)]
Update Cargo

This includes rust-lang/cargo#5255 which fixed regression in
`cargo rustdoc` command.

6 years agotidy
QuietMisdreavus [Thu, 29 Mar 2018 07:12:24 +0000 (09:12 +0200)]
tidy

6 years agoFix test
Manish Goregaokar [Wed, 21 Mar 2018 22:49:42 +0000 (15:49 -0700)]
Fix test

6 years agoAdd easy edition feature flag
Manish Goregaokar [Wed, 21 Mar 2018 22:48:56 +0000 (15:48 -0700)]
Add easy edition feature flag

6 years agoAuto merge of #49313 - sgrif:sg-revert-stuff, r=nikomatsakis
bors [Thu, 29 Mar 2018 05:44:40 +0000 (05:44 +0000)]
Auto merge of #49313 - sgrif:sg-revert-stuff, r=nikomatsakis

Remove universes from `ty::ParamEnv`

This change was never meant to land. #48407 takes an alternate approach. However, that PR is now blocked on some issues with canonicalization, and rebasing these reverts gets harder each time, so let's just get this bit out of the way now.

r? @nikomatsakis

6 years agoAuto merge of #49291 - tejom:check-for-known-but-incorrect-attributes, r=petrochenkov
bors [Thu, 29 Mar 2018 03:13:11 +0000 (03:13 +0000)]
Auto merge of #49291 - tejom:check-for-known-but-incorrect-attributes, r=petrochenkov

Check for known but incorrect attributes

fixes #43988

- Change nested_visit_map so it will recursively check functions

- Add visit_stmt and visit_expr for impl Visitor for CheckAttrVisitor and check for incorrect
inline and repr attributes on staements and expressions

- Add regression test for issue #43988

6 years agoRemove unnecessary use core::hash in liballoc/boxed.rs
Mike Hommey [Thu, 29 Mar 2018 02:51:52 +0000 (11:51 +0900)]
Remove unnecessary use core::hash in liballoc/boxed.rs

It' only used for hash::Hasher, but Hasher is also imported.

6 years agoAuto merge of #49458 - cramertj:stable-underscore-lt, r=nikomatsakis
bors [Thu, 29 Mar 2018 00:41:15 +0000 (00:41 +0000)]
Auto merge of #49458 - cramertj:stable-underscore-lt, r=nikomatsakis

Stabilize underscore lifetimes

r? @nikomatsakis

6 years agoUse f{32,64}::to_bits for is_zero test in vec::SpecFromElem
Mike Hommey [Thu, 29 Mar 2018 00:34:39 +0000 (09:34 +0900)]
Use f{32,64}::to_bits for is_zero test in vec::SpecFromElem

vec::SpecFromElem provides an optimization to use calloc to fill a Vec
when the element given to fill the Vec is represented by 0.

For floats, the test for that currently used is `x == 0. &&
x.is_sign_positive()`. When compiled in a standalone function, rustc
generates the following assembly:

```
  xorps xmm1, xmm1
  ucomisd xmm0, xmm1
  setnp al
  sete cl
  and cl, al
  movq rax, xmm0
  test rax, rax
  setns al
  and al, cl
  ret
```

A simpler test telling us whether the value is represented by 0, is
`x.to_bits() == 0`, which rustc compiles to:

```
  movq rax, xmm0
  test rax, rax
  sete al
  ret
```

Not that the test is hot in any way, but it also makes it clearer what
the intent in the rust code is.

6 years agoStabilize underscore lifetimes
Taylor Cramer [Wed, 28 Mar 2018 15:25:39 +0000 (17:25 +0200)]
Stabilize underscore lifetimes