]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoAdd #[must_use] to a few standard library methods
Scott McMurray [Sat, 31 Mar 2018 06:06:05 +0000 (23:06 -0700)]
Add #[must_use] to a few standard library methods

Chosen to start a precedent of using it on ones that are potentially-expensive and where using it for side effects is particularly discouraged.

Discuss :)

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 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 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 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 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 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 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 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 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 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 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

6 years agoAuto merge of #49460 - kennytm:rollup, r=kennytm
bors [Wed, 28 Mar 2018 22:18:13 +0000 (22:18 +0000)]
Auto merge of #49460 - kennytm:rollup, r=kennytm

Rollup of 12 pull requests

- Successful merges: #49243, #49329, #49364, #49400, #49405, #49427, #49428, #49429, #49439, #49442, #49444, #49452
- Failed merges:

6 years agorustbuild: Don't leak file handles when creating junctions on Windows
Oliver Middleton [Wed, 28 Mar 2018 21:43:23 +0000 (22:43 +0100)]
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 agoDon't mention unstable constructors in release notes
tinaun [Wed, 28 Mar 2018 21:39:27 +0000 (17:39 -0400)]
Don't mention unstable constructors in release notes

6 years agoFix tooltip position
Guillaume Gomez [Wed, 28 Mar 2018 08:48:00 +0000 (10:48 +0200)]
Fix tooltip position

6 years agoAuto merge of #49357 - frewsxcv:frewsxcv-termination-doc-examples, r=GuillaumeGomez
bors [Wed, 28 Mar 2018 18:11:44 +0000 (18:11 +0000)]
Auto merge of #49357 - frewsxcv:frewsxcv-termination-doc-examples, r=GuillaumeGomez

Remove hidden `foo` functions from doc examples; use `Termination` trait.

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

Easier to review with the white-space ignoring `?w=1` feature: https://github.com/rust-lang/rust/pull/49357/files?w=1

6 years agoRollup merge of #49452 - frewsxcv:frewsxcv-vec-cap-len, r=dtolnay
kennytm [Wed, 28 Mar 2018 15:55:20 +0000 (17:55 +0200)]
Rollup merge of #49452 - frewsxcv:frewsxcv-vec-cap-len, r=dtolnay

Clarify "length" wording in `Vec::with_capacity`.

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

6 years agoRollup merge of #49444 - rust-lang:oli-obk-patch-1, r=Mark-Simulacrum
kennytm [Wed, 28 Mar 2018 15:55:19 +0000 (17:55 +0200)]
Rollup merge of #49444 - rust-lang:oli-obk-patch-1, r=Mark-Simulacrum

Delete leftover librustc_const_eval

Probably accidentally reintroduced in a rebase/merge

fixes #49440

r? @Mark-Simulacrum

6 years agoRollup merge of #49442 - GuillaumeGomez:text-overlap, r=QuietMisdreavus
kennytm [Wed, 28 Mar 2018 15:55:17 +0000 (17:55 +0200)]
Rollup merge of #49442 - GuillaumeGomez:text-overlap, r=QuietMisdreavus

Fix text overlap

Fixes #49006.

r? @QuietMisdreavus

6 years agoRollup merge of #49439 - GuillaumeGomez:trait-impl-collapse, r=QuietMisdreavus
kennytm [Wed, 28 Mar 2018 15:55:16 +0000 (17:55 +0200)]
Rollup merge of #49439 - GuillaumeGomez:trait-impl-collapse, r=QuietMisdreavus

Fix trait implementation not collapsing docs

r? @QuietMisdreavus

6 years agoRollup merge of #49429 - GuillaumeGomez:fix-collapse-toggle-insertion, r=QuietMisdreavus
kennytm [Wed, 28 Mar 2018 15:55:14 +0000 (17:55 +0200)]
Rollup merge of #49429 - GuillaumeGomez:fix-collapse-toggle-insertion, r=QuietMisdreavus

Fix collapse toggle insertions on impl with docs

Just went through this one randomly... When an impl has docs, the collapse toggle isn't generated. This fixes it.

r? @QuietMisdreavus

