]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoNo separator for `?`. No `?` as a separator.
Mark Mansi [Fri, 6 Apr 2018 00:50:08 +0000 (19:50 -0500)]
No separator for `?`. No `?` as a separator.

6 years agoAuto merge of #49684 - kennytm:rollup, r=kennytm
bors [Thu, 5 Apr 2018 13:07:45 +0000 (13:07 +0000)]
Auto merge of #49684 - kennytm:rollup, r=kennytm

Rollup of 9 pull requests

Successful merges:

 - #48658 (Add a generic CAS loop to std::sync::Atomic*)
 - #49253 (Take the original extra-filename passed to a crate into account when resolving it as a dependency)
 - #49345 (RFC 2008: Finishing Touches)
 - #49432 (Flush executables to disk after linkage)
 - #49496 (Add more vec![... ; n] optimizations)
 - #49563 (add a dist builder to build rust-std components for the THUMB targets)
 - #49654 (Host compiler documentation: Include private items)
 - #49667 (Add more features to rust_2018_preview)
 - #49674 (ci: Remove x86_64-gnu-incremental builder)

Failed merges:

6 years agoRollup merge of #49674 - alexcrichton:no-incremental-rustc, r=michaelwoerister
kennytm [Thu, 5 Apr 2018 10:38:53 +0000 (18:38 +0800)]
Rollup merge of #49674 - alexcrichton:no-incremental-rustc, r=michaelwoerister

ci: Remove x86_64-gnu-incremental builder

This builder is starting to time out frequently causing PRs to bounce and
otherwise doesn't seem to be catching too many bugs, so this commit removes it
entirely. We've had a number of timeouts in the last few weeks related to this
builder:

* https://travis-ci.org/rust-lang/rust/jobs/360947582
* https://travis-ci.org/rust-lang/rust/jobs/360464190
* https://travis-ci.org/rust-lang/rust/jobs/359946975
* https://travis-ci.org/rust-lang/rust/jobs/361213241
* https://travis-ci.org/rust-lang/rust/jobs/362346279
* https://travis-ci.org/rust-lang/rust/jobs/362072331

On a good run this builder takes about 2h15m, which is already too long for
Travis and the variable build times end up pushing it beyond the 3h limit
occasionally.

The timeouts here are somewhat expected in that an incrementally compiled rustc
compiler isn't optimized like a normal rustc, disallowing inlining between
codegen units and losing lots of optimization opportunities.

6 years agoRollup merge of #49667 - Manishearth:preview-features, r=nikomatsakis
kennytm [Thu, 5 Apr 2018 08:51:26 +0000 (16:51 +0800)]
Rollup merge of #49667 - Manishearth:preview-features, r=nikomatsakis

Add more features to rust_2018_preview

Doesn't handle lib features like never_type; we need to figure out a scheme for that.

6 years agoRollup merge of #49654 - davidtwco:issue-29893, r=alexcrichton
kennytm [Thu, 5 Apr 2018 08:51:25 +0000 (16:51 +0800)]
Rollup merge of #49654 - davidtwco:issue-29893, r=alexcrichton

Host compiler documentation: Include private items

Fixes #29893. Now that compiler documentation is being hosted, including private items seems sensible as these types are going to be being used by contributors working on the compiler.

However, including this means that doc comments that contain codeblocks with invalid Rust and can fail the documenting of a given crate (as evidenced by the changes in the second commit included in this PR). We'd need some way of ensuring that this cannot happen so that these failures don't cause documenting to fail. I'm unsure whether this change to documentation steps will cause this to happen already or if something new will be required.

r? @alexcrichton

6 years agoRollup merge of #49563 - japaric:std-thumb, r=alexcrichton
kennytm [Thu, 5 Apr 2018 08:51:24 +0000 (16:51 +0800)]
Rollup merge of #49563 - japaric:std-thumb, r=alexcrichton

add a dist builder to build rust-std components for the THUMB targets

the rust-std component only contains the core and compiler-builtins (+c +mem) crates

cc #49382

