]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoAdd as_micros and as_millis methods
Jonathan Behrens [Sat, 19 May 2018 19:18:07 +0000 (15:18 -0400)]
Add as_micros and as_millis methods

6 years agoIssue number should be for tracking issue not PR
Jonathan Behrens [Tue, 24 Apr 2018 19:17:06 +0000 (15:17 -0400)]
Issue number should be for tracking issue not PR

6 years agoDoctest of feature requires that feature
Jonathan Behrens [Sun, 22 Apr 2018 21:19:35 +0000 (17:19 -0400)]
Doctest of feature requires that feature

6 years agoAdd issue number
Jonathan Behrens [Sun, 22 Apr 2018 19:52:32 +0000 (15:52 -0400)]
Add issue number

6 years agoUse NANOS_PER_SEC constant
Jonathan Behrens [Sun, 22 Apr 2018 19:43:52 +0000 (15:43 -0400)]
Use NANOS_PER_SEC constant

6 years agoAdd as_nanos function to duration
Jonathan Behrens [Sun, 22 Apr 2018 19:39:28 +0000 (15:39 -0400)]
Add as_nanos function to duration

6 years agoAuto merge of #50135 - matklad:update-cargo, r=kennytm
bors [Sun, 22 Apr 2018 13:23:49 +0000 (13:23 +0000)]
Auto merge of #50135 - matklad:update-cargo, r=kennytm

Update Cargo

Some noteble changes:

 * ~~regression fix: https://github.com/rust-lang/cargo/pull/5390~~
  * ~~potentially breaking bug-fix: https://github.com/rust-lang/cargo/pull/5389~~
  * ~~Cargo now caches the result of `rustc -vV`. It checks `rustc` binary
    mtime and rustup toolchain settings, so it should probably "just work"
    with rustbuild.~~

potentially breaking bug-fix: https://github.com/rust-lang/cargo/pull/5390

6 years agoAuto merge of #49954 - GuillaumeGomez:doc-settings, r=ollie27,QuietMisdreavus
bors [Sun, 22 Apr 2018 11:04:41 +0000 (11:04 +0000)]
Auto merge of #49954 - GuillaumeGomez:doc-settings, r=ollie27,QuietMisdreavus

Add rustdoc settings menu

Fixes #18167.

r? @QuietMisdreavus

6 years agoAuto merge of #50123 - kennytm:do-not-test-rls-if-build-failed, r=alexcrichton
bors [Sun, 22 Apr 2018 08:48:32 +0000 (08:48 +0000)]
Auto merge of #50123 - kennytm:do-not-test-rls-if-build-failed, r=alexcrichton

Do not test RLS/Rustfmt if build failed

6 years agoAuto merge of #50109 - SimonSapin:copy, r=sfackler
bors [Sun, 22 Apr 2018 06:03:20 +0000 (06:03 +0000)]
Auto merge of #50109 - SimonSapin:copy, r=sfackler

Implement Copy for std::alloc::Layout

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

6 years agoAuto merge of #49757 - GuillaumeGomez:never-search, r=QuietMisdreavus
bors [Sun, 22 Apr 2018 02:18:41 +0000 (02:18 +0000)]
Auto merge of #49757 - GuillaumeGomez:never-search, r=QuietMisdreavus

Add specific never search

Fixes #49529.

r? @QuietMisdreavus

6 years agoAuto merge of #49896 - SimonSapin:inherent, r=alexcrichton
bors [Sun, 22 Apr 2018 00:01:29 +0000 (00:01 +0000)]
Auto merge of #49896 - SimonSapin:inherent, r=alexcrichton

Add inherent methods in libcore for [T], [u8], str, f32, and f64

# Background