6 years agoRollup merge of #49428 - cuviper:llvm6-target_feature, r=alexcrichton
kennytm [Wed, 28 Mar 2018 15:55:13 +0000 (17:55 +0200)]
Rollup merge of #49428 - cuviper:llvm6-target_feature, r=alexcrichton

Enable target_feature on any LLVM 6+

In `LLVMRustHasFeature()`, rather than using `MCInfo->getFeatureTable()`
that is specific to Rust's LLVM fork, we can use this in LLVM 6:

    /// Check whether the subtarget features are enabled/disabled as per
    /// the provided string, ignoring all other features.
    bool checkFeatures(StringRef FS) const;

Now rustc using external LLVM can also have `target_feature`.

r? @alexcrichton

6 years agoRollup merge of #49427 - Manishearth:rustdoc-impl-trait-extern, r=GuillaumeGomez
kennytm [Wed, 28 Mar 2018 15:55:12 +0000 (17:55 +0200)]
Rollup merge of #49427 - Manishearth:rustdoc-impl-trait-extern, r=GuillaumeGomez

Correctly handle impl trait in external items in rustdoc

fixes #49373

r? @QuietMisdreavus

6 years agoRollup merge of #49405 - GuillaumeGomez:search-appearance, r=QuietMisdreavus
kennytm [Wed, 28 Mar 2018 15:55:10 +0000 (17:55 +0200)]
Rollup merge of #49405 - GuillaumeGomez:search-appearance, r=QuietMisdreavus

Fix search appearance

Fixes #49377.

r? @QuietMisdreavus

And a screenshot:

<img width="1016" alt="screen shot 2018-03-27 at 10 33 01" src="https://user-images.githubusercontent.com/3050060/37956373-7b522852-31ab-11e8-8915-7e20064b5edd.png">

6 years agoRollup merge of #49400 - Diggsey:shrink-to, r=joshtriplett
kennytm [Wed, 28 Mar 2018 15:55:09 +0000 (17:55 +0200)]
Rollup merge of #49400 - Diggsey:shrink-to, r=joshtriplett

Implement `shrink_to` method on collections

Fixes #49385

6 years agoRollup merge of #49364 - wesleywiser:incr_handle_load_failure, r=michaelwoerister
kennytm [Wed, 28 Mar 2018 15:55:08 +0000 (17:55 +0200)]
Rollup merge of #49364 - wesleywiser:incr_handle_load_failure, r=michaelwoerister

[incremental] Don't panic if decoding the cache fails

If the cached data can't be loaded from disk, just issue a warning to
the user so they know why compilation is taking longer than usual but
don't fail the entire compilation since we can recover by ignorning the
on disk cache.

In the same way, if the disk cache can't be deserialized (because it has
been corrupted for some reason), report the issue as a warning and
continue without failing the compilation. `Decodable::decode()` tends to
panic with various errors like "entered unreachable code" or "index out
of range" if the input data is corrupted. Work around this by catching
panics from the `decode()` calls and continuing without the cached data.

Fixes #48847

6 years agoRollup merge of #49329 - canarysnort01:fix-no-pie, r=pnkfelix
kennytm [Wed, 28 Mar 2018 15:55:07 +0000 (17:55 +0200)]
Rollup merge of #49329 - canarysnort01:fix-no-pie, r=pnkfelix

don't pass -no-pie to gnu ld

fixes #48884

6 years agoRollup merge of #49243 - murarth:stabilize-retain, r=BurntSushi
kennytm [Wed, 28 Mar 2018 15:55:05 +0000 (17:55 +0200)]
Rollup merge of #49243 - murarth:stabilize-retain, r=BurntSushi

Stabilize method `String::retain`

Closes #43874

6 years agoAuto merge of #49394 - cramertj:stable-match-bindings, r=nikomatsakis
bors [Wed, 28 Mar 2018 15:31:29 +0000 (15:31 +0000)]
Auto merge of #49394 - cramertj:stable-match-bindings, r=nikomatsakis

Stabilize match_default_bindings

This includes a submodule update to rustfmt
in order to allow a stable feature declaration.

