Commit Graph

76517 Commits

Author SHA1 Message Date
gaurikholkar
1b06fe1ef5 Merge branch 'master' of https://github.com/rust-lang/rust into e0389 2018-04-05 21:52:40 +05:30
gaurikholkar
6c649fbed4 address code review comments 2018-04-05 21:48:06 +05:30
bors
56714acc5e 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:
2018-04-05 13:07:45 +00:00
kennytm
f4511e2437
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.
2018-04-05 18:38:53 +08:00
kennytm
d05009bfa1
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.
2018-04-05 18:37:29 +08:00
kennytm
84f6440d79
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
2018-04-05 18:37:28 +08:00
kennytm
b146e33518
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
2018-04-05 18:37:25 +08:00
kennytm
23689cc8e9
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.
2018-04-05 16:51:21 +08:00
kennytm
19c69082f5
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
2018-04-05 16:51:20 +08:00
kennytm
a70f844012
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).
2018-04-05 16:51:19 +08:00
kennytm
46d0befb8e
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
2018-04-05 16:51:18 +08:00
kennytm
920249abdd
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.
2018-04-05 16:51:16 +08:00
bors
01d0be9925 Auto merge of #48851 - petrochenkov:genparattr, r=nikomatsakis
Stabilize attributes on generic parameters

Closes https://github.com/rust-lang/rust/issues/48848
2018-04-05 07:31:56 +00:00
bors
4bf76d6745 Auto merge of #48709 - tinaun:issue48703, r=nikomatsakis
remove erroneous error message when checking impl trait params

fixes #48703
2018-04-05 05:04:27 +00:00
Alex Crichton
621ccf8917 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.
2018-04-04 17:35:42 -07:00
bors
3b1fa867f2 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.
2018-04-05 00:19:46 +00:00
Vadim Petrochenkov
1a2a23447e Stabilize attributes on generic parameters 2018-04-05 02:19:56 +03:00
Boris-Chengbiao Zhou
ae86e83c52 Update RLS 2018-04-04 23:44:09 +02:00
bors
74abffeabb 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:
2018-04-04 21:12:18 +00:00
Manish Goregaokar
323795534f Add more features to rust_2018_preview 2018-04-04 13:58:38 -07:00
Jorge Aparicio
b1015f5c5a compile other no-std crates 2018-04-04 22:42:56 +02:00
Jorge Aparicio
bca569f57c Revert "create a nostd crate"
This reverts commit 14768f9b63.
2018-04-04 22:23:33 +02:00
kennytm
00ada06bba
Rollup merge of #49547 - Phlosioneer:44831-borrowck-remove-ignore, r=arielb1
Unignore borrowck test

Unignores a test that has been fixed.

See #44831
2018-04-05 03:09:47 +08:00
kennytm
f29d20e198
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.
2018-04-05 02:17:07 +08:00
kennytm
2025a08393
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
2018-04-05 02:17:06 +08:00
kennytm
391959feb9
Rollup merge of #49625 - bjorn3:miri_access_memory_kind, r=oli-obk
miri: add public alloc_kind accessor
2018-04-05 02:17:04 +08:00
kennytm
93ad4f2b9c
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.
2018-04-05 02:17:03 +08:00
kennytm
d6f19b676f
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.
2018-04-05 02:17:02 +08:00
kennytm
b6b8ed2eff
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
2018-04-05 02:17:01 +08:00
kennytm
a4f744d84e
Rollup merge of #49637 - tmccombs:parent-id-stabilize, r=sfackler
Stabilize parent_id()

Fixes #46104
2018-04-05 02:17:00 +08:00
bors
fb44b4c0eb 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
2018-04-04 18:11:51 +00:00
Jorge Aparicio
14768f9b63 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
2018-04-04 19:24:57 +02:00
bors
17fea66ba4 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
2018-04-04 15:38:10 +00:00
David Wood
809d01c62e
Updated codeblocks to specify language where required. 2018-04-04 16:09:58 +01:00
David Wood
9e9a987a02
Documenting private items in compiler docs. 2018-04-04 16:09:01 +01:00
bjorn3
ac4f69bea4 miri: add public alloc_kind accessor 2018-04-04 15:31:49 +02:00
kennytm
4b6ab5a115
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.
2018-04-04 11:07:28 +02:00
kennytm
ce5db0f887
Rollup merge of #49618 - pftbest:fix_warning, r=SimonSapin
Fix build error when compiling libcore for 16bit targets

Fixes #49617

cc @SimonSapin
2018-04-04 11:07:27 +02:00
kennytm
19c07d382a
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)
2018-04-04 11:07:26 +02:00
kennytm
b3b7e776cb
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
2018-04-04 11:07:25 +02:00
kennytm
dd2ec6a099
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`
2018-04-04 11:07:24 +02:00
kennytm
52fd162603
Rollup merge of #49603 - GuillaumeGomez:fix-intra-link-trait-provided-method, r=QuietMisdreavus
Fix url for intra link provided method

Fixes #49582.

r? @QuietMisdreavus
2018-04-04 11:07:22 +02:00
kennytm
e1ebd0a9ee
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.
2018-04-04 11:07:21 +02:00
kennytm
29ab7d8db0
Rollup merge of #49577 - tmccombs:string-splice-stabilize, r=TimNN
Stabilize String::replace_range

Fixes #44643
2018-04-04 11:07:20 +02:00
kennytm
7dad49f906
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?
2018-04-04 11:07:19 +02:00
kennytm
0cccf810ad
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.
2018-04-04 11:07:18 +02:00
kennytm
b5ceda86aa
Rollup merge of #49540 - bjorn3:fix_miri_discriminant, r=oli-obk
Fix miri Discriminant() for non-ADT

Fixes #49327
2018-04-04 11:07:17 +02:00
kennytm
6c8b8091fc
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
2018-04-04 11:07:16 +02:00
kennytm
f4f13883e5
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
2018-04-04 11:07:14 +02:00
kennytm
e0c180362e
Rollup merge of #49516 - GuillaumeGomez:add-union-field-missing-anchor, r=QuietMisdreavus
Add missing anchor for union type fields

r? @QuietMisdreavus
2018-04-04 11:07:13 +02:00