Primitive types are defined by the language, they don’t have a type definition like `pub struct Foo { … }` in any crate. So they don’t “belong” to any crate as far as `impl` coherence is concerned, and on principle no crate would be able to define inherent methods for them, without a trait. Since we want these types to have inherent methods anyway, the standard library (with cooperation from the compiler) bends this rule with code like [`#[lang = "u8"] impl u8 { /*…*/ }`](https://github.com/rust-lang/rust/blob/1.25.0/src/libcore/num/mod.rs#L2244-L2245). The `#[lang]` attribute is permanently-unstable and never intended to be used outside of the standard library.

Each lang item can only be defined once. Before this PR there is one impl-coherence-rule-bending lang item per primitive type (plus one for `[u8]`, which overlaps with `[T]`). And so one `impl` block each. These blocks for `str`, `[T]` and `[u8]` are in liballoc rather than libcore because *some* of the methods (like `<[T]>::to_vec(&self) -> Vec<T> where T: Clone`) need a global memory allocator which we don’t want to make a requirement in libcore. Similarly, `impl f32` and `impl f64` are in libstd because some of the methods are based on FFI calls to C’s `libm` and we want, as much as possible, libcore not to require “runtime support”.

In libcore, the methods of `str` and `[T]` that don’t allocate are made available through two **unstable traits** `StrExt` and `SliceExt` (so the traits can’t be *named* by programs on the Stable release channel) that have **stable methods** and are re-exported in the libcore prelude (so that programs on Stable can *call* these methods anyway). Non-allocating `[u8]` methods are not available in libcore: https://github.com/rust-lang/rust/issues/45803. Some `f32` and `f64` methods are in an unstable `core::num::Float` trait with stable methods, but that one is **not in the libcore prelude**. (So as far as Stable programs are concerns it doesn’t exist, and I don’t know what the point was to mark these methods `#[stable]`.)

https://github.com/rust-lang/rust/issues/32110 is the tracking issue for these unstable traits.

# High-level proposal

Since the standard library is already bending the rules, why not bend them *a little more*? By defining a few additional lang items, the compiler can allow the standard library to have *two* `impl` blocks (in different crates) for some primitive types.

The `StrExt` and `SliceExt` traits still exist for now so that we can bootstrap from a previous-version compiler that doesn’t have these lang items yet, but they can be removed in next release cycle. (`Float` is used internally and needs to be public for libcore unit tests, but was already `#[doc(hidden)]`.) I don’t know if https://github.com/rust-lang/rust/issues/32110 should be closed by this PR, or only when the traits are entirely removed after we make a new bootstrap compiler.

# Float methods

Among the methods of the `core::num::Float` trait, three are based on LLVM intrinsics: `abs`, `signum`, and `powi`. PR https://github.com/rust-lang/rust/pull/27823 “Remove dependencies on libm functions from libcore” moved a bunch of `core::num::Float` methods back to libstd, but left these three behind. However they aren’t specifically discussed in the PR thread. The `compiler_builtins` crate defines `__powisf2` and `__powidf2` functions that look like implementations of `powi`, but I couldn’t find a connection with the `llvm.powi.f32` and `llvm.powi.f32` intrinsics by grepping through LLVM’s code.

In discussion starting at https://github.com/rust-lang/rust/issues/32110#issuecomment-370647922 Alex says that we do not want methods in libcore that require “runtime support”, but it’s not clear whether that applies to these `abs`, `signum`, or `powi`. In doubt, I’ve **removed** them for the trait and moved them to inherent methods in libstd for now. We can move them back later (or in this PR) if we decide that’s appropriate.

# Change details

For users on the Stable release channel:

* I believe this PR does not make any breaking change
* Some methods for `[u8]`, `f32`, and `f64` are newly available to `#![no_std]` users (fixes https://github.com/rust-lang/rust/issues/45803)
* There should be no visible change for `std` users in terms of what programs compile or what their behavior is. (Only in compiler error messages, possibly.)

For Nightly users, additionally:

* The unstable `StrExt` and `SliceExt` traits are gone
* Their methods are now inherent methods of `str` and `[T]` (so only code that explicitly named the traits should be affected, not "normal" method calls)
* The `abs`, `signum` and `powi` methods of the `Float` trait are gone
* The `Float` trait’s unstable feature name changed to `float_internals` with no associated tracking issue, to reflect it being a permanently unstable implementation detail rather than a public API on a path to stabilization.
* Its remaining methods are now inherent methods of `f32` and `f64`.

-----

CC @rust-lang/libs for the API changes, @rust-lang/compiler for the new lang items

6 years agoAdd doc about doc alias feature
Guillaume Gomez [Sat, 21 Apr 2018 20:41:08 +0000 (22:41 +0200)]
Add doc about doc alias feature

6 years agoAdd tracking issue number for doc alias feature
Guillaume Gomez [Sat, 21 Apr 2018 20:33:11 +0000 (22:33 +0200)]
Add tracking issue number for doc alias feature

6 years agoAuto merge of #50121 - pnkfelix:revert-stabilization-of-never-type-et-al, r=alexcrichton
bors [Sat, 21 Apr 2018 21:14:53 +0000 (21:14 +0000)]
Auto merge of #50121 - pnkfelix:revert-stabilization-of-never-type-et-al, r=alexcrichton

Revert stabilization of never_type (!) et al

Fix #49691

I *think* this correctly adopts @nikomatsakis 's desired fix of:
 * reverting stabilization of `!` and `TryFrom`, and
 * returning to the previous fallback semantics (i.e. it is once again dependent on whether the crate has opted into `#[feature(never_type)]`,
 * **without** attempting to put back in the previous future-proofing warnings regarding the change in fallback semantics.

(I'll be away from computers for a week starting now, so any updates to this PR should be either pushed into it, or someone else should adopt the task of polishing this fix and put up their own PR.)

6 years agoremove unused condition
Guillaume Gomez [Thu, 19 Apr 2018 21:50:17 +0000 (23:50 +0200)]
remove unused condition

6 years agoAdd alias tests
Guillaume Gomez [Thu, 19 Apr 2018 18:14:47 +0000 (20:14 +0200)]
Add alias tests

6 years agoupdate tester
Guillaume Gomez [Thu, 19 Apr 2018 18:14:24 +0000 (20:14 +0200)]
update tester

6 years agofix invalid items removal
Guillaume Gomez [Thu, 19 Apr 2018 17:59:45 +0000 (19:59 +0200)]
fix invalid items removal

6 years agoadd more aliases
Guillaume Gomez [Thu, 19 Apr 2018 17:56:10 +0000 (19:56 +0200)]
add more aliases

6 years agoAdd aliases in the search as well
Guillaume Gomez [Thu, 19 Apr 2018 16:23:12 +0000 (18:23 +0200)]
Add aliases in the search as well

6 years agoGenerate alias file
Guillaume Gomez [Thu, 19 Apr 2018 15:46:13 +0000 (17:46 +0200)]
Generate alias file

6 years agoAdd specific never search
Guillaume Gomez [Sat, 7 Apr 2018 12:04:03 +0000 (14:04 +0200)]
Add specific never search

6 years agoRemove link generation on image, favicon and logo in settings
Guillaume Gomez [Fri, 20 Apr 2018 10:20:50 +0000 (12:20 +0200)]
Remove link generation on image, favicon and logo in settings

6 years agoAuto merge of #50039 - ExpHP:quick-50002, r=alexcrichton
bors [Sat, 21 Apr 2018 18:42:41 +0000 (18:42 +0000)]
Auto merge of #50039 - ExpHP:quick-50002, r=alexcrichton

smaller PR just to fix #50002

I pulled this out of #50010 to make it easier to backport to beta if necessary, considering that inclusive range syntax is stabilizing soon (?).

It fixes a bug in `<str>::index_mut` with `(..=end)` ranges (#50002), which prior to this fix was not only unusable but also UB in the cases where it "worked" (it gave improperly truncated UTF-8).

(not that I can imagine why anybody would *use* `<str>::index_mut`... but I'm not here to judge)

6 years agoAuto merge of #50093 - alexcrichton:android-uwtable, r=michaelwoerister
bors [Sat, 21 Apr 2018 16:18:22 +0000 (16:18 +0000)]
Auto merge of #50093 - alexcrichton:android-uwtable, r=michaelwoerister

rustc: Always emit `uwtable` on Android

Long ago (#40549) we enabled the `uwtable` attribute on Windows by default
(even with `-C panic=abort`) to allow unwinding binaries for [stack unwinding
information][winstack]. It looks like this same issue is [plaguing][arm1]
Gecko's Android platforms [as well][arm2]. This commit applies the same fix
as #40549 except that this time it's applied for all Android targets.

Generating a `-C panic=abort` binary for `armv7-linux-androideabi` before this
commit generated a number of `cantunwind` functions (detected with `readelf -u`)
but after this commit they all list appropriate unwind information.

Closes #49867

[winstack]: https://bugzilla.mozilla.org/show_bug.cgi?id=1302078
[arm1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1453220
[arm2]: https://bugzilla.mozilla.org/show_bug.cgi?id=1451741

6 years agorustc: Always emit `uwtable` on Android
Alex Crichton [Thu, 19 Apr 2018 22:17:34 +0000 (15:17 -0700)]
rustc: Always emit `uwtable` on Android

Long ago (#40549) we enabled the `uwtable` attribute on Windows by default
(even with `-C panic=abort`) to allow unwinding binaries for [stack unwinding
information][winstack]. It looks like this same issue is [plaguing][arm1]
Gecko's Android platforms [as well][arm2]. This commit applies the same fix
as #40549 except that this time it's applied for all Android targets.

Generating a `-C panic=abort` binary for `armv7-linux-androideabi` before this
commit generated a number of `cantunwind` functions (detected with `readelf -u`)
but after this commit they all list appropriate unwind information.

Closes #49867

[winstack]: https://bugzilla.mozilla.org/show_bug.cgi?id=1302078
[arm1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1453220
[arm2]: https://bugzilla.mozilla.org/show_bug.cgi?id=1451741

6 years agoAuto merge of #50120 - alexcrichton:more-proc-macro-gates, r=petrochenkov
bors [Sat, 21 Apr 2018 13:50:58 +0000 (13:50 +0000)]
Auto merge of #50120 - alexcrichton:more-proc-macro-gates, r=petrochenkov

rustc: Tweak custom attribute capabilities

This commit starts to lay some groundwork for the stabilization of custom
attribute invocations and general procedural macros. It applies a number of
changes discussed on [internals] as well as a [recent issue][issue], namely:

* The path used to specify a custom attribute must be of length one and cannot
  be a global path. This'll help future-proof us against any ambiguities and
  give us more time to settle the precise syntax. In the meantime though a bare
  identifier can be used and imported to invoke a custom attribute macro. A new
  feature gate, `proc_macro_path_invoc`, was added to gate multi-segment paths
  and absolute paths.

* The set of items which can be annotated by a custom procedural attribute has
  been restricted. Statements, expressions, and modules are disallowed behind
  two new feature gates: `proc_macro_expr` and `proc_macro_mod`.

* The input to procedural macro attributes has been restricted and adjusted.
  Today an invocation like `#[foo(bar)]` will receive `(bar)` as the input token
  stream, but after this PR it will only receive `bar` (the delimiters were
  removed). Invocations like `#[foo]` are still allowed and will be invoked in
  the same way as `#[foo()]`. This is a **breaking change** for all nightly
  users as the syntax coming in to procedural macros will be tweaked slightly.

* Procedural macros (`foo!()` style) can only be expanded to item-like items by
  default. A separate feature gate, `proc_macro_non_items`, is required to
  expand to items like expressions, statements, etc.

Closes #50038

[internals]: https://internals.rust-lang.org/t/help-stabilize-a-subset-of-macros-2-0/7252
[issue]: https://github.com/rust-lang/rust/issues/50038

6 years agoAuto merge of #50076 - spastorino:fix_exhaust_iter_in_debug, r=pnkfelix
bors [Sat, 21 Apr 2018 11:26:09 +0000 (11:26 +0000)]
Auto merge of #50076 - spastorino:fix_exhaust_iter_in_debug, r=pnkfelix

Fix Iter exhaustion in prove_predicates when debug is on

Fixes the issue noted in this comment https://github.com/rust-lang/rust/pull/49885/files#r182560268

r? @pnkfelix
/cc @nikomatsakis

6 years agoUpdate Cargo
Aleksey Kladov [Sat, 21 Apr 2018 08:49:06 +0000 (11:49 +0300)]
Update Cargo

Some noteble changes:

  * regression fix: https://github.com/rust-lang/cargo/pull/5390
  * potentially breaking bug-fix: https://github.com/rust-lang/cargo/pull/5389
  * Cargo now caches the result of `rustc -vV`. It checks `rustc` binary
    mtime and rustup toolchain settings, so it should probably "just work"
    with rustbuild.

6 years agoMake the unstable StrExt and SliceExt traits private to libcore in not(stage0)
Simon Sapin [Thu, 12 Apr 2018 06:36:31 +0000 (08:36 +0200)]
Make the unstable StrExt and SliceExt traits private to libcore in not(stage0)

`Float` still needs to be public for libcore unit tests.

6 years agoMove intrinsics-based float methods out of libcore into libstd
Simon Sapin [Tue, 10 Apr 2018 14:36:23 +0000 (16:36 +0200)]
Move intrinsics-based float methods out of libcore into libstd

Affected methods are `abs`, `signum`, and `powi`.
CC https://github.com/rust-lang/rust/issues/32110#issuecomment-379503183

6 years agoAdd some f32 and f64 inherent methods in libcore
Simon Sapin [Sun, 8 Apr 2018 08:09:52 +0000 (10:09 +0200)]
Add some f32 and f64 inherent methods in libcore

… previously in the unstable core::num::Float trait.

Per https://github.com/rust-lang/rust/issues/32110#issuecomment-379503183,
the `abs`, `signum`, and `powi` methods are *not* included for now
since they rely on LLVM intrinsics and we haven’t determined yet whether
those instrinsics lower to calls to libm functions on any platform.

6 years agoReplace StrExt with inherent str methods in libcore
Simon Sapin [Sat, 7 Apr 2018 19:56:02 +0000 (21:56 +0200)]
Replace StrExt with inherent str methods in libcore

6 years agoReplace SliceExt with inherent [T] methods in libcore
Simon Sapin [Sat, 7 Apr 2018 17:38:35 +0000 (19:38 +0200)]
Replace SliceExt with inherent [T] methods in libcore

6 years agoMove non-allocating [u8] inherent methods to libcore
Simon Sapin [Sat, 7 Apr 2018 09:45:22 +0000 (11:45 +0200)]
Move non-allocating [u8] inherent methods to libcore

Fixes #45803

6 years agoRemove unused methods on the private Wtf8 type
Simon Sapin [Sat, 7 Apr 2018 09:12:35 +0000 (11:12 +0200)]
Remove unused methods on the private Wtf8 type

The type and its direct parent module are `pub`, but they’re not reachable outside of std

6 years agoAdd back missing `#![feature(never_type)]`s
kennytm [Fri, 20 Apr 2018 18:48:56 +0000 (02:48 +0800)]
Add back missing `#![feature(never_type)]`s

6 years agoAuto merge of #50080 - klnusbaum:edition_49591, r=Manishearth
bors [Sat, 21 Apr 2018 05:28:21 +0000 (05:28 +0000)]
Auto merge of #50080 - klnusbaum:edition_49591, r=Manishearth

add --edition option

This adds an official `edition` flag to the rust compiler

6 years agorustc: Tweak custom attribute capabilities
Alex Crichton [Fri, 20 Apr 2018 14:50:39 +0000 (07:50 -0700)]
rustc: Tweak custom attribute capabilities

This commit starts to lay some groundwork for the stabilization of custom
attribute invocations and general procedural macros. It applies a number of
changes discussed on [internals] as well as a [recent issue][issue], namely:

* The path used to specify a custom attribute must be of length one and cannot
  be a global path. This'll help future-proof us against any ambiguities and
  give us more time to settle the precise syntax. In the meantime though a bare
  identifier can be used and imported to invoke a custom attribute macro. A new
  feature gate, `proc_macro_path_invoc`, was added to gate multi-segment paths
  and absolute paths.

* The set of items which can be annotated by a custom procedural attribute has
  been restricted. Statements, expressions, and modules are disallowed behind
  two new feature gates: `proc_macro_expr` and `proc_macro_mod`.

* The input to procedural macro attributes has been restricted and adjusted.
  Today an invocation like `#[foo(bar)]` will receive `(bar)` as the input token
  stream, but after this PR it will only receive `bar` (the delimiters were
  removed). Invocations like `#[foo]` are still allowed and will be invoked in
  the same way as `#[foo()]`. This is a **breaking change** for all nightly
  users as the syntax coming in to procedural macros will be tweaked slightly.

* Procedural macros (`foo!()` style) can only be expanded to item-like items by
  default. A separate feature gate, `proc_macro_non_items`, is required to
  expand to items like expressions, statements, etc.

Closes #50038

[internals]: https://internals.rust-lang.org/t/help-stabilize-a-subset-of-macros-2-0/7252
[issue]: https://github.com/rust-lang/rust/issues/50038

6 years agofix two compile-fail tests that were still using -Zedition
Kurtis Nusbaum [Sat, 21 Apr 2018 01:51:59 +0000 (18:51 -0700)]
fix two compile-fail tests that were still using -Zedition

6 years agoAuto merge of #50056 - alexcrichton:update-cargo, r=Mark-Simulacrum
bors [Sat, 21 Apr 2018 00:50:12 +0000 (00:50 +0000)]
Auto merge of #50056 - alexcrichton:update-cargo, r=Mark-Simulacrum

Update the Cargo submodule

6 years agofix some small compile errors
Kurtis Nusbaum [Fri, 20 Apr 2018 21:47:23 +0000 (14:47 -0700)]
fix some small compile errors

6 years agoAuto merge of #50088 - alexcrichton:std-tweaks, r=sfackler
bors [Fri, 20 Apr 2018 20:40:59 +0000 (20:40 +0000)]
Auto merge of #50088 - alexcrichton:std-tweaks, r=sfackler

Tweak some stabilizations in libstd

This commit tweaks a few stable APIs in the `beta` branch before they hit
stable. The `str::is_whitespace` and `str::is_alphanumeric` functions were
deleted (added in #49381, issue at #49657). The `and_modify` APIs added
in #44734 were altered to take a `FnOnce` closure rather than a `FnMut` closure.

Closes #49581
Closes #49657

6 years agoDo not test RLS and rustfmt if build of these failed.
kennytm [Fri, 20 Apr 2018 16:53:36 +0000 (00:53 +0800)]
Do not test RLS and rustfmt if build of these failed.

Avoid a tool being simultaneously test-pass and build-fail.

6 years agoAuto merge of #50119 - kennytm:rollup, r=kennytm
bors [Fri, 20 Apr 2018 16:45:19 +0000 (16:45 +0000)]
Auto merge of #50119 - kennytm:rollup, r=kennytm

Rollup of 7 pull requests

Successful merges:

 - #50031 (Clarified E0015 message.)
 - #50058 (Added build disk usage information)
 - #50081 (Update stdsimd submodule)
 - #50083 (wasm: Increase default stack size to 1MB)
 - #50104 (Disable auto-detection of libxml2 when compiling llvm.)
 - #50114 (Fix bad merge in #49991)
 - #50117 (must explicitly request file name when using with_file_name.)

Failed merges:

6 years agoRevert "Stabilize the TryFrom and TryInto traits"
Felix S. Klock II [Fri, 20 Apr 2018 15:41:31 +0000 (17:41 +0200)]
Revert "Stabilize the TryFrom and TryInto traits"

This reverts commit e53a2a72743810e05f58c61c9d8a4c89b712ad2e.

6 years agoBring back old fallback semantics: Without feature(never_type), fallback to `()`...
Felix S. Klock II [Fri, 20 Apr 2018 15:11:28 +0000 (17:11 +0200)]
Bring back old fallback semantics: Without feature(never_type), fallback to `()`, not `!`.

Note that this commit, since it is trying to be minimal in order to
ease backporting to the beta and release channels, does *not* include
the old future-proofing warnings that we used to have associated with
such fallback to `()`; see discussion at this comment:

https://github.com/rust-lang/rust/issues/49691#issuecomment-381266730

6 years agoRevert stabilization of `feature(never_type)`.
Felix S. Klock II [Fri, 20 Apr 2018 15:07:58 +0000 (17:07 +0200)]
Revert stabilization of `feature(never_type)`.

This commit is just covering the feature gate itself and the tests
that made direct use of `!` and thus need to opt back into the
feature.

A follow on commit brings back the other change that motivates the
revert: Namely, going back to the old rules for falling back to `()`.

6 years agoRollup merge of #50117 - pnkfelix:fix-issue-50113, r=oli-obk
kennytm [Fri, 20 Apr 2018 15:45:44 +0000 (23:45 +0800)]
Rollup merge of #50117 - pnkfelix:fix-issue-50113, r=oli-obk

must explicitly request file name when using with_file_name.

Fix #50113

6 years agoRollup merge of #50114 - wesleywiser:patch-3, r=michaelwoerister
kennytm [Fri, 20 Apr 2018 15:45:43 +0000 (23:45 +0800)]
Rollup merge of #50114 - wesleywiser:patch-3, r=michaelwoerister

Fix bad merge in #49991

When I rebased #49991 on `master`, I messed up the merge for this line. I'm reverting this back to the way it was in f15e5c1.

r? @michaelwoerister

6 years agoRollup merge of #50104 - mixi:libxml2-llvm, r=alexcrichton
kennytm [Fri, 20 Apr 2018 15:45:42 +0000 (23:45 +0800)]
Rollup merge of #50104 - mixi:libxml2-llvm, r=alexcrichton

Disable auto-detection of libxml2 when compiling llvm.

This broke cross-compiling rustc with internal llvm (with both the host and target being executable on the machine), because llvm's build system detected libxml2 on the host, therefore auto-enabled libxml2 support, but wouldn't compile as the target didn't have libxml2 installed.

6 years agoRollup merge of #50083 - alexcrichton:increase-wasm-stack, r=michaelwoerister
kennytm [Fri, 20 Apr 2018 15:45:41 +0000 (23:45 +0800)]
Rollup merge of #50083 - alexcrichton:increase-wasm-stack, r=michaelwoerister

wasm: Increase default stack size to 1MB

This commit increases the dfeault stack size allocated to the
wasm32-unknown-unknown target to 1MB by default. Currently the default stack
size is one wasm page, or 64 kilobytes. This default stack is quite small and
has caused a stack overflow or two in the wild by accident.

The current "best practice" for fixing this is to pass `-Clink-args='-z
stack-size=$bigger'` but that's not great nor always easy to do. A default of
1MB matches more closely with other platforms where it's "pretty big" by
default.

Note that it was tested and if the users uses `-C link-args` to pass a custom
stack size that's still resepected as lld seems to take the first argument, and
where rustc is passing it will always be last.

6 years agoRollup merge of #50081 - GuillaumeGomez:stdsimd-update, r=alexcrichton
kennytm [Fri, 20 Apr 2018 15:45:39 +0000 (23:45 +0800)]
Rollup merge of #50081 - GuillaumeGomez:stdsimd-update, r=alexcrichton

Update stdsimd submodule

6 years agoRollup merge of #50058 - krk:patch-1, r=Mark-Simulacrum
kennytm [Fri, 20 Apr 2018 15:45:38 +0000 (23:45 +0800)]
Rollup merge of #50058 - krk:patch-1, r=Mark-Simulacrum

Added build disk usage information

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

6 years agoRollup merge of #50031 - krk:issue-46336, r=estebank
kennytm [Fri, 20 Apr 2018 15:45:37 +0000 (23:45 +0800)]
Rollup merge of #50031 - krk:issue-46336, r=estebank

Clarified E0015 message.

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

6 years agoUpdate the Cargo submodule
Alex Crichton [Wed, 18 Apr 2018 15:43:59 +0000 (08:43 -0700)]
Update the Cargo submodule

6 years agoFix #50113: must explicitly request file name when using with_file_name.
Felix S. Klock II [Fri, 20 Apr 2018 14:11:05 +0000 (16:11 +0200)]
Fix #50113: must explicitly request file name when using with_file_name.

6 years agoFix bad merge in #49991
Wesley Wiser [Fri, 20 Apr 2018 13:12:59 +0000 (09:12 -0400)]
Fix bad merge in #49991

When I rebased #49991 on `master`, I messed up the merge for this line. I'm reverting this back to the way it was in f15e5c1.

6 years agoAuto merge of #50062 - varkor:xpy-check-rustdoc, r=Mark-Simulacrum
bors [Fri, 20 Apr 2018 12:52:50 +0000 (12:52 +0000)]
Auto merge of #50062 - varkor:xpy-check-rustdoc, r=Mark-Simulacrum

Add rustdoc to x.py check

Modifying rustc can often cause errors in rustdoc, so it's useful to include it in the steps that are checked.

One thing that I was unsure about was when to call `clear_if_dirty` (both in this step, and in other steps in relation to this one) — we want to be sure rustdoc will always be rechecked after modifying previous steps — but does this belong in rustdoc, or the other steps?

Fixes #49917.

r? @Mark-Simulacrum

6 years agoImplement Copy for std::alloc::Layout
Simon Sapin [Fri, 20 Apr 2018 11:56:07 +0000 (13:56 +0200)]
Implement Copy for std::alloc::Layout

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

6 years agoAuto merge of #50052 - nnethercote:char_lit, r=Mark-Simulacrum
bors [Fri, 20 Apr 2018 10:40:25 +0000 (10:40 +0000)]
Auto merge of #50052 - nnethercote:char_lit, r=Mark-Simulacrum

Avoid allocating when parsing \u{...} literals.

`char_lit` uses an allocation in order to ignore '_' chars in \u{...}
literals. This patch changes it to not do that by processing the chars
more directly.

This improves various rustc-perf benchmark measurements by up to 6%,
particularly regex, futures, clap, coercions, hyper, and encoding.

rustc-perf results, on a stage 2 build with jemalloc disabled:

<details>

```
regex-check
avg: -5.4% min: -6.5% max: -2.7%
futures-check
avg: -3.5% min: -5.3% max: -1.7%
regex-opt
avg: -2.0% min: -5.1% max: -0.2%
regex
avg: -2.3% min: -5.0% max: -0.6%
futures-opt
avg: -3.0% min: -4.8% max: -1.1%
futures
avg: -3.1% min: -4.8% max: -1.3%
clap-rs-check
avg: -1.8% min: -3.5% max: -0.9%
coercions-check
avg: -2.0% min: -3.3% max: -1.0%
hyper-check
avg: -2.2% min: -3.1% max: -1.3%
hyper
avg: -1.3% min: -2.4% max: -0.3%
hyper-opt
avg: -0.9% min: -2.3% max: -0.1%
coercions
avg: -1.1% min: -2.2% max: -0.4%
encoding-check
avg: -1.7% min: -2.2% max: -0.9%
clap-rs-opt
avg: -0.7% min: -2.2% max: 0.0%
coercions-opt
avg: -1.2% min: -2.1% max: -0.3%
clap-rs
avg: -0.8% min: -1.9% max: -0.4%
encoding-opt
avg: -1.0% min: -1.9% max: -0.3%
encoding
avg: -1.1% min: -1.9% max: -0.4%
piston-image-check
avg: -0.7% min: -1.3% max: -0.3%
inflate-opt
avg: -0.3% min: -0.9% max: -0.0%
piston-image
avg: -0.3% min: -0.8% max: -0.1%
piston-image-opt
avg: -0.3% min: -0.7% max: -0.1%
syn-check
avg: -0.3% min: -0.6% max: -0.1%
deep-vector
avg: 0.1% min: -0.1% max: 0.5%
syn-opt
avg: -0.1% min: -0.4% max: 0.0%
html5ever
avg: -0.2% min: -0.4% max: -0.0%
deep-vector-check
avg: 0.0% min: -0.3% max: 0.3%
syn
avg: -0.2% min: -0.3% max: -0.1%
html5ever-check
avg: -0.3% min: -0.3% max: -0.2%
issue-46449-check
avg: -0.1% min: -0.2% max: 0.2%
html5ever-opt
avg: -0.0% min: -0.2% max: 0.1%
deep-vector-opt
avg: -0.0% min: -0.2% max: 0.1%
issue-46449-opt
avg: -0.0% min: -0.2% max: 0.1%
unify-linearly-check
avg: -0.0% min: -0.2% max: 0.1%
helloworld-check
avg: 0.0% min: -0.0% max: 0.2%
parser-check
avg: -0.0% min: -0.2% max: 0.0%
inflate
avg: 0.0% min: -0.0% max: 0.1%
tokio-webpush-simple-check
avg: -0.1% min: -0.1% max: -0.0%
regression-31157-check
avg: 0.0% min: -0.1% max: 0.1%
issue-46449
avg: 0.0% min: -0.1% max: 0.1%
tuple-stress-opt
avg: 0.0% min: -0.0% max: 0.1%
tuple-stress-check
avg: -0.0% min: -0.1% max: 0.1%
tuple-stress
avg: 0.0% min: -0.0% max: 0.1%
deeply-nested-check
avg: 0.0% min: -0.0% max: 0.1%
regression-31157
avg: -0.0% min: -0.1% max: 0.1%
deeply-nested-opt
avg: -0.0% min: -0.1% max: 0.1%
parser-opt
avg: -0.0% min: -0.1% max: 0.0%
parser
avg: 0.1% min: 0.0% max: 0.1%
tokio-webpush-simple
avg: -0.0% min: -0.1% max: 0.1%
regression-31157-opt
avg: -0.0% min: -0.1% max: 0.1%
helloworld-opt
avg: 0.0% min: -0.0% max: 0.1%
unify-linearly-opt
avg: 0.0% min: -0.0% max: 0.1%
unused-warnings-check
avg: 0.0% min: 0.0% max: 0.1%
tokio-webpush-simple-opt
avg: -0.0% min: -0.1% max: 0.0%
helloworld
avg: -0.0% min: -0.0% max: 0.1%
unused-warnings
avg: 0.0% min: -0.0% max: 0.0%
deeply-nested
avg: -0.0% min: -0.0% max: -0.0%
unused-warnings-opt
avg: 0.0% min: -0.0% max: 0.0%
unify-linearly
avg: 0.0% min: -0.0% max: 0.0%
inflate-check
avg: 0.0% min: -0.0% max: 0.0%
```

</details>

6 years agoDisable auto-detection of libxml2 when compiling llvm.
Johannes Nixdorf [Mon, 16 Apr 2018 17:32:19 +0000 (19:32 +0200)]
Disable auto-detection of libxml2 when compiling llvm.

6 years agoAuto merge of #49991 - wesleywiser:remove_hir_inlining, r=michaelwoerister
bors [Fri, 20 Apr 2018 08:22:47 +0000 (08:22 +0000)]
Auto merge of #49991 - wesleywiser:remove_hir_inlining, r=michaelwoerister

Remove HIR inlining

Fixes #49690

r? @michaelwoerister

6 years agoAuto merge of #50069 - alexcrichton:fix-proc-macro, r=nrc
bors [Fri, 20 Apr 2018 05:34:17 +0000 (05:34 +0000)]
Auto merge of #50069 - alexcrichton:fix-proc-macro, r=nrc

proc_macro: Stay on the "use the cache" path more

Discovered in #50061 we're falling off the "happy path" of using a stringified
token stream more often than we should. This was due to the fact that a
user-written token like `0xf` is equality-different from the stringified token
of `15` (despite being semantically equivalent).

This patch updates the call to `eq_unspanned` with an even more awful solution,
`probably_equal_for_proc_macro`, which ignores the value of each token and
basically only compares the structure of the token stream, assuming that the AST
doesn't change just one token at a time.

While this is a step towards fixing #50061 there is still one regression
from #49154 which needs to be fixed.

6 years agoadd EDITIONS_NAME_LIST, make edition tracked, enforce that only stable editions are...
Kurtis Nusbaum [Fri, 20 Apr 2018 04:03:21 +0000 (21:03 -0700)]
add EDITIONS_NAME_LIST, make edition tracked, enforce that only stable editions are allowed to be used on non-nightly builds

6 years agoAuto merge of #50051 - nnethercote:no-env-var, r=Mark-Simulacrum
bors [Fri, 20 Apr 2018 01:41:34 +0000 (01:41 +0000)]
Auto merge of #50051 - nnethercote:no-env-var, r=Mark-Simulacrum

Lazily evaluate EvalErrorKind::*.into() calls.

eval_context.rs calls `ok_or` in multiple places with an eagerly
evaluated `EvalErrorKind::*.into()` argument, which calls
EvalError::from(), which calls env::var("MIRI_BACKTRACE"), which
allocates a String. This code is hot enough for this to have a
measurable effect on some benchmarks.

This patch changes the `ok_or` calls into `ok_or_else`, thus avoiding
the evaluations when they're not needed. As a result, most of the
rustc-perf benchmarks get a measurable speedup, particularly the
shorter-running ones, where the improvement is as high as 6%.

Output from rustc-perf, comparing stage 2 builds with jemalloc disabled:

<details>

```
coercions
avg: -1.8% min: -6.0% max: -0.0%
helloworld-opt
avg: -3.7% min: -4.0% max: -3.4%
helloworld
avg: -3.7% min: -3.9% max: -3.5%
parser
avg: -3.5% min: -3.9% max: -3.1%
unify-linearly-opt
avg: -3.2% min: -3.8% max: -2.8%
unify-linearly
avg: -3.2% min: -3.7% max: -2.8%
parser-opt
avg: -3.2% min: -3.6% max: -2.8%
clap-rs
avg: -0.9% min: -3.6% max: 0.1%
encoding
avg: -1.9% min: -3.0% max: -1.2%
clap-rs-opt
avg: -0.8% min: -2.7% max: -0.1%
helloworld-check
avg: -1.9% min: -2.2% max: -1.7%
deeply-nested-check
avg: -1.4% min: -2.1% max: -0.9%
issue-46449-opt
avg: -0.7% min: -2.0% max: -0.3%
unify-linearly-check
avg: -1.5% min: -1.9% max: -1.2%
issue-46449
avg: -1.0% min: -1.8% max: -0.8%
deeply-nested-opt
avg: -0.7% min: -1.7% max: -0.2%
deeply-nested
avg: -1.0% min: -1.6% max: -0.6%
parser-check
avg: -1.3% min: -1.6% max: -0.8%
encoding-check
avg: -1.5% min: -1.6% max: -1.2%
tuple-stress
avg: -0.9% min: -1.5% max: 0.0%
tuple-stress-opt
avg: -1.0% min: -1.5% max: -0.3%
issue-46449-check
avg: -1.3% min: -1.4% max: -1.0%
encoding-opt
avg: -1.1% min: -1.2% max: -0.9%
regression-31157
avg: -0.7% min: -1.2% max: -0.2%
regression-31157-check
avg: -0.8% min: -1.2% max: -0.5%
futures-check
avg: -0.8% min: -1.2% max: -0.4%
unused-warnings-opt
avg: -1.0% min: -1.2% max: -0.9%
unused-warnings
avg: -1.0% min: -1.1% max: -0.9%
coercions-opt
avg: -0.6% min: -1.0% max: -0.2%
inflate-check
avg: -0.4% min: -0.9% max: -0.1%
regex-check
avg: -0.8% min: -0.9% max: -0.5%
piston-image-check
avg: -0.8% min: -0.9% max: -0.8%
deep-vector
avg: -0.3% min: -0.9% max: 0.1%
futures
avg: -0.5% min: -0.8% max: -0.2%
futures-opt
avg: -0.5% min: -0.7% max: -0.1%
html5ever
avg: -0.6% min: -0.7% max: -0.4%
tokio-webpush-simple-check
avg: -0.2% min: -0.7% max: 0.1%
piston-image-opt
avg: -0.3% min: -0.7% max: -0.1%
regex
avg: -0.4% min: -0.7% max: -0.1%
piston-image
avg: -0.4% min: -0.7% max: -0.2%
regex-opt
avg: -0.3% min: -0.7% max: 0.1%
tokio-webpush-simple-opt
avg: -0.2% min: -0.6% max: 0.0%
coercions-check
avg: -0.3% min: -0.6% max: -0.1%
hyper
avg: -0.4% min: -0.6% max: -0.2%
syn-opt
avg: -0.3% min: -0.6% max: -0.0%
hyper-check
avg: -0.5% min: -0.6% max: -0.3%
syn-check
avg: -0.4% min: -0.5% max: -0.2%
hyper-opt
avg: -0.3% min: -0.5% max: -0.1%
html5ever-opt
avg: -0.3% min: -0.5% max: -0.2%
syn
avg: -0.2% min: -0.4% max: -0.1%
deep-vector-opt
avg: -0.2% min: -0.4% max: 0.1%
tokio-webpush-simple
avg: -0.2% min: -0.4% max: -0.1%
inflate
avg: -0.2% min: -0.4% max: -0.1%
inflate-opt
avg: -0.2% min: -0.4% max: -0.0%
regression-31157-opt
avg: -0.1% min: -0.4% max: 0.0%
html5ever-check
avg: -0.3% min: -0.4% max: -0.2%
unused-warnings-check
avg: -0.2% min: -0.3% max: -0.2%
script-servo-check
avg: -0.1% min: -0.3% max: 0.0%
crates.io-check
avg: -0.2% min: -0.3% max: -0.0%
script-servo
avg: -0.1% min: -0.2% max: 0.0%
clap-rs-check
avg: 0.0% min: -0.1% max: 0.2%
deep-vector-check
avg: -0.0% min: -0.2% max: 0.2%
tuple-stress-check
avg: -0.1% min: -0.2% max: 0.0%
crates.io-opt
avg: -0.1% min: -0.2% max: 0.0%
crates.io
avg: -0.1% min: -0.2% max: -0.0%
script-servo-opt
avg: -0.0% min: -0.1% max: 0.0%
```

</details>

6 years agoRemove HIR inlining
Wesley Wiser [Sun, 15 Apr 2018 23:41:33 +0000 (19:41 -0400)]
Remove HIR inlining

Fixes #49690

6 years agoTweak some stabilizations in libstd
Alex Crichton [Thu, 19 Apr 2018 22:52:14 +0000 (15:52 -0700)]
Tweak some stabilizations in libstd

This commit tweaks a few stable APIs in the `beta` branch before they hit
stable. The `str::is_whitespace` and `str::is_alphanumeric` functions were
deleted (added in #49381, issue at #49657). The `and_modify` APIs added
in #44734 were altered to take a `FnOnce` closure rather than a `FnMut` closure.

Closes #49581
Closes #49657

6 years agoAuto merge of #48553 - seanmonstar:atomic-debug, r=alexcrichton
bors [Thu, 19 Apr 2018 23:08:16 +0000 (23:08 +0000)]
Auto merge of #48553 - seanmonstar:atomic-debug, r=alexcrichton

atomic: remove 'Atomic*' from Debug output

For the same reason that we don't show `Vec { data: [0, 1, 2, 3] }`, but just the array, the `AtomicUsize(1000)` is noisy, and seeing just `1000` is likely better.

6 years agowasm: Increase default stack size to 1MB
Alex Crichton [Thu, 19 Apr 2018 21:51:59 +0000 (14:51 -0700)]
wasm: Increase default stack size to 1MB

This commit increases the dfeault stack size allocated to the
wasm32-unknown-unknown target to 1MB by default. Currently the default stack
size is one wasm page, or 64 kilobytes. This default stack is quite small and
has caused a stack overflow or two in the wild by accident.

The current "best practice" for fixing this is to pass `-Clink-args='-z
stack-size=$bigger'` but that's not great nor always easy to do. A default of
1MB matches more closely with other platforms where it's "pretty big" by
default.

Note that it was tested and if the users uses `-C link-args` to pass a custom
stack size that's still resepected as lld seems to take the first argument, and
where rustc is passing it will always be last.

6 years agoUpdate stdsimd submodule
Guillaume Gomez [Thu, 19 Apr 2018 21:47:28 +0000 (23:47 +0200)]
Update stdsimd submodule

6 years agoadd --edition option
Kurtis Nusbaum [Thu, 19 Apr 2018 20:56:26 +0000 (13:56 -0700)]
add --edition option

6 years agoEnsure CleanTools is run for check rustdoc
varkor [Wed, 18 Apr 2018 23:45:18 +0000 (00:45 +0100)]
Ensure CleanTools is run for check rustdoc

6 years agoAdd rustdoc to x.py check
varkor [Wed, 18 Apr 2018 18:46:58 +0000 (19:46 +0100)]
Add rustdoc to x.py check

This can often encounter errors after modifying rustc, so it's useful to include it in the steps that are checked.

6 years agoAuto merge of #50020 - oli-obk:clippy, r=Manishearth
bors [Thu, 19 Apr 2018 16:39:57 +0000 (16:39 +0000)]
Auto merge of #50020 - oli-obk:clippy, r=Manishearth

Update clippy

r? @Manishearth

6 years agoFix Iter exhaustion in prove_predicates when debug is on
Santiago Pastorino [Thu, 19 Apr 2018 15:39:43 +0000 (12:39 -0300)]
Fix Iter exhaustion in prove_predicates when debug is on

ht @tamird

6 years agoAuto merge of #49900 - pnkfelix:compare-mode-nll-followup-3, r=nikomatsakis
bors [Thu, 19 Apr 2018 11:13:10 +0000 (11:13 +0000)]
Auto merge of #49900 - pnkfelix:compare-mode-nll-followup-3, r=nikomatsakis

Add src/test/ui regression testing for NLL

This PR changes `x.py test` so that when you are running the `ui` test suite, it will also always run `compiletest` in the new `--compare-mode=nll`, which just double-checks that when running under the experimental NLL mode, the output matches the `<source-name>.nll.stderr` file, if present.

In order to reduce the chance of a developer revolt in response to this change, this PR also includes some changes to make the `--compare-mode=nll` more user-friendly:

 1. It now generates nll-specific .stamp files, and uses them (so that repeated runs can reuse previously cached results).
 2. Each line of terminal output distinguishes whether we are running under `--compare-mode=nll` by printing with the prefix `[ui (nll)]` instead of just the prefix `[ui]`.

Subtask of rust-lang/rust#48879

6 years agoAuto merge of #49949 - oli-obk:const_signed_pat, r=eddyb
bors [Thu, 19 Apr 2018 08:41:35 +0000 (08:41 +0000)]
Auto merge of #49949 - oli-obk:const_signed_pat, r=eddyb

Sign extend constants in range patterns

fixes  #49940

r? @Mark-Simulacrum

6 years agoSign extend constants in range patterns
Oliver Schneider [Fri, 13 Apr 2018 16:31:15 +0000 (18:31 +0200)]
Sign extend constants in range patterns

6 years agoUpdate clippy
Oliver Schneider [Tue, 17 Apr 2018 06:50:56 +0000 (08:50 +0200)]
Update clippy

6 years agoAuto merge of #49890 - varkor:xpy-check-rustc_trans, r=alexcrichton
bors [Thu, 19 Apr 2018 06:19:27 +0000 (06:19 +0000)]
Auto merge of #49890 - varkor:xpy-check-rustc_trans, r=alexcrichton

Add rustc_trans to x.py check

r? @Mark-Simulacrum

I looked at `bootstrap/compile.rs` and `bootstrap/check.rs` to try to work out which steps were appropriate, but I'm sure I've overlooked some details here, so it's worth checking carefully I've got all the steps right (e.g. I wasn't sure whether we want to build LLVM if necessary with `x.py check`, though I thought it was probably better to than to not).

From a quick test, it seems to be working, though.

6 years agoAuto merge of #49630 - npmccallum:shl, r=alexcrichton
bors [Thu, 19 Apr 2018 03:53:32 +0000 (03:53 +0000)]
Auto merge of #49630 - npmccallum:shl, r=alexcrichton

Update Rhs on ShlAssign to default to Self

This matches the behavior on ShrAssign and all other *Assign operations.

6 years agoproc_macro: Stay on the "use the cache" path more
Alex Crichton [Thu, 19 Apr 2018 02:36:48 +0000 (19:36 -0700)]
proc_macro: Stay on the "use the cache" path more

Discovered in #50061 we're falling off the "happy path" of using a stringified
token stream more often than we should. This was due to the fact that a
user-written token like `0xf` is equality-different from the stringified token
of `15` (despite being semantically equivalent).

This patch updates the call to `eq_unspanned` with an even more awful solution,
`probably_equal_for_proc_macro`, which ignores the value of each token and
basically only compares the structure of the token stream, assuming that the AST
doesn't change just one token at a time.

While this is a step towards fixing #50061 there is still one regression
from #49154 which needs to be fixed.

6 years agoAuto merge of #50048 - glandium:issue50041, r=eddyb
bors [Thu, 19 Apr 2018 01:13:29 +0000 (01:13 +0000)]
Auto merge of #50048 - glandium:issue50041, r=eddyb

rustc_trans: also check dominators for SSA values in mir::analyze

Fixes #50041

6 years agoAvoid allocating when parsing \u{...} literals.
Nicholas Nethercote [Wed, 18 Apr 2018 04:09:27 +0000 (14:09 +1000)]
Avoid allocating when parsing \u{...} literals.

`char_lit` uses an allocation in order to ignore '_' chars in \u{...}
literals. This patch changes it to not do that by processing the chars
more directly.

This improves various rustc-perf benchmark measurements by up to 6%,
particularly regex, futures, clap, coercions, hyper, and encoding.

6 years agoAdd rerun-if-env-changed=RUST_CHECK to librustc_llvm
varkor [Wed, 18 Apr 2018 23:09:41 +0000 (00:09 +0100)]
Add rerun-if-env-changed=RUST_CHECK to librustc_llvm

6 years agoLazily evaluate EvalErrorKind::*.into() calls.
Nicholas Nethercote [Wed, 18 Apr 2018 22:56:27 +0000 (08:56 +1000)]
Lazily evaluate EvalErrorKind::*.into() calls.

eval_context.rs calls `ok_or` in multiple places with an eagerly
evaluated `EvalErrorKind::*.into()` argument, which calls
EvalError::from(), which calls env::var("MIRI_BACKTRACE"), which
allocates a String. This code is hot enough for this to have a
measurable effect on some benchmarks.

This patch changes the `ok_or` calls into `ok_or_else`, thus avoiding
the evaluations when they're not needed. As a result, most of the
rustc-perf benchmarks get a measurable speedup, particularly the
shorter-running ones, where the improvement is as high as 6%.

6 years agoAuto merge of #50022 - nrc:doc-analysis, r=mark-simulacrum
bors [Wed, 18 Apr 2018 22:30:00 +0000 (22:30 +0000)]
Auto merge of #50022 - nrc:doc-analysis, r=mark-simulacrum

Only emit save-analysis data for `cargo build` tasks

Previously, we were emittinng analysis data for all tasks, including `doc`. That meant we got two sets of save-analysis data, one from the normal build and one from the docs. That means indexing with the RLS took twice as long and made downloads larger and build times longer.

cc https://github.com/rust-lang-nursery/rls/issues/826

r? @Mark-Simulacrum

6 years agofix my unit test that was horrendously wrong
Michael Lamparski [Wed, 18 Apr 2018 20:48:34 +0000 (16:48 -0400)]
fix my unit test that was horrendously wrong

and add one for non-mut slicing since I touched that method too

6 years agoAuto merge of #50017 - tinaun:stabilize-all-the-things, r=sfackler
bors [Wed, 18 Apr 2018 19:47:56 +0000 (19:47 +0000)]
Auto merge of #50017 - tinaun:stabilize-all-the-things, r=sfackler

stabilize a bunch of minor api additions

besides `ptr::NonNull::cast` (which is 4 days away from end of FCP) all of these have been finished with FCP for a few weeks now with minimal issues raised

* Closes #41020
* Closes #42818
* Closes #44030
* Closes #44400
* Closes #46507
* Closes #47653
* Closes #46344

the following functions will be stabilized in 1.27:
* `[T]::rsplit`
* `[T]::rsplit_mut`
* `[T]::swap_with_slice`
* `ptr::swap_nonoverlapping`
* `NonNull::cast`
* `Duration::from_micros`
* `Duration::from_nanos`
* `Duration::subsec_millis`
* `Duration::subsec_micros`
* `HashMap::remove_entry`

6 years agoAuto merge of #50006 - rcoh:reorder-compiler-builtins, r=oli-obk
bors [Wed, 18 Apr 2018 17:07:21 +0000 (17:07 +0000)]
Auto merge of #50006 - rcoh:reorder-compiler-builtins, r=oli-obk

Reorder injection of std to get better compilation error

Per #49851, reorder injection imports to get a better error message.

r? @oli-obk

6 years agoAdded build disk usage information
Kerem [Wed, 18 Apr 2018 17:06:05 +0000 (20:06 +0300)]
Added build disk usage information

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

6 years agoAuto merge of #49993 - nnethercote:shrink-Token, r=alexcrichton
bors [Wed, 18 Apr 2018 14:44:54 +0000 (14:44 +0000)]
Auto merge of #49993 - nnethercote:shrink-Token, r=alexcrichton

Change the hashcounts in raw `Lit` variants from usize to u16.

This reduces the size of `Token` from 32 bytes to 24 bytes on 64-bit
platforms.

6 years agoWhen running under compare-mode=nll, generate expected output to `foo.nll.stderr`
Felix S. Klock II [Wed, 18 Apr 2018 12:41:29 +0000 (14:41 +0200)]
When running under compare-mode=nll, generate expected output to `foo.nll.stderr`

This allows easy revision of the update-references.sh script (included
here) so that it can update the expected output for nll rather than
stderr. It also reminds the rustc developer via the filename that they
are looking at output generated under comapre-mode=nll.

One could argue that there is still a problem with the strategy encoded here:
if we reach a scenario where a change to the compiler brings the output
under AST and NLL modes back into sync, this code will continue to still
generate output to distinct `foo.stderr` and `foo.nll.stderr` files, and
will continue to copy those two files back to corresponding distinct
files in the source tree, even if the *content* of the two files is now the
same.

  * Arguably the "right thing" to do in that case is to remove the
    `foo.nll.stderr` file entirely.

  * However, I think the real answer is that we will probably want to
    double-check such cases by hand anyway. We should be regularly
    double-checking the diffs between `foo.stderr` and
    `foo.nll.stderr`, and if we see a zero-diff case, then we should
    evaluate whether that is correct, and if so, remove the file by
    hand.)

  * In any case, I think the default behavior encoded here (or at
    least *intended* to be encoded here) is superior to the
    alternative of *only* generating a `foo.nll.stderr` file if one
    already existed in the source tree at the time that `compiletest`
    was invoked (and otherwise unconditionally generating a
    `foo.stderr` file, as was the behavior prior to this commit),
    because that alternative is more likely to cause rustc developers
    to overwrite a `foo.stderr` file with the stderr output from a
    compare-mode=nll run, which will then break the *normal*
    `compiletest` run and probably be much more confusing for the
    average rustc developer.

6 years agoWorkaround rust-lang/rust#49998 by opting into experimental `-Z nll-subminimal-causes...
Felix S. Klock II [Wed, 18 Apr 2018 12:27:58 +0000 (14:27 +0200)]
Workaround rust-lang/rust#49998 by opting into experimental `-Z nll-subminimal-causes` flag

This commit only applies the flag to the one test case,
ui/span/dropck_vec_cycle_checked.rs, that absolutely needs it. Without
the flag, that test takes an unknown amount of time (greater than 1
minute) to compile. But its possible that other tests would also
benefit from the flag, and we may want to make it the default (after
evaluating its impact on other tests).

In terms of its known impact on other tests, I have only evaluated the
ui tests, and the *only* ui test I have found that the flag impacts
(running under NLL mode, of course), is src/test/ui/nll/issue-31567.rs

In particular:

```
% ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/nll/issue-31567.rs
error[E0597]: `*v.0` does not live long enough
  --> ../src/test/ui/nll/issue-31567.rs:22:26
   |
22 |     let s_inner: &'a S = &*v.0; //~ ERROR `*v.0` does not live long enough
   |                          ^^^^^ borrowed value does not live long enough
23 |     &s_inner.0
24 | }
   | - borrowed value only lives until here
   |
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 21:1...
  --> ../src/test/ui/nll/issue-31567.rs:21:1
   |
21 | fn get_dangling<'a>(v: VecWrapper<'a>) -> &'a u32 {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0597`.
% ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/nll/issue-31567.rs  -Z nll-subminimal-causes
error[E0597]: `*v.0` does not live long enough
  --> ../src/test/ui/nll/issue-31567.rs:22:26
   |
22 |     let s_inner: &'a S = &*v.0; //~ ERROR `*v.0` does not live long enough
   |                          ^^^^^ borrowed value does not live long enough
23 |     &s_inner.0
24 | }
   | -
   | |
   | borrowed value only lives until here
   | borrow later used here, when `v` is dropped

error: aborting due to previous error

For more information about this error, try `rustc --explain E0597`.
%
```

6 years agoWork around rust-lang/rust#49998 with experimental code that does less updating of...
Felix S. Klock II [Wed, 18 Apr 2018 12:22:08 +0000 (14:22 +0200)]
Work around rust-lang/rust#49998 with experimental code that does less updating of cause map.

This seems to avoid poor scaling on src/test/ui/span/dropck_vec_cycle_checked.rs

6 years agoRemoved `.nll.stderr` files that currently match their corresponding `.stderr` files.
Felix S. Klock II [Wed, 18 Apr 2018 13:30:38 +0000 (15:30 +0200)]
Removed `.nll.stderr` files that currently match their corresponding `.stderr` files.

6 years agoTrivial updates to `.nll.stderr` files post-rebase, reflecting s/-Znll/nll/ in messages.
Felix S. Klock II [Wed, 18 Apr 2018 13:34:31 +0000 (15:34 +0200)]
Trivial updates to `.nll.stderr` files post-rebase, reflecting s/-Znll/nll/ in messages.

6 years agoUpdate the previously checkpointed (but unused by bors) tests to reflect current...
Felix S. Klock II [Thu, 12 Apr 2018 10:25:29 +0000 (12:25 +0200)]
Update the previously checkpointed (but unused by bors) tests to reflect current reality.