r? @nikomatsakis

cc https://github.com/rust-lang/rust/issues/42640

Many of the tests this PR touches are merely testing the current lack of desired future behavior around https://github.com/rust-lang/rust/issues/44849 and https://github.com/rust-lang/rust/issues/44848 (cc @tschottdorf). I noticed the bullets for those items were checked on the tracking issue-- I've unchecked them, as they don't appear to have been completed and I don't see any comments indicating that we don't want to pursue them further. Still, I think it's fine to stabilize the current behavior, as I think expanding it in the future should be backwards-compatible.

6 years agoStabilize fs::read and fs::write
Matt Brubeck [Tue, 27 Mar 2018 17:20:27 +0000 (10:20 -0700)]
Stabilize fs::read and fs::write

6 years agoAuto merge of #49019 - phil-opp:target-spec, r=pnkfelix
bors [Wed, 28 Mar 2018 12:56:09 +0000 (12:56 +0000)]
Auto merge of #49019 - phil-opp:target-spec, r=pnkfelix

Introduce a TargetTriple enum to support absolute target paths

This PR replaces target triple strings with a `TargetTriple` enum, which represents either a target triple or a path to a JSON target file. The path variant is used if the `--target` argument has a `.json` extension, else the target triple variant is used.

The motivation of this PR is support for absolute target paths to avoid the need for setting the `RUST_TARGET_PATH` environment variable (see rust-lang/cargo#4905 for more information). For places where some kind of triple is needed (e.g. in the sysroot folder), we use the file name (without extension).

For compatibility, we keep the old behavior of searching for a file named `$(target_triple).json` in `RUST_TARGET_PATH` for non-official target triples.

6 years ago[incremental] Don't panic if decoding the cache fails
Wesley Wiser [Fri, 23 Mar 2018 02:25:57 +0000 (22:25 -0400)]
[incremental] Don't panic if decoding the cache fails

If the cached data can't be loaded from disk, just issue a warning to
the user so they know why compilation is taking longer than usual but
don't fail the entire compilation since we can recover by ignorning the
on disk cache.

In the same way, if the disk cache can't be deserialized (because it has
been corrupted for some reason), report the issue as a warning and
continue without failing the compilation. `Decodable::decode()` tends to
panic with various errors like "entered unreachable code" or "index out
of range" if the input data is corrupted. Work around this by catching
panics from the `decode()` calls when joining the thread and continuing
without the cached data.

Fixes #48847

6 years agoClarify "length" wording in `Vec::with_capacity`.
Corey Farwell [Wed, 28 Mar 2018 12:10:18 +0000 (14:10 +0200)]
Clarify "length" wording in `Vec::with_capacity`.

6 years agoFix text overlap
Guillaume Gomez [Wed, 28 Mar 2018 07:00:58 +0000 (09:00 +0200)]
Fix text overlap

6 years agoRemove hidden `foo` functions from doc examples; use `Termination` trait.
Corey Farwell [Sun, 25 Mar 2018 02:56:07 +0000 (22:56 -0400)]
Remove hidden `foo` functions from doc examples; use `Termination` trait.

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

6 years agoExplicitly mention `Option` in `?` error message.
Corey Farwell [Wed, 28 Mar 2018 09:25:52 +0000 (11:25 +0200)]
Explicitly mention `Option` in `?` error message.

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

6 years agoStabilize match_default_bindings
Taylor Cramer [Mon, 26 Mar 2018 21:39:29 +0000 (23:39 +0200)]
Stabilize match_default_bindings

This includes a submodule update to rustfmt
in order to allow a stable feature declaration.

6 years agoDelete leftover librustc_const_eval
Oliver Schneider [Wed, 28 Mar 2018 08:49:45 +0000 (10:49 +0200)]
Delete leftover librustc_const_eval

Probably accidentally reintroduced in a rebase/merge

6 years agoFix stable hashing of AllocIds
Oliver Schneider [Tue, 27 Mar 2018 08:38:51 +0000 (10:38 +0200)]
Fix stable hashing of AllocIds

