]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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 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 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 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 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 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 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.

6 years agoRollup merge of #48639 - varkor:sort_by_key-cached, r=bluss
kennytm [Tue, 27 Mar 2018 08:47:44 +0000 (10:47 +0200)]
Rollup merge of #48639 - varkor:sort_by_key-cached, r=bluss

Add slice::sort_by_cached_key as a memoised sort_by_key

At present, `slice::sort_by_key` calls its key function twice for each comparison that is made. When the key function is expensive (which can often be the case when `sort_by_key` is chosen over `sort_by`), this can lead to very suboptimal behaviour.

To address this, I've introduced a new slice method, `sort_by_cached_key`, which has identical semantic behaviour to `sort_by_key`, except that it guarantees the key function will only be called once per element.

Where there are `n` elements and the key function is `O(m)`:
- `slice::sort_by_cached_key` time complexity is `O(m n log m n)`, compared to `slice::sort_by_key`'s `O(m n + n log n)`.
- `slice::sort_by_cached_key` space complexity remains at `O(n + m)`. (Technically, it now reserves a slice of size `n`, whereas before it reserved a slice of size `n/2`.)

`slice::sort_unstable_by_key` has not been given an analogue, as it is important that unstable sorts are in-place, which is not a property that is guaranteed here. However, this also means that `slice::sort_unstable_by_key` is likely to be slower than `slice::sort_by_cached_key` when the key function does not have negligible complexity. We might want to explore this trade-off further in the future.