- I'm not entirely sure if this PR alone will produce rust-std components installable by rustup or if something else needs to be changed
- I could have done the THUMB builds in an existing builder / image; I wasn't sure if that was a good idea so I added a new image
- I could build other crates like alloc into the rust-std component but, AFAICT, that would require calling Cargo a second time (one for alloc and one for compiler-builtins), or have alloc depend on compiler-builtins (#49503 will perform that change) *and* have alloc resurface the "c" and "mem" Cargo features.

r? @alexcrichton

6 years agoRollup merge of #49496 - glandium:master, r=sfackler
kennytm [Thu, 5 Apr 2018 08:51:21 +0000 (16:51 +0800)]
Rollup merge of #49496 - glandium:master, r=sfackler

Add more vec![... ; n] optimizations

vec![0; n], via implementations of SpecFromElem, has an optimization that uses with_capacity_zeroed instead of with_capacity, which will use calloc instead of malloc, and avoid an extra memset.

This PR adds the same optimization for ptr::null, ptr::null_mut, and None, when their in-memory representation is zeroes.

6 years agoRollup merge of #49432 - nabijaczleweli:master, r=michaelwoerister
kennytm [Thu, 5 Apr 2018 08:51:20 +0000 (16:51 +0800)]
Rollup merge of #49432 - nabijaczleweli:master, r=michaelwoerister

Flush executables to disk after linkage

A problem caused by not doing so in Chrome has been reported [here](https://randomascii.wordpress.com/2018/02/25/compiler-bug-linker-bug-windows-kernel-bug/amp/).

`File::sync_all()` calls `FlushFileBuffers()` down the line, causing potentially unflushed buffers on high I/O-load systems to flush and preventing nasty non-reproducible bugs.

Closes #48545

6 years agoRollup merge of #49345 - davidtwco:issue-44109, r=nikomatsakis
kennytm [Thu, 5 Apr 2018 08:51:19 +0000 (16:51 +0800)]
Rollup merge of #49345 - davidtwco:issue-44109, r=nikomatsakis

RFC 2008: Finishing Touches

Part of #44109.

r? @nikomatsakis
(not sure who was best for this PR).

6 years agoRollup merge of #49253 - chmanchester:probing_fix, r=alexcrichton
kennytm [Thu, 5 Apr 2018 08:51:18 +0000 (16:51 +0800)]
Rollup merge of #49253 - chmanchester:probing_fix, r=alexcrichton

Take the original extra-filename passed to a crate into account when resolving it as a dependency

resolving it as a dependency.

Fixes #46816

6 years agoRollup merge of #48658 - llogiq:no-more-cas, r=kennytm
kennytm [Thu, 5 Apr 2018 08:51:16 +0000 (16:51 +0800)]
Rollup merge of #48658 - llogiq:no-more-cas, r=kennytm

Add a generic CAS loop to std::sync::Atomic*

This adds two new methods to both `AtomicIsize` and `AtomicUsize` with optimized safe compare-and-set loops, so users will no longer need to write their own, except in *very* strange circumstances.

`update_and_fetch` will apply the function and return its result, whereas `fetch_and_update` will apply the function and return the previous value.

This solves #48384 with `x.update_and_fetch(|x| x.max(y))`. It also relates to #48655 (which I misuse as tracking issue for now)..

*note* This *might* need a crater run because the functions could clash with third party extension traits.

6 years agoAuto merge of #48851 - petrochenkov:genparattr, r=nikomatsakis
bors [Thu, 5 Apr 2018 07:31:56 +0000 (07:31 +0000)]
Auto merge of #48851 - petrochenkov:genparattr, r=nikomatsakis

Stabilize attributes on generic parameters

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

6 years agoAuto merge of #48709 - tinaun:issue48703, r=nikomatsakis
bors [Thu, 5 Apr 2018 05:04:27 +0000 (05:04 +0000)]
Auto merge of #48709 - tinaun:issue48703, r=nikomatsakis

remove erroneous error message when checking impl trait params

fixes #48703

6 years agoci: Remove x86_64-gnu-incremental builder
Alex Crichton [Thu, 5 Apr 2018 00:35:42 +0000 (17:35 -0700)]
ci: Remove x86_64-gnu-incremental builder

This builder is starting to time out frequently causing PRs to bounce and
otherwise doesn't seem to be catching too many bugs, so this commit removes it
entirely. We've had a number of timeouts in the last few weeks related to this
builder:

* https://travis-ci.org/rust-lang/rust/jobs/360947582
* https://travis-ci.org/rust-lang/rust/jobs/360464190
* https://travis-ci.org/rust-lang/rust/jobs/359946975
* https://travis-ci.org/rust-lang/rust/jobs/361213241
* https://travis-ci.org/rust-lang/rust/jobs/362346279
* https://travis-ci.org/rust-lang/rust/jobs/362072331

On a good run this builder takes about 2h15m, which is already too long for
Travis and the variable build times end up pushing it beyond the 3h limit
occasionally.

The timeouts here are somewhat expected in that an incrementally compiled rustc
compiler isn't optimized like a normal rustc, disallowing inlining between
codegen units and losing lots of optimization opportunities.

6 years agoAuto merge of #49587 - Bobo1239:master, r=nrc
bors [Thu, 5 Apr 2018 00:19:46 +0000 (00:19 +0000)]
Auto merge of #49587 - Bobo1239:master, r=nrc

Update RLS

Includes https://github.com/rust-lang-nursery/rls/pull/793 which fixes https://github.com/rust-lang-nursery/rls/issues/803.

6 years agoStabilize attributes on generic parameters
Vadim Petrochenkov [Thu, 8 Mar 2018 19:24:10 +0000 (22:24 +0300)]
Stabilize attributes on generic parameters

6 years agoUpdate RLS
Boris-Chengbiao Zhou [Mon, 2 Apr 2018 14:08:03 +0000 (16:08 +0200)]
Update RLS

6 years agoAuto merge of #49642 - kennytm:rollup, r=kennytm
bors [Wed, 4 Apr 2018 21:12:18 +0000 (21:12 +0000)]
Auto merge of #49642 - kennytm:rollup, r=kennytm

Rollup of 25 pull requests

Successful merges:

 - #49179 (Handle future deprecation annotations )
 - #49512 (Add support for variant and types fields for intra links)
 - #49515 (fix targetted value background)
 - #49516 (Add missing anchor for union type fields)
 - #49532 (Add test for rustdoc ignore test)
 - #49533 (Add #[must_use] to a few standard library methods)
 - #49540 (Fix miri Discriminant() for non-ADT)
 - #49559 (Introduce Vec::resize_with method (see #41758))
 - #49570 (avoid IdxSets containing garbage above the universe length)
 - #49577 (Stabilize String::replace_range)
 - #49599 (Fix typo)
 - #49603 (Fix url for intra link provided method)
 - #49607 (Stabilize iterator methods in 1.27)
 - #49609 (run-pass/attr-stmt-expr: expand test cases)
 - #49612 (Fix "since" version for getpid feature.)
 - #49618 (Fix build error when compiling libcore for 16bit targets)
 - #49619 (tweak core::fmt docs)
 - #49637 (Stabilize parent_id())
 - #49639 (Update Cargo)
 - #49628 (Re-write the documentation index)
 - #49594 (Add some performance guidance to std::fs and std::io docs)
 - #49625 (miri: add public alloc_kind accessor)
 - #49634 (Add a test for the fix to issue #43058)
 - #49641 (Regression test for #46314)
 - #49547 (Unignore borrowck test)

Failed merges:

6 years agoAdd more features to rust_2018_preview
Manish Goregaokar [Wed, 4 Apr 2018 20:58:38 +0000 (13:58 -0700)]
Add more features to rust_2018_preview

6 years agocompile other no-std crates
Jorge Aparicio [Wed, 4 Apr 2018 20:42:56 +0000 (22:42 +0200)]
compile other no-std crates

6 years agoRevert "create a nostd crate"
Jorge Aparicio [Wed, 4 Apr 2018 20:23:33 +0000 (22:23 +0200)]
Revert "create a nostd crate"

This reverts commit 14768f9b636ef345320ded41da5e9f3da7af3a81.

6 years agoRollup merge of #49547 - Phlosioneer:44831-borrowck-remove-ignore, r=arielb1
kennytm [Wed, 4 Apr 2018 19:09:47 +0000 (03:09 +0800)]
Rollup merge of #49547 - Phlosioneer:44831-borrowck-remove-ignore, r=arielb1

Unignore borrowck test

Unignores a test that has been fixed.

See #44831

6 years agoRollup merge of #49641 - valff:decl-macro-illegal-copy, r=nikomatsakis
kennytm [Wed, 4 Apr 2018 18:05:57 +0000 (02:05 +0800)]
Rollup merge of #49641 - valff:decl-macro-illegal-copy, r=nikomatsakis

Regression test for #46314

#46314 is fixed by NLL. This PR adds a regression test for the bug. Intended for #47366.

6 years agoRollup merge of #49634 - lloydmeta:tests/issue-43058, r=nikomatsakis
kennytm [Wed, 4 Apr 2018 18:05:29 +0000 (02:05 +0800)]
Rollup merge of #49634 - lloydmeta:tests/issue-43058, r=nikomatsakis

Add a test for the fix to issue #43058

Followed the instructions laid out here https://github.com/rust-lang/rust/issues/43058#issuecomment-378389971

6 years agoRollup merge of #49625 - bjorn3:miri_access_memory_kind, r=oli-obk
kennytm [Wed, 4 Apr 2018 18:05:02 +0000 (02:05 +0800)]
Rollup merge of #49625 - bjorn3:miri_access_memory_kind, r=oli-obk

miri: add public alloc_kind accessor

6 years agoRollup merge of #49594 - mbrubeck:docs, r=steveklabnik
kennytm [Wed, 4 Apr 2018 18:04:16 +0000 (02:04 +0800)]
Rollup merge of #49594 - mbrubeck:docs, r=steveklabnik

Add some performance guidance to std::fs and std::io docs

Adds more documentation about performance to various "read" functions in `fs` and `io`, and to `BufReader`/`BufWriter`, with the goal of helping developers choose the best option for a given task.

6 years agoRollup merge of #49628 - steveklabnik:learn-use-master, r=QuietMisdreavus
kennytm [Wed, 4 Apr 2018 18:02:37 +0000 (02:02 +0800)]
Rollup merge of #49628 - steveklabnik:learn-use-master, r=QuietMisdreavus

Re-write the documentation index

The docs team has decided that we're framing resources in three ways:
"learning Rust," "using Rust," "mastering Rust." This is a more useful
split than "beginner/intermediate/advanced." As we add more resources
in the future, we expect "using Rust" to grow. "the bookshelf" as a
concept is great, but isn't really organized along these lines. As such,
this reorganizes the docs along these lines.

6 years agoRollup merge of #49639 - matklad:cargo, r=kennytm
kennytm [Wed, 4 Apr 2018 09:13:04 +0000 (17:13 +0800)]
Rollup merge of #49639 - matklad:cargo, r=kennytm

Update Cargo

This includes at least two notable changes:

  * a regression is fixed where Cargo would update index on every
    operation https://github.com/rust-lang/cargo/pull/5288
  * a new unstable `--out-dir` option is implemented
    https://github.com/rust-lang/cargo/pull/5203

6 years agoRollup merge of #49637 - tmccombs:parent-id-stabilize, r=sfackler
kennytm [Wed, 4 Apr 2018 09:07:30 +0000 (11:07 +0200)]
Rollup merge of #49637 - tmccombs:parent-id-stabilize, r=sfackler

Stabilize parent_id()

Fixes #46104

6 years agoAuto merge of #48171 - FraGag:doc-copy-clone-impls, r=nikomatsakis
bors [Wed, 4 Apr 2018 18:11:51 +0000 (18:11 +0000)]
Auto merge of #48171 - FraGag:doc-copy-clone-impls, r=nikomatsakis

Better document the implementors of Clone and Copy

There are two parts to this change. The first part is a change to the compiler and to the standard library (specifically, libcore) to allow implementations of `Clone` and `Copy` to be written for a subset of builtin types. By adding these implementations to libcore, they now show up in the documentation. This is a [breaking-change] for users of `#![no_core]`, because they will now have to supply their own copy of the implementations of `Clone` and `Copy` that were added in libcore.

The second part is purely a documentation change to document the other implementors of `Clone` and `Copy` that cannot be described in Rust code (yet) and are thus provided by the compiler.

Fixes #25893

6 years agocreate a nostd crate
Jorge Aparicio [Wed, 4 Apr 2018 17:24:57 +0000 (19:24 +0200)]
create a nostd crate

the goal is to build, in a single Cargo invocation, several no-std crates that we want to put in the
rust-std component of no-std targets. The nostd crate builds these crates:

- core
- compiler-builtin (with the "c" and "mem" features enabled)
- alloc
- std_unicode

6 years agoAuto merge of #48913 - Mark-Simulacrum:rustbuild-test, r=alexcrichton
bors [Wed, 4 Apr 2018 15:38:10 +0000 (15:38 +0000)]
Auto merge of #48913 - Mark-Simulacrum:rustbuild-test, r=alexcrichton

Add tests to rustbuild

In order to run tests, we cfg out various parts of rustbuild. Generally
speaking, these are filesystem and process-spawning operations. Then, rustbuild
is run "as normal" and the various steps that where run are retrieved from the
cache and checked against the expected results.

Note that this means that the current implementation primarily tests "what" we
build, but doesn't actually test that what we build *will* build. In other
words, it doesn't do any form of dependency verification for any crate. This is
possible to implement, but is considered future work.

This implementation strives to cfg out as little code as possible; it also does
not currently test anywhere near all of rustbuild. The current tests are also
not checked for "correctness," rather, they simply represent what we do as of
this commit, which may be wrong.

Test cases are drawn from the old implementation of rustbuild, though the
expected results may vary.

r? @alexcrichton

6 years agoUpdated codeblocks to specify language where required.
David Wood [Wed, 4 Apr 2018 15:09:58 +0000 (16:09 +0100)]
Updated codeblocks to specify language where required.

6 years agoDocumenting private items in compiler docs.
David Wood [Wed, 4 Apr 2018 15:09:01 +0000 (16:09 +0100)]
Documenting private items in compiler docs.

6 years agomiri: add public alloc_kind accessor
bjorn3 [Tue, 3 Apr 2018 15:50:31 +0000 (17:50 +0200)]
miri: add public alloc_kind accessor

6 years agoRollup merge of #49619 - durka:patch-46, r=steveklabnik
kennytm [Wed, 4 Apr 2018 09:07:28 +0000 (11:07 +0200)]
Rollup merge of #49619 - durka:patch-46, r=steveklabnik

tweak core::fmt docs

Remove an outdated (pre-1.0!) claim about passing something or other to a function. Also swap the variable names in the example.

6 years agoRollup merge of #49618 - pftbest:fix_warning, r=SimonSapin
kennytm [Wed, 4 Apr 2018 09:07:27 +0000 (11:07 +0200)]
Rollup merge of #49618 - pftbest:fix_warning, r=SimonSapin

Fix build error when compiling libcore for 16bit targets

Fixes #49617

cc @SimonSapin

6 years agoRollup merge of #49612 - tmccombs:stabilize-getpid, r=kennytm
kennytm [Wed, 4 Apr 2018 09:07:26 +0000 (11:07 +0200)]
Rollup merge of #49612 - tmccombs:stabilize-getpid, r=kennytm

Fix "since" version for getpid feature.

It was stabilized right before the beta branch was cut for 1.26.0.

See https://github.com/rust-lang/rust/pull/49523#issuecomment-377996315

This will need to be backported to beta (1.26.0)

6 years agoRollup merge of #49609 - abonander:attr-macro-stmt-expr, r=petrochenkov
kennytm [Wed, 4 Apr 2018 09:07:25 +0000 (11:07 +0200)]
Rollup merge of #49609 - abonander:attr-macro-stmt-expr, r=petrochenkov

run-pass/attr-stmt-expr: expand test cases

Follow-up to https://github.com/rust-lang/rust/pull/49124#discussion_r178542587

r? @petrochenkov

6 years agoRollup merge of #49607 - cuviper:stable-iter-1.27, r=alexcrichton
kennytm [Wed, 4 Apr 2018 09:07:24 +0000 (11:07 +0200)]
Rollup merge of #49607 - cuviper:stable-iter-1.27, r=alexcrichton

Stabilize iterator methods in 1.27

- Closes #39480, feature  `iter_rfind`
  - `DoubleEndedIterator::rfind`
- Closes #44705, feature `iter_rfold`
  - `DoubleEndedIterator::rfold`
- Closes #45594, feature `iterator_try_fold`
  - `Iterator::try_fold`
  - `Iterator::try_for_each`
  - `DoubleEndedIterator::try_rfold`

6 years agoRollup merge of #49603 - GuillaumeGomez:fix-intra-link-trait-provided-method, r=Quiet...
kennytm [Wed, 4 Apr 2018 09:07:22 +0000 (11:07 +0200)]
Rollup merge of #49603 - GuillaumeGomez:fix-intra-link-trait-provided-method, r=QuietMisdreavus

Fix url for intra link provided method

Fixes #49582.

r? @QuietMisdreavus

6 years agoRollup merge of #49599 - rolfvandekrol:feature/no_ru, r=frewsxcv
kennytm [Wed, 4 Apr 2018 09:07:21 +0000 (11:07 +0200)]
Rollup merge of #49599 - rolfvandekrol:feature/no_ru, r=frewsxcv

Fix typo

In `libstd/io/buffered.rs` one example was marked as `no_ru` instead of `no_run`. I assume this is a typo.

6 years agoRollup merge of #49577 - tmccombs:string-splice-stabilize, r=TimNN
kennytm [Wed, 4 Apr 2018 09:07:20 +0000 (11:07 +0200)]
Rollup merge of #49577 - tmccombs:string-splice-stabilize, r=TimNN

Stabilize String::replace_range

Fixes #44643

6 years agoRollup merge of #49570 - arielb1:bounded-universe, r=nikomatsakis
kennytm [Wed, 4 Apr 2018 09:07:19 +0000 (11:07 +0200)]
Rollup merge of #49570 - arielb1:bounded-universe, r=nikomatsakis

avoid IdxSets containing garbage above the universe length

This makes sure that all bits in each IdxSet between the universe length
and the end of the word are all zero instead of being in an indeterminate state.

This fixes a crash with RUST_LOG=rustc_mir, and is probably a good idea
anyway.

r? @nikomatsakis - I think you are responsible for this code area now?

6 years agoRollup merge of #49559 - djc:resize-with, r=TimNN
kennytm [Wed, 4 Apr 2018 09:07:18 +0000 (11:07 +0200)]
Rollup merge of #49559 - djc:resize-with, r=TimNN

Introduce Vec::resize_with method (see #41758)

In #41758, the libs team decided they preferred `Vec::resize_with` over `Vec::resize_default()`. Here is an implementation to get this moving forward.

I don't know what the removal process for `Vec::resize_default()` should be, so I've left it in place for now. Would be happy to follow up with its removal.

6 years agoRollup merge of #49540 - bjorn3:fix_miri_discriminant, r=oli-obk
kennytm [Wed, 4 Apr 2018 09:07:17 +0000 (11:07 +0200)]
Rollup merge of #49540 - bjorn3:fix_miri_discriminant, r=oli-obk

Fix miri Discriminant() for non-ADT

Fixes #49327

6 years agoRollup merge of #49533 - scottmcm:more-must-use, r=nikomatsakis
kennytm [Wed, 4 Apr 2018 09:07:16 +0000 (11:07 +0200)]
Rollup merge of #49533 - scottmcm:more-must-use, r=nikomatsakis

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

```rust
warning: unused return value of `std::iter::Iterator::collect` which must be used: if you really need to exhaust the iterator, consider `.for_each(drop)` instead
  --> $DIR/fn_must_use_stdlib.rs:19:5
   |
LL |     "1 2 3".split_whitespace().collect::<Vec<_>>();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused return value of `std::borrow::ToOwned::to_owned` which must be used: cloning is often expensive and is not expected to have side effects
  --> $DIR/fn_must_use_stdlib.rs:21:5
   |
LL |     "hello".to_owned();
   |     ^^^^^^^^^^^^^^^^^^^

warning: unused return value of `std::clone::Clone::clone` which must be used: cloning is often expensive and is not expected to have side effects
  --> $DIR/fn_must_use_stdlib.rs:23:5
   |
LL |     String::from("world").clone();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

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

6 years agoRollup merge of #49532 - Phlosioneer:32556-rustdoc-regression-test, r=GuillaumeGomez
kennytm [Wed, 4 Apr 2018 09:07:14 +0000 (11:07 +0200)]
Rollup merge of #49532 - Phlosioneer:32556-rustdoc-regression-test, r=GuillaumeGomez

Add test for rustdoc ignore test

This will check for regression on issue #32556

6 years agoRollup merge of #49516 - GuillaumeGomez:add-union-field-missing-anchor, r=QuietMisdreavus
kennytm [Wed, 4 Apr 2018 09:07:13 +0000 (11:07 +0200)]
Rollup merge of #49516 - GuillaumeGomez:add-union-field-missing-anchor, r=QuietMisdreavus

Add missing anchor for union type fields

r? @QuietMisdreavus

6 years agoRollup merge of #49515 - GuillaumeGomez:target-background, r=QuietMisdreavus
kennytm [Wed, 4 Apr 2018 09:07:12 +0000 (11:07 +0200)]
Rollup merge of #49515 - GuillaumeGomez:target-background, r=QuietMisdreavus

fix targetted value background

r? @QuietMisdreavus

6 years agoRollup merge of #49512 - GuillaumeGomez:intra-links-fields, r=QuietMisdreavus
kennytm [Wed, 4 Apr 2018 09:07:11 +0000 (11:07 +0200)]
Rollup merge of #49512 - GuillaumeGomez:intra-links-fields, r=QuietMisdreavus

Add support for variant and types fields for intra links

Part of #43466.

r? @QuietMisdreavus

6 years agoRollup merge of #49179 - varkor:future-deprecation, r=QuietMisdreavus,GuillaumeGomez
kennytm [Wed, 4 Apr 2018 09:07:10 +0000 (11:07 +0200)]
Rollup merge of #49179 - varkor:future-deprecation, r=QuietMisdreavus,GuillaumeGomez

Handle future deprecation annotations

This adds special handling to the `since` parameter of the `deprecated` attribute: in particular, if the `since` version exceeds the version of the compiler, the deprecation notice will not be printed; but a note is added to the documentation stating that the item will be deprecated in a later version.

(I've used `since` for this, rather than adding a new attribute, because it's more seamless and, I feel, intuitive. Plus it involves less code churn.)

![image](https://user-images.githubusercontent.com/3943692/37611317-ef5cdf16-2b99-11e8-8251-e35e8f7b0137.png)
![image](https://user-images.githubusercontent.com/3943692/37611323-f748c2d0-2b99-11e8-966b-11408c73d416.png)

This is a prerequisite for doing things renaming methods in the standard library (e.g. #30459). Resolves #30785.

6 years agoRegression test for #46314
Valentine Valyaeff [Wed, 4 Apr 2018 08:36:38 +0000 (11:36 +0300)]
Regression test for #46314

6 years agoAuto merge of #48575 - ishitatsuyuki:unix-no-thread, r=alexcrichton
bors [Wed, 4 Apr 2018 06:19:40 +0000 (06:19 +0000)]
Auto merge of #48575 - ishitatsuyuki:unix-no-thread, r=alexcrichton

rustc_driver: get rid of the extra thread

**Do not rollup**

We can alter the stack size afterwards on Unix.

Having a separate thread causes poor debugging experience when interrupting with signals. I have to get the backtrace of the all thread, as the main thread is waiting to join doing nothing else. This patch allows me to just run `bt` to get the desired backtrace.

6 years agoUpdate Cargo
Aleksey Kladov [Wed, 4 Apr 2018 06:00:35 +0000 (09:00 +0300)]
Update Cargo

This includes at least two notable changes:

  * a regression is fixed where Cargo would update index on every
    operation https://github.com/rust-lang/cargo/pull/5288
  * a new unstable `--out-dir` option is implemented
    https://github.com/rust-lang/cargo/pull/5203

6 years agoAuto merge of #49573 - glandium:huge-align, r=SimonSapin
bors [Wed, 4 Apr 2018 03:48:22 +0000 (03:48 +0000)]
Auto merge of #49573 - glandium:huge-align, r=SimonSapin

Reject huge alignments on macos with system allocator only

ef8804ba277b055fdc3e6d148e680e3c1b597ad8 addressed #30170 by rejecting
huge alignments at the allocator API level, transforming a specific
platform bug/limitation into an enforced API limitation on all
platforms.

This change essentially reverts that commit, and instead makes alloc()
itself return AllocErr::Unsupported when receiving huge alignments.

This was discussed in https://github.com/rust-lang/rust/issues/32838#issuecomment-368348408
and following.

6 years agoStabilize parent_id()
Thayne McCombs [Wed, 4 Apr 2018 01:47:37 +0000 (19:47 -0600)]
Stabilize parent_id()

Fixes #46104

6 years agoFormatting
lloydmeta [Wed, 4 Apr 2018 01:33:52 +0000 (10:33 +0900)]
Formatting

6 years agoAdd a test for the fix to issue #43058
lloydmeta [Wed, 4 Apr 2018 01:25:37 +0000 (10:25 +0900)]
Add a test for the fix to issue #43058

Followed the instructions laid out here https://github.com/rust-lang/rust/issues/43058#issuecomment-378389971

6 years agoAuto merge of #48333 - aidanhs:aphs-no-place-for-placement, r=nikomatsakis
bors [Wed, 4 Apr 2018 01:06:35 +0000 (01:06 +0000)]
Auto merge of #48333 - aidanhs:aphs-no-place-for-placement, r=nikomatsakis

Remove all unstable placement features

Closes #22181, #27779. Effectively makes the assortment of placement RFCs (rust-lang/rfcs#470, rust-lang/rfcs#809, rust-lang/rfcs#1228) 'unaccepted'. It leaves `box_syntax` and keeps the `<-` token as recognised by libsyntax.

------------------------

I don't know the correct process for unaccepting an unstable feature that was accepted as an RFC so...here's a PR.

Let me preface this by saying I'm not particularly happy about doing this (I know it'll be unpopular), but I think it's the most honest expression of how things stand today. I've been motivated by a [post on reddit](https://www.reddit.com/r/rust/comments/7wrqk2/when_will_box_and_placementin_syntax_be_stable/) which asks when these features will be stable - the features have received little RFC-style design work since the end of 2015 (~2 years ago) and leaving them in limbo confuses people who want to know where they're up to. Without additional design work that needs to happen (see the collection of unresolved questions later in this post) they can't really get stabilised, and I think that design work would be most suited to an RFC rather than (currently mostly unused) experimental features in Rust nightly.

I have my own motivations - it's very simple to 'defeat' placement in debug mode today and I don't want a placement in Rust that a) has no guarantees to work and b) has no plan for in-place serde deserialisation.

There's a quote in [1]: "Ordinarily these uncertainties might lead to the RFC being postponed. [The RFC seems like a promising direction hence we will accept since it] will thus give us immediate experience with the design and help in determining the best final solution.". I propose that there have been enough additional uncertainties raised since then that the original direction is less promising and we should be think about the problem anew.

(a historical note: the first mention of placement (under that name - uninit pointers were earlier) in an RFC AFAIK is [0] in late 2014 (pre-1.0). RFCs since then have built on this base - [1] is a comment in Feb 2015 accepting a more conservative design of the Place* traits - this is back when serde still required aster and seemed to break every other nightly! A lot has changed since then, perhaps placement should too)

------------------------

Concrete unresolved questions include:

 - making placement work in debug mode [7]
 - making placement work for serde/with fallible creation [5], [irlo2], [8]
 - trait design:
   - opting into not consuming the placer in `Placer::make_place` - [2]
   - trait proliferation - [4] (+ others in that thread)
   - fallible allocation - [3], [4] (+ others in that thread)
 - support for DSTs/unsized structs (if at all) - [1], [6]

More speculative unresolved questions include:

 - better trait design with in the context of future language features [irlo1] (Q11), [irlo3]
 - interaction between custom allocators and placement [irlo3]

[0] https://github.com/rust-lang/rfcs/pull/470
[1] https://github.com/rust-lang/rfcs/pull/809#issuecomment-73910414
[2] https://github.com/rust-lang/rfcs/issues/1286
[3] https://github.com/rust-lang/rfcs/issues/1315
[4] https://github.com/rust-lang/rust/issues/27779#issuecomment-146711893
[5] https://github.com/rust-lang/rust/issues/27779#issuecomment-285562402
[6] https://github.com/rust-lang/rust/issues/27779#issuecomment-354464938
[7] https://github.com/rust-lang/rust/issues/27779#issuecomment-358025344
[8] https://github.com/rust-lang/rfcs/pull/1228#issuecomment-190825370
[irlo1] https://internals.rust-lang.org/t/placement-nwbi-faq-new-box-in-left-arrow/2789
[irlo2] https://internals.rust-lang.org/t/placement-nwbi-faq-new-box-in-left-arrow/2789/19
[irlo3] https://internals.rust-lang.org/t/lang-team-minutes-feature-status-report-placement-in-and-box/4646

6 years agoAdd performance notes to BufReader/BufWriter docs
Matt Brubeck [Mon, 2 Apr 2018 16:31:04 +0000 (09:31 -0700)]
Add performance notes to BufReader/BufWriter docs

6 years agoCross-reference fs::read functions from io::Read docs
Matt Brubeck [Mon, 2 Apr 2018 16:11:07 +0000 (09:11 -0700)]
Cross-reference fs::read functions from io::Read docs

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 agoRe-write the documentation index
steveklabnik [Tue, 3 Apr 2018 16:38:53 +0000 (12:38 -0400)]
Re-write the documentation index

The docs team has decided that we're framing resources in three ways:
"learning Rust," "using Rust," "mastering Rust." This is a more useful
split than "beginner/intermediate/advanced." As we add more resources
in the future, we expect "using Rust" to grow. "the bookshelf" as a
concept is great, but isn't really organized along these lines. As such,
this reorganizes the docs along these lines.

6 years agoStop checking that the graph produced by a dry run is equivalent
Mark Simulacrum [Sun, 1 Apr 2018 16:51:24 +0000 (10:51 -0600)]
Stop checking that the graph produced by a dry run is equivalent

This is too likely to cause spurious bounces on CI; what we run may be
dependent on what ran successfully before hand (e.g. RLS features with
Clippy), which makes this not tenable. There's no good way to ignore
specifically these problematic steps so we'll just ignore everything for
the time being. We still test that a dry run worked though so largely
this is the same from a ensure-that-tests-work perspective.

Eventually we'll want to undo this commit, though, to make our tests
more accurate.

6 years agoFix a few accidental expectations
Mark Simulacrum [Sun, 1 Apr 2018 01:21:14 +0000 (19:21 -0600)]
Fix a few accidental expectations

6 years agoAvoid printing output when in dry run mode
Mark Simulacrum [Wed, 28 Mar 2018 15:25:09 +0000 (17:25 +0200)]
Avoid printing output when in dry run mode

6 years agoRefactor to use a dry-run config instead of cfg(test)
Mark Simulacrum [Tue, 27 Mar 2018 14:06:47 +0000 (16:06 +0200)]
Refactor to use a dry-run config instead of cfg(test)

This ensures that each build will support the testing design of "dry
running" builds. It's also checked that a dry run build is equivalent
step-wise to a "wet" run build; the graphs we generate when running are
directly compared node/node and edge/edge, both for order and contents.

6 years agoImplement generating graphs of the build steps
Mark Simulacrum [Tue, 27 Mar 2018 10:44:33 +0000 (12:44 +0200)]
Implement generating graphs of the build steps

6 years agoStub out less code
Mark Simulacrum [Thu, 15 Mar 2018 23:29:53 +0000 (17:29 -0600)]
Stub out less code

6 years agoAdd tests to rustbuild
Mark Simulacrum [Sat, 10 Mar 2018 14:03:06 +0000 (07:03 -0700)]
Add tests to rustbuild

In order to run tests, previous commits have cfg'd out various parts of
rustbuild. Generally speaking, these are filesystem-related operations
and process-spawning related parts. Then, rustbuild is run "as normal"
and the various steps that where run are retrieved from the cache and
checked against the expected results.

Note that this means that the current implementation primarily tests
"what" we build, but doesn't actually test that what we build *will*
build. In other words, it doesn't do any form of dependency verification
for any crate. This is possible to implement, but is considered future
work.

This implementation strives to cfg out as little code as possible; it
also does not currently test anywhere near all of rustbuild. The current
tests are also not checked for "correctness," rather, they simply
represent what we do as of this commit, which may be wrong.

Test cases are drawn from the old implementation of rustbuild, though
the expected results may vary.

6 years agoExtract default Config into function
Mark Simulacrum [Sat, 10 Mar 2018 14:02:17 +0000 (07:02 -0700)]
Extract default Config into function

Will permit creating Config in tests without having to parse a toml
file.

6 years agoMake test steps sortable
Mark Simulacrum [Sat, 10 Mar 2018 14:01:06 +0000 (07:01 -0700)]
Make test steps sortable

Ensures that test cases will be somewhat easier to write.

6 years agoStub out various functions during testing
Mark Simulacrum [Sat, 10 Mar 2018 02:23:35 +0000 (19:23 -0700)]
Stub out various functions during testing

6 years agoPermit constructing Build without executing
Mark Simulacrum [Sat, 10 Mar 2018 02:19:59 +0000 (19:19 -0700)]
Permit constructing Build without executing

6 years agoPermit constructing Builder without executing
Mark Simulacrum [Sat, 10 Mar 2018 02:05:06 +0000 (19:05 -0700)]
Permit constructing Builder without executing

6 years agoStop accessing current_dir in bootstrap
Mark Simulacrum [Sat, 10 Mar 2018 01:14:35 +0000 (18:14 -0700)]
Stop accessing current_dir in bootstrap

This ensures that the working directory of rustbuild has no effect on
it's run; since tests will run with a different cwd this is required for
consistent behavior.

6 years agoIntroduce Vec::resize_with method (see #41758)
Dirkjan Ochtman [Sun, 1 Apr 2018 14:55:25 +0000 (16:55 +0200)]
Introduce Vec::resize_with method (see #41758)

6 years agotweak format_args! docs
Alex Burka [Tue, 3 Apr 2018 13:20:04 +0000 (09:20 -0400)]
tweak format_args! docs

Swap the variable names in the example.

6 years agotweak fmt::Arguments docs
Alex Burka [Tue, 3 Apr 2018 13:11:41 +0000 (09:11 -0400)]
tweak fmt::Arguments docs

Remove an outdated claim about passing something or other to a function. Also swap the variable names in the example.

6 years agoFix warning when compilin libcore on 16bit targets.
Vadzim Dambrouski [Tue, 3 Apr 2018 12:33:18 +0000 (15:33 +0300)]
Fix warning when compilin libcore on 16bit targets.

Fixes #49617

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 agoRemove all unstable placement features
Aidan Hobson Sayers [Sun, 18 Feb 2018 17:39:40 +0000 (17:39 +0000)]
Remove all unstable placement features

Closes #22181, #27779

6 years agoextend no-std-ness check to all *-none-* targets
Jorge Aparicio [Tue, 3 Apr 2018 06:29:09 +0000 (08:29 +0200)]
extend no-std-ness check to all *-none-* targets

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 agomerge dist-various-3 into dist-various-1
Jorge Aparicio [Tue, 3 Apr 2018 06:26:24 +0000 (08:26 +0200)]
merge dist-various-3 into dist-various-1

6 years agoFix imports
Tatsuyuki Ishi [Tue, 3 Apr 2018 03:42:36 +0000 (12:42 +0900)]
Fix imports

6 years agoRemove splice page from unstable book.
Thayne McCombs [Tue, 3 Apr 2018 01:41:22 +0000 (19:41 -0600)]
Remove splice page from unstable book.

6 years agoMerge remote-tracking branch 'upstream/master' into string-splice-stabilize
Thayne McCombs [Tue, 3 Apr 2018 01:36:13 +0000 (19:36 -0600)]
Merge remote-tracking branch 'upstream/master' into string-splice-stabilize

6 years agoFix "since" version for getpid feature.
Thayne McCombs [Tue, 3 Apr 2018 01:34:06 +0000 (19:34 -0600)]
Fix "since" version for getpid feature.

It was stabilized right before the beta branch was cut for 1.26.0.

See https://github.com/rust-lang/rust/pull/49523#issuecomment-377996315

6 years agorun-pass/attr-stmt-expr: expand test cases
Austin Bonander [Tue, 3 Apr 2018 00:21:37 +0000 (17:21 -0700)]
run-pass/attr-stmt-expr: expand test cases

6 years agoStabilize iterator_try_fold in 1.27.0
Josh Stone [Mon, 2 Apr 2018 23:40:53 +0000 (16:40 -0700)]
Stabilize iterator_try_fold in 1.27.0

6 years agoStabilize iter_rfind in 1.27.0
Josh Stone [Mon, 2 Apr 2018 23:37:06 +0000 (16:37 -0700)]
Stabilize iter_rfind in 1.27.0

6 years agoStabilize iter_rfold in 1.27.0
Josh Stone [Mon, 2 Apr 2018 23:33:09 +0000 (16:33 -0700)]
Stabilize iter_rfold in 1.27.0

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 agoChecking location and syntax of non_exhaustive attribute.
David Wood [Sat, 24 Mar 2018 18:07:18 +0000 (18:07 +0000)]
Checking location and syntax of non_exhaustive attribute.

6 years agoReplace as_ref with &
varkor [Mon, 2 Apr 2018 21:57:47 +0000 (22:57 +0100)]
Replace as_ref with &

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 agoFix typo
Rolf van de Krol [Mon, 2 Apr 2018 19:48:56 +0000 (21:48 +0200)]
Fix typo