6 years agoAuto merge of #49383 - nox:scalarpair, r=eddyb
bors [Wed, 28 Mar 2018 08:01:22 +0000 (08:01 +0000)]
Auto merge of #49383 - nox:scalarpair, r=eddyb

Allow niche-filling dataful variants to be represented as a ScalarPair

r? @eddyb

6 years agoFix trait implementation not collapsing docs
Guillaume Gomez [Wed, 28 Mar 2018 07:50:55 +0000 (09:50 +0200)]
Fix trait implementation not collapsing docs

6 years agoAuto merge of #49304 - sinkuu:impl_trait_rustdoc, r=QuietMisdreavus
bors [Wed, 28 Mar 2018 05:29:57 +0000 (05:29 +0000)]
Auto merge of #49304 - sinkuu:impl_trait_rustdoc, r=QuietMisdreavus

Rustdoc support for universal_impl_trait

Hides type parameters synthesized by `impl Trait`-in-argument-position, and enables links to trait names.

<img alt="before" src="https://user-images.githubusercontent.com/7091080/37831646-a61413c6-2ee9-11e8-8ec2-a6137956d922.png" width="450"/>

<img alt="after" src="https://user-images.githubusercontent.com/7091080/37831657-b2ff0ae6-2ee9-11e8-8797-fdad904782bf.png" width="450"/>

Fixes #49309

6 years agoAuto merge of #49406 - kennytm:rollup, r=kennytm
bors [Wed, 28 Mar 2018 02:41:28 +0000 (02:41 +0000)]
Auto merge of #49406 - kennytm:rollup, r=kennytm

Rollup of 11 pull requests

- Successful merges: #48639, #49223, #49333, #49369, #49381, #49395, #49399, #49401, #49417, #49202, #49426
- Failed merges:

6 years agorustdoc: Add test for foreign impl trait with bounds
Manish Goregaokar [Tue, 27 Mar 2018 19:37:27 +0000 (21:37 +0200)]
rustdoc: Add test for foreign impl trait with bounds

6 years agorustdoc: Handle explicit ?Sized on foreign impl Trait
Manish Goregaokar [Tue, 27 Mar 2018 19:26:44 +0000 (21:26 +0200)]
rustdoc: Handle explicit ?Sized on foreign impl Trait

6 years agorustdoc: Remove Sized bounds when cleaning foreign impl Trait
Manish Goregaokar [Tue, 27 Mar 2018 18:59:09 +0000 (20:59 +0200)]
rustdoc: Remove Sized bounds when cleaning foreign impl Trait

6 years agorustdoc: Include associated type bounds when cleaning foreign impl traits
Manish Goregaokar [Tue, 27 Mar 2018 18:45:24 +0000 (20:45 +0200)]
rustdoc: Include associated type bounds when cleaning foreign impl traits

6 years agorustdoc: Don't use into_iter() when cleaning impl Trait
Manish Goregaokar [Tue, 27 Mar 2018 12:18:54 +0000 (14:18 +0200)]
rustdoc: Don't use into_iter() when cleaning impl Trait

6 years agorustc: Forbid #[inline(always)] with #[target_feature]
Alex Crichton [Tue, 27 Mar 2018 18:42:04 +0000 (11:42 -0700)]
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.

cc rust-lang-nursery/stdsimd#404

6 years agoFix collapse toggle insertions on impl with docs
Guillaume Gomez [Tue, 27 Mar 2018 20:49:55 +0000 (22:49 +0200)]
Fix collapse toggle insertions on impl with docs

6 years agoEnable target_feature on any LLVM 6+
Josh Stone [Tue, 27 Mar 2018 19:27:45 +0000 (12:27 -0700)]
Enable target_feature on any LLVM 6+

In `LLVMRustHasFeature()`, rather than using `MCInfo->getFeatureTable()`
that is specific to Rust's LLVM fork, we can use this in LLVM 6:

    /// Check whether the subtarget features are enabled/disabled as per
    /// the provided string, ignoring all other features.
    bool checkFeatures(StringRef FS) const;

Now rustc using external LLVM can also have `target_feature`.