Benchmarks (for a vector of 100 `i32`s):
```
# Lexicographic: `|x| x.to_string()`
test bench_sort_by_key ... bench:      112,638 ns/iter (+/- 19,563)
test bench_sort_by_cached_key ... bench:       15,038 ns/iter (+/- 4,814)

# Identity: `|x| *x`
test bench_sort_by_key ... bench:        1,346 ns/iter (+/- 238)
test bench_sort_by_cached_key ... bench:        1,839 ns/iter (+/- 765)

# Power: `|x| x.pow(31)`
test bench_sort_by_key ... bench:        3,624 ns/iter (+/- 738)
test bench_sort_by_cached_key ... bench:        1,997 ns/iter (+/- 311)

# Abs: `|x| x.abs()`
test bench_sort_by_key ... bench:        1,546 ns/iter (+/- 174)
test bench_sort_by_cached_key ... bench:        1,668 ns/iter (+/- 790)
```
(So it seems functions that are single operations do perform slightly worse with this method, but for pretty much any more complex key, you're better off with this optimisation.)

I've definitely found myself using expensive keys in the past and wishing this optimisation was made (e.g. for https://github.com/rust-lang/rust/pull/47415). This feels like both desirable and expected behaviour, at the small cost of slightly more stack allocation and minute degradation in performance for extremely trivial keys.

Resolves #34447.

6 years agoFix search appearance
Guillaume Gomez [Tue, 27 Mar 2018 08:33:31 +0000 (10:33 +0200)]
Fix search appearance

6 years agoRemove TryFrom impls that might become conditionally-infallible with a portability...
Simon Sapin [Mon, 26 Mar 2018 20:48:12 +0000 (22:48 +0200)]
Remove TryFrom impls that might become conditionally-infallible with a portability lint

https://github.com/rust-lang/rust/pull/49305#issuecomment-376293243

6 years agoAuto merge of #49279 - varkor:generated-closure-return-type, r=alexcrichton
bors [Tue, 27 Mar 2018 07:16:29 +0000 (07:16 +0000)]
Auto merge of #49279 - varkor:generated-closure-return-type, r=alexcrichton

Fix implicit closure return type generation for libsyntax

The `lambda` function for constructing closures in libsyntax was explicitly setting the return type to `_`, which resulted in incorrect corresponding syntax (as `|| -> _ x` is not valid, without the enclosing brackets). This meant the generated code, when printed, was invalid.

I also took the opportunity to slightly improve the generated code for the `RustcEncodable::encode` method for unit structs.

Fixes #42213.

6 years agoAuto merge of #49249 - gnzlbg:simd_minmax, r=alexcrichton
bors [Tue, 27 Mar 2018 04:46:32 +0000 (04:46 +0000)]
Auto merge of #49249 - gnzlbg:simd_minmax, r=alexcrichton

implement minmax intrinsics

This adds the `simd_{fmin,fmax}` intrinsics, which do a vertical (lane-wise) `min`/`max` for floating point vectors that's equivalent to Rust's `min`/`max` for `f32`/`f64`.

It might make sense to make `{f32,f64}::{min,max}` use the `minnum` and `minmax` intrinsics as well.

---

~~HELP: I need some help with these. Either I should go to sleep or there must be something that I must be missing. AFAICT I am calling the `maxnum` builder correctly, yet rustc/LLVM seem to insert a call to `llvm.minnum` there instead...~~ EDIT: Rust's LLVM version is too old :/

6 years agoRemove an unnecessary/incorrect match in the expression check function
matthew [Tue, 27 Mar 2018 02:41:19 +0000 (19:41 -0700)]
Remove an unnecessary/incorrect match in the expression check function

6 years agoAdd missing '?' to format grammar.
Alexis Hunt [Tue, 27 Mar 2018 01:18:50 +0000 (21:18 -0400)]
Add missing '?' to format grammar.

6 years agoImplement `shrink_to` method on collections
Diggory Blake [Mon, 26 Mar 2018 22:24:31 +0000 (23:24 +0100)]
Implement `shrink_to` method on collections

6 years agoFix diagnostic colors on Windows 10 console.
Eric Huss [Mon, 26 Mar 2018 23:20:11 +0000 (16:20 -0700)]
Fix diagnostic colors on Windows 10 console.

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

Fixes #49322.

6 years agolibsyntax: Remove obsolete.rs
Vadim Petrochenkov [Mon, 26 Mar 2018 21:45:28 +0000 (00:45 +0300)]
libsyntax: Remove obsolete.rs

6 years agoAdd TryFrom and TryInto to the prelude
Simon Sapin [Mon, 26 Mar 2018 09:17:31 +0000 (11:17 +0200)]
Add TryFrom and TryInto to the prelude

6 years agoStabilize the TryFrom and TryInto traits
Simon Sapin [Fri, 23 Mar 2018 12:52:54 +0000 (13:52 +0100)]
Stabilize the TryFrom and TryInto traits

Tracking issue: https://github.com/rust-lang/rust/issues/33417

6 years agoDon’t use `type Error = !` for target-dependant TryFrom impls.
Simon Sapin [Fri, 23 Mar 2018 12:42:43 +0000 (13:42 +0100)]
Don’t use `type Error = !` for target-dependant TryFrom impls.

Instead, expose apparently-fallible conversions in cases where
the implementation happens to be infallible for a given target.

Having an associated type / return type in a public API change
based on the target is a portability hazard.

6 years agoTryFrom for integers: use From instead for truely-infallible impls
Simon Sapin [Fri, 23 Mar 2018 12:36:08 +0000 (13:36 +0100)]
TryFrom for integers: use From instead for truely-infallible impls

There is precendent in C for having a minimum pointer size, but I don’t feel confident enough about the future to mandate a maximum.

6 years agoRemove mentions of unstable sort_by_cached key from stable documentation
varkor [Mon, 26 Mar 2018 21:24:03 +0000 (22:24 +0100)]
Remove mentions of unstable sort_by_cached key from stable documentation

6 years agoAuto merge of #49053 - alexcrichton:fail-if-build-cargo-twice, r=Mark-Simulacrum
bors [Mon, 26 Mar 2018 21:21:33 +0000 (21:21 +0000)]
Auto merge of #49053 - alexcrichton:fail-if-build-cargo-twice, r=Mark-Simulacrum

rustbuild: Fail the build if we build Cargo twice

This commit updates the `ToolBuild` step to stream Cargo's JSON messages, parse
them, and record all libraries built. If we build anything twice (aka Cargo)
it'll most likely happen due to dependencies being recompiled which is caught by
this check.

6 years agoFix pretty-printing for raw identifiers
Vadim Petrochenkov [Sun, 25 Mar 2018 23:47:04 +0000 (02:47 +0300)]
Fix pretty-printing for raw identifiers

6 years agorustbuild: Fail the build if we build Cargo twice
Alex Crichton [Thu, 15 Mar 2018 17:58:02 +0000 (10:58 -0700)]
rustbuild: Fail the build if we build Cargo twice

This commit updates the `ToolBuild` step to stream Cargo's JSON messages, parse
them, and record all libraries built. If we build anything twice (aka Cargo)
it'll most likely happen due to dependencies being recompiled which is caught by
this check.

6 years agoAuto merge of #49101 - mark-i-m:stabilize_i128, r=nagisa
bors [Mon, 26 Mar 2018 18:41:38 +0000 (18:41 +0000)]
Auto merge of #49101 - mark-i-m:stabilize_i128, r=nagisa

Stabilize 128-bit integers :tada:

cc #35118

EDIT: This should be merged only after the following have been merged:
- [x] https://github.com/rust-lang-nursery/compiler-builtins/pull/236
- [x] https://github.com/rust-lang/book/pull/1230

6 years agoAdd a hash when a TargetPath is displayed
Philipp Oppermann [Mon, 26 Mar 2018 17:01:26 +0000 (19:01 +0200)]
Add a hash when a TargetPath is displayed

6 years agoCanonicalize paths
Philipp Oppermann [Sat, 24 Mar 2018 19:14:59 +0000 (20:14 +0100)]
Canonicalize paths

6 years agoIntroduce a TargetTriple enum to support absolute target paths
Philipp Oppermann [Wed, 14 Mar 2018 14:27:06 +0000 (15:27 +0100)]
Introduce a TargetTriple enum to support absolute target paths

6 years agoAuto merge of #49379 - TimNN:rollup, r=TimNN
bors [Mon, 26 Mar 2018 15:48:06 +0000 (15:48 +0000)]
Auto merge of #49379 - TimNN:rollup, r=TimNN

Rollup of 7 pull requests

- Successful merges: #48693, #48932, #49103, #49170, #49187, #49346, #49353
- Failed merges:

6 years agoCheck for known but incorrect attributes
matthew [Thu, 22 Mar 2018 15:57:26 +0000 (08:57 -0700)]
Check for known but incorrect attributes

- Change nested_visit_map so it will recusively 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 isssue #43988

6 years agoAllow niche-filling dataful variants to be represented as a ScalarPair
Anthony Ramine [Mon, 26 Mar 2018 14:26:03 +0000 (16:26 +0200)]
Allow niche-filling dataful variants to be represented as a ScalarPair

6 years agoRemove unnecessary trait import.
boats [Mon, 26 Mar 2018 14:41:45 +0000 (07:41 -0700)]
Remove unnecessary trait import.

6 years agofix last two tidy
Mark Mansi [Sat, 24 Mar 2018 23:19:33 +0000 (18:19 -0500)]
fix last two tidy

6 years agodid i get it right now?
Mark Mansi [Wed, 21 Mar 2018 01:56:53 +0000 (20:56 -0500)]
did i get it right now?

6 years agoUpdate to master of libcompiler_builtins
Mark Mansi [Tue, 20 Mar 2018 15:14:06 +0000 (10:14 -0500)]
Update to master of libcompiler_builtins

6 years agoRemove library feature test
Mark Mansi [Sun, 18 Mar 2018 02:19:36 +0000 (21:19 -0500)]
Remove library feature test

6 years agoFix e0658 ui test
Mark Mansi [Sun, 18 Mar 2018 02:08:32 +0000 (21:08 -0500)]
Fix e0658 ui test

6 years agoupdate test
Mark Mansi [Sun, 18 Mar 2018 01:39:19 +0000 (20:39 -0500)]
update test

6 years agoFix a few more unstables that I missed
Mark Mansi [Sun, 18 Mar 2018 01:10:18 +0000 (20:10 -0500)]
Fix a few more unstables that I missed

6 years agoFix a few more
Mark Mansi [Sat, 17 Mar 2018 16:55:44 +0000 (11:55 -0500)]
Fix a few more

6 years agoFix missed i128 feature gates
Mark Mansi [Sat, 17 Mar 2018 16:46:31 +0000 (11:46 -0500)]
Fix missed i128 feature gates

6 years agoremove unneeded import
Mark Mansi [Sat, 17 Mar 2018 01:38:59 +0000 (20:38 -0500)]
remove unneeded import

6 years agoRename unstable book correctly
Mark Mansi [Sat, 17 Mar 2018 01:21:35 +0000 (20:21 -0500)]
Rename unstable book correctly

6 years agoRename unstable-book chapter
Mark Mansi [Sat, 17 Mar 2018 01:20:06 +0000 (20:20 -0500)]
Rename unstable-book chapter

6 years agoStabilize i128 feature too
Mark Mansi [Sat, 17 Mar 2018 01:15:56 +0000 (20:15 -0500)]
Stabilize i128 feature too

6 years agoUpdate nightly book
Mark Mansi [Sat, 17 Mar 2018 00:54:20 +0000 (19:54 -0500)]
Update nightly book