6 years agoRollup merge of #49426 - lukaslueg:patch-1, r=kennytm
kennytm [Tue, 27 Mar 2018 19:03:39 +0000 (03:03 +0800)]
Rollup merge of #49426 - lukaslueg:patch-1, r=kennytm

Update CONTRIBUTING.md

The current link is a 404, just link to the main repo page

6 years agoRollup merge of #49407 - WiSaGaN:patch-1, r=alexcrichton
kennytm [Tue, 27 Mar 2018 19:03:21 +0000 (03:03 +0800)]
Rollup merge of #49407 - WiSaGaN:patch-1, r=alexcrichton

Add back 1.24.1 release notes

6 years agoUpdate CONTRIBUTING.md
lukaslueg [Tue, 27 Mar 2018 18:56:15 +0000 (20:56 +0200)]
Update CONTRIBUTING.md

The current link is a 404, just link to the main repo page

6 years agoAdd extra test for expressions and fix typo in message
matthew [Tue, 27 Mar 2018 15:39:15 +0000 (08:39 -0700)]
Add extra test for expressions and fix typo in message

6 years agoRollup merge of #49417 - TimNN:fix-ios, r=alexcrichton
kennytm [Tue, 27 Mar 2018 15:20:27 +0000 (23:20 +0800)]
Rollup merge of #49417 - TimNN:fix-ios, r=alexcrichton

Update compiler-rt with fix for 32bit iOS ARM

6 years agoUse the actual discriminant instead of always choosing the dataful variant
Oliver Schneider [Tue, 27 Mar 2018 15:19:41 +0000 (17:19 +0200)]
Use the actual discriminant instead of always choosing the dataful variant

6 years agoAuto merge of #49202 - csmoe:trait_engine, r=nikomatsakis
bors [Tue, 27 Mar 2018 14:31:43 +0000 (14:31 +0000)]
Auto merge of #49202 - csmoe:trait_engine, r=nikomatsakis

Introduce trait engine

address #48895 step 1: introduce trait engine

6 years agoUpdate compiler-rt with fix for 32bit iOS ARM
Tim Neumann [Tue, 27 Mar 2018 13:32:06 +0000 (15:32 +0200)]
Update compiler-rt with fix for 32bit iOS ARM

6 years agoAuto merge of #49305 - SimonSapin:fallible, r=sfackler
bors [Tue, 27 Mar 2018 11:50:10 +0000 (11:50 +0000)]
Auto merge of #49305 - SimonSapin:fallible, r=sfackler

Stabilize TryFrom / TryInto, and tweak impls for integers

Fixes https://github.com/rust-lang/rust/issues/33417 (tracking issue)

----

This adds:

* `impl From<u16> for usize`
* `impl From<i16> for isize`
* `impl From<u8> for isize`

… replacing corresponding `TryFrom<Error=!>` impls. (`TryFrom` still applies through the generic `impl<T, U> TryFrom<U> for T where T: From<U>`.) Their infallibility is supported by the C99 standard which (indirectly) requires pointers to be at least 16 bits.

The remaining `TryFrom` impls that define `type Error = !` all involve `usize` or `isize`. This PR changes them to use `TryFromIntError` instead, since having a return type change based on the target is a portability hazard.

Note: if we make similar assumptions about the *maximum* bit size of pointers (for all targets Rust will ever run on in the future), we could have similar `From` impls converting pointer-sized integers to large fixed-size integers. RISC-V considers the possibility of a 128-bit address space (RV128), which would leave only `impl From<usize> for u128` and `impl From<isize> for u128`. I [found](https://www.cl.cam.ac.uk/research/security/ctsrd/pdfs/20171017a-cheri-poster.pdf) some [things](http://www.csl.sri.com/users/neumann/2012resolve-cheri.pdf) about 256-bit “capabilities”, but I don’t know how relevant that would be to Rust’s `usize` and `isize` types.

I chose conservatively to make no assumption about the future there. Users making their portability decisions and using something like `.try_into().unwrap()`.

----

Since this feature already went through FCP in the tracking issue https://github.com/rust-lang/rust/issues/33417, this PR also proposes **stabilize** the following items:

* The `convert::TryFrom` trait
* The `convert::TryFrom` trait
* `impl<T> TryFrom<&[T]> for &[T; $N]` (for `$N` up to 32)
* `impl<T> TryFrom<&mut [T]> for &mut [T; $N]` (for `$N` up to 32)
* The `array::TryFromSliceError` struct, with impls of `Debug`, `Copy`, `Clone`, and `Error`
* `impl TryFrom<u32> for char`
* The `char::CharTryFromError` struct, with impls of `Copy`, `Clone`, `Debug`, `PartialEq`, `Eq`, `Display`, and `Error`
* Impls of `TryFrom` for all (?) combinations of primitive integer types where `From` isn’t implemented.
* The `num::TryFromIntError` struct, with impls of `Debug`, `Copy`, `Clone`, `Display`, `From<!>`, and `Error`

Some minor remaining questions that I hope can be resolved in this PR:

* Should the impls for error types be unified?
* ~Should `TryFrom` and `TryInto` be in the prelude? `From` and `Into` are.~ (Yes.)

6 years agoHide type declarations by default
Guillaume Gomez [Tue, 27 Mar 2018 09:57:00 +0000 (11:57 +0200)]
Hide type declarations by default

6 years agoRollup merge of #49401 - alercah:format, r=cramertj
kennytm [Tue, 27 Mar 2018 08:47:54 +0000 (10:47 +0200)]
Rollup merge of #49401 - alercah:format, r=cramertj

Add missing '?' to format grammar.

6 years agoRollup merge of #49399 - ehuss:termcolor-update, r=alexcrichton
kennytm [Tue, 27 Mar 2018 08:47:53 +0000 (10:47 +0200)]
Rollup merge of #49399 - ehuss:termcolor-update, r=alexcrichton

Fix diagnostic colors on Windows 10 console.

This updates termcolor to pick up BurntSushi/ripgrep#867.

Fixes #49322.

6 years agoRollup merge of #49395 - petrochenkov:obsolete, r=alexcrichton
kennytm [Tue, 27 Mar 2018 08:47:51 +0000 (10:47 +0200)]
Rollup merge of #49395 - petrochenkov:obsolete, r=alexcrichton

libsyntax: Remove obsolete.rs

This little piece of infra is obsolete (ha-ha) and is unlikely to be used in the future, even if new obsolete syntax appears.

6 years agoAdd back 1.24.1 release notes
Wangshan Lu [Tue, 27 Mar 2018 08:47:50 +0000 (16:47 +0800)]
Add back 1.24.1 release notes

6 years agoRollup merge of #49381 - withoutboats:str_unicode, r=SimonSapin
kennytm [Tue, 27 Mar 2018 08:47:50 +0000 (10:47 +0200)]
Rollup merge of #49381 - withoutboats:str_unicode, r=SimonSapin

Add is_whitespace and is_alphanumeric to str.

The other methods from `UnicodeStr` are already stable inherent
methods on str, but these have not been included.

r? @SimonSapin

6 years agoRollup merge of #49369 - petrochenkov:rprint, r=oli-obk
kennytm [Tue, 27 Mar 2018 08:47:49 +0000 (10:47 +0200)]
Rollup merge of #49369 - petrochenkov:rprint, r=oli-obk

Fix pretty-printing for raw identifiers

6 years agoRollup merge of #49333 - GuillaumeGomez:link-assoc-const, r=QuietMisdreavus
kennytm [Tue, 27 Mar 2018 08:47:48 +0000 (10:47 +0200)]
Rollup merge of #49333 - GuillaumeGomez:link-assoc-const, r=QuietMisdreavus

Fix impl assoc constant link not working

Fixes #49323.

r? @QuietMisdreavus

6 years agoRollup merge of #49223 - GuillaumeGomez:propose-variant-for-E0599, r=cramertj
kennytm [Tue, 27 Mar 2018 08:47:46 +0000 (10:47 +0200)]
Rollup merge of #49223 - GuillaumeGomez:propose-variant-for-E0599, r=cramertj

Propose a variant if it is an enum for E0599

Fixes #49192.