]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #68994 - Keruspe:sanitizers-conflict, r=Mark-Simulacrum
Dylan DPC [Wed, 12 Feb 2020 13:21:08 +0000 (14:21 +0100)]
Rollup merge of #68994 - Keruspe:sanitizers-conflict, r=Mark-Simulacrum

rustbuild: include channel in sanitizers installed name

Allows parallel install of different rust channels.

I'm not sure if the channel is the right thing to use there, but currently both beta and nightly try to install e.g. `/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_rt.asan.a` when before (and in current stable) it used to be `/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_asan-45a4390180e83d28.rlib` which contained a hash, making it unique.
With this patch, `/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-nightly_rt.asan.a` gets installed

4 years agoRollup merge of #68914 - nnethercote:speed-up-SipHasher128, r=michaelwoerister
Dylan DPC [Wed, 12 Feb 2020 13:21:06 +0000 (14:21 +0100)]
Rollup merge of #68914 - nnethercote:speed-up-SipHasher128, r=michaelwoerister

Speed up `SipHasher128`.

The current code in `SipHasher128::short_write` is inefficient. It uses
`u8to64_le` (which is complex and slow) to extract just the right number of
bytes of the input into a u64 and pad the result with zeroes. It then
left-shifts that value in order to bitwise-OR it with `self.tail`.

For example, imagine we have a u32 input `0xIIHH_GGFF` and only need three bytes
to fill up `self.tail`. The current code uses `u8to64_le` to construct
`0x0000_0000_00HH_GGFF`, which is just `0xIIHH_GGFF` with the `0xII` removed and
zero-extended to a u64. The code then left-shifts that value by five bytes --
discarding the `0x00` byte that replaced the `0xII` byte! -- to give
`0xHHGG_FF00_0000_0000`. It then then ORs that value with `self.tail`.

There's a much simpler way to do it: zero-extend to u64 first, then left shift.
E.g. `0xIIHH_GGFF` is zero-extended to `0x0000_0000_IIHH_GGFF`, and then
left-shifted to `0xHHGG_FF00_0000_0000`. We don't have to take time to exclude
the unneeded `0xII` byte, because it just gets shifted out anyway! It also avoids
multiple occurrences of `unsafe`.

There's a similar story with the setting of `self.tail` at the method's end.
The current code uses `u8to64_le` to extract the remaining part of the input,
but the same effect can be achieved more quickly with a right shift on the
zero-extended input.

This commit changes `SipHasher128` to use the simpler shift-based approach. The
code is also smaller, which means that `short_write` is now inlined where
previously it wasn't, which makes things faster again. This gives big
speed-ups for all incremental builds, especially "baseline" incremental
builds.

r? @michaelwoerister

4 years agoRollup merge of #67585 - ranma42:fix/char-is-ascii-codegen, r=Amanieu
Dylan DPC [Wed, 12 Feb 2020 13:21:05 +0000 (14:21 +0100)]
Rollup merge of #67585 - ranma42:fix/char-is-ascii-codegen, r=Amanieu

Improve `char::is_ascii_*` codegen

This PR is an attempt to fix https://github.com/rust-lang/rust/issues/65127

A couple of warnings:
 1. the generated code might be further improved (in LLVM and/or MIR) by emitting better comparison sequences; in particular, this would improve the performance of "complex" checks such as those in `is_ascii_punctuation`
 2. the second commit is currently marked "DO NOT MERGE", because it regresses SIMD on `u8` slices; this could likely be fixed by improving the computation/usage of demanded bits in LLVM

An alternative approach to remove the code duplication might be the use of macros, but currently most of the duplication is actually in the doc comments, so maybe just keeping the redundancy could be ok

4 years agoAuto merge of #69088 - JohnTitor:rollup-x7bk7h7, r=JohnTitor
bors [Wed, 12 Feb 2020 10:10:15 +0000 (10:10 +0000)]
Auto merge of #69088 - JohnTitor:rollup-x7bk7h7, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #67695 (Added dyn and true keyword docs)
 - #68487 ([experiment] Support linking from a .rlink file)
 - #68554 (Split lang_items to crates `rustc_hir` and `rustc_passes`.)
 - #68937 (Test failure of unchecked arithmetic intrinsics in const eval)
 - #68947 (Python script PEP8 style guide space formatting and minor Python source cleanup)
 - #68999 (remove dependency on itertools)
 - #69026 (Remove common usage pattern from `AllocRef`)
 - #69027 (Add missing `_zeroed` varants to `AllocRef`)
 - #69058 (Preparation for allocator aware `Box`)
 - #69070 (Add self to .mailmap)
 - #69077 (Fix outdated doc comment.)

Failed merges:

r? @ghost

4 years agoRollup merge of #69077 - jumbatm:fix-comment, r=Dylan-DPC
Yuki Okushi [Wed, 12 Feb 2020 09:55:51 +0000 (18:55 +0900)]
Rollup merge of #69077 - jumbatm:fix-comment, r=Dylan-DPC

Fix outdated doc comment.

r? @RalfJung

4 years agoRollup merge of #69070 - Bassetts:master, r=alexcrichton
Yuki Okushi [Wed, 12 Feb 2020 09:55:49 +0000 (18:55 +0900)]
Rollup merge of #69070 - Bassetts:master, r=alexcrichton

Add self to .mailmap

4 years agoRollup merge of #69058 - TimDiekmann:box, r=Amanieu
Yuki Okushi [Wed, 12 Feb 2020 09:55:48 +0000 (18:55 +0900)]
Rollup merge of #69058 - TimDiekmann:box, r=Amanieu

Preparation for allocator aware `Box`

This cleans up the `Box` code a bit, and uses `Box::from_raw(ptr)` instead of `Box(ptr)`.
Additionally, `box_free` and `exchange_malloc` now uses the `AllocRef` trait and a comment was added on how `box_free` is tied to `Box`.

This a preparation for an upcoming PR, which makes `Box` aware of an allocator.

r? @Amanieu

4 years agoRollup merge of #69027 - TimDiekmann:zeroed-alloc, r=Amanieu
Yuki Okushi [Wed, 12 Feb 2020 09:55:46 +0000 (18:55 +0900)]
Rollup merge of #69027 - TimDiekmann:zeroed-alloc, r=Amanieu

Add missing `_zeroed` varants to `AllocRef`

The majority of the allocator wg has decided to add the missing `_zeroed` variants to `AllocRef`:

> these should be added since they can be efficiently implemented with the `mremap` system call on Linux. `mremap` allows you to move/grow/shrink a memory mapping, and any new pages added for growth are guaranteed to be zeroed.
>
> If `AllocRef` does not have these methods then the user will have to manually write zeroes to the added memory since the API makes no guarantees on their contents.

For the full discussion please see https://github.com/rust-lang/wg-allocators/issues/14.

This PR provides default implementations for `realloc_zeroed`, `alloc_excess_zeroed`, `realloc_excess_zeroed`, and `grow_in_place_zeroed`.

r? @Amanieu

4 years agoRollup merge of #69026 - TimDiekmann:common-usage, r=Amanieu
Yuki Okushi [Wed, 12 Feb 2020 09:55:44 +0000 (18:55 +0900)]
Rollup merge of #69026 - TimDiekmann:common-usage, r=Amanieu

Remove common usage pattern from `AllocRef`

This removes the common usage patterns from `AllocRef`:
- `alloc_one`
- `dealloc_one`
- `alloc_array`
- `realloc_array`
- `dealloc_array`

Actually, they add nothing to `AllocRef` except a [convenience wrapper around `Layout` and other methods in this trait](https://doc.rust-lang.org/1.41.0/src/core/alloc.rs.html#1076-1240) but have a major flaw: The documentation of `AllocRefs` notes, that

> some higher-level allocation methods (`alloc_one`, `alloc_array`) are well-defined on zero-sized types and can optionally support them: it is left up to the implementor whether to return `Err`, or to return `Ok` with some pointer.

With the current API, `GlobalAlloc` does not have those methods, so they cannot be overridden for `liballoc::Global`, which means that even if the global allocator would support zero-sized allocations, `alloc_one`, `alloc_array`, and `realloc_array` for `liballoc::Global` will error, while calling `alloc` with a zeroed-size `Layout` could succeed. Even worse: allocating with `alloc` and deallocating with `dealloc_{one,array}` could end up with not calling `dealloc` at all!

For the full discussion please see https://github.com/rust-lang/wg-allocators/issues/18

r? @Amanieu

4 years agoRollup merge of #68999 - andjo403:itertools, r=Centril
Yuki Okushi [Wed, 12 Feb 2020 09:55:42 +0000 (18:55 +0900)]
Rollup merge of #68999 - andjo403:itertools, r=Centril

remove dependency on itertools

r? @Centril

4 years agoRollup merge of #68947 - chrissimpkins:python-fmt, r=alexcrichton
Yuki Okushi [Wed, 12 Feb 2020 09:55:41 +0000 (18:55 +0900)]
Rollup merge of #68947 - chrissimpkins:python-fmt, r=alexcrichton

Python script PEP8 style guide space formatting and minor Python source cleanup

This PR includes the following changes in the Python sources based on a flake8 3.7.9 (mccabe: 0.6.1, pycodestyle: 2.5.0, pyflakes: 2.1.1) CPython 3.7.6 on Darwin lint:

- PEP8 style guide spacing updates *without* line length changes
- removal of unused local variable assignments in context managers and exception handling
- removal of unused Python import statements
- removal of unnecessary semicolons

4 years agoRollup merge of #68937 - ecstatic-morse:unchecked-intrinsics-test, r=RalfJung
Yuki Okushi [Wed, 12 Feb 2020 09:55:39 +0000 (18:55 +0900)]
Rollup merge of #68937 - ecstatic-morse:unchecked-intrinsics-test, r=RalfJung

Test failure of unchecked arithmetic intrinsics in const eval

Test that the unchecked arithmetic intrinsics that were made unstably const in #68809 emit an error during const-eval if given invalid input.

Addresses [this comment](https://github.com/rust-lang/rust/pull/68809#discussion_r375753066).

r? @RalfJung

4 years agoRollup merge of #68554 - cjgillot:lang_items, r=Zoxc
Yuki Okushi [Wed, 12 Feb 2020 09:55:37 +0000 (18:55 +0900)]
Rollup merge of #68554 - cjgillot:lang_items, r=Zoxc

Split lang_items to crates `rustc_hir` and `rustc_passes`.

As discussed in comment https://github.com/rust-lang/rust/pull/67688#discussion_r368289946

4 years agoRollup merge of #68487 - 0dvictor:nolink, r=tmandry
Yuki Okushi [Wed, 12 Feb 2020 09:55:36 +0000 (18:55 +0900)]
Rollup merge of #68487 - 0dvictor:nolink, r=tmandry

[experiment] Support linking from a .rlink file

Flag `-Z no-link` was previously introduced, which allows creating an `.rlink` file to perform compilation without linking. This change enables linking from an `.rlink` file.

Part of Issue #64191

4 years agoRollup merge of #67695 - gilescope:truth, r=centril
Yuki Okushi [Wed, 12 Feb 2020 09:55:34 +0000 (18:55 +0900)]
Rollup merge of #67695 - gilescope:truth, r=centril

Added dyn and true keyword docs

r? @Centril

4 years agoAuto merge of #68998 - lzutao:clippyup, r=Manishearth
bors [Wed, 12 Feb 2020 07:05:15 +0000 (07:05 +0000)]
Auto merge of #68998 - lzutao:clippyup, r=Manishearth

Update clippy

Closes #68901

4 years agoAuto merge of #68823 - matthiaskrgr:submodule_upd, r=ehuss
bors [Wed, 12 Feb 2020 01:47:01 +0000 (01:47 +0000)]
Auto merge of #68823 - matthiaskrgr:submodule_upd, r=ehuss

submodules: update cargo

4 years agoUpdate clippy
Lzu Tao [Wed, 12 Feb 2020 01:25:41 +0000 (02:25 +0100)]
Update clippy

4 years agoImprove `u8to64_le`.
Nicholas Nethercote [Tue, 11 Feb 2020 23:36:29 +0000 (10:36 +1100)]
Improve `u8to64_le`.

This makes it faster and also changes it to a safe function. (Thanks to
Michael Woerister for the suggestion.) `load_int_le!` is also no longer
necessary.

4 years agoFix outdated doc comment.
jumbatm [Tue, 11 Feb 2020 22:37:06 +0000 (08:37 +1000)]
Fix outdated doc comment.

4 years agoTest failure of unchecked arithmetic intrinsics in const eval
Dylan MacKenzie [Mon, 10 Feb 2020 19:46:51 +0000 (11:46 -0800)]
Test failure of unchecked arithmetic intrinsics in const eval

4 years agoReview comments.
Camille GILLOT [Tue, 11 Feb 2020 22:21:21 +0000 (23:21 +0100)]
Review comments.

4 years agoMerge rustc::middle::*lang_items.
Camille GILLOT [Thu, 30 Jan 2020 07:53:34 +0000 (08:53 +0100)]
Merge rustc::middle::*lang_items.

4 years agoMove it all into rustc_hir.
Camille GILLOT [Thu, 30 Jan 2020 00:24:51 +0000 (01:24 +0100)]
Move it all into rustc_hir.

4 years agoNits.
Camille GILLOT [Sun, 26 Jan 2020 21:43:35 +0000 (22:43 +0100)]
Nits.

4 years agoMove weak_lang_items checking to librustc_passes.
Camille GILLOT [Sat, 28 Dec 2019 17:31:37 +0000 (18:31 +0100)]
Move weak_lang_items checking to librustc_passes.

4 years agoMove weak_lang_items.rs to librustc_passes.
Camille GILLOT [Wed, 1 Jan 2020 16:09:29 +0000 (17:09 +0100)]
Move weak_lang_items.rs to librustc_passes.

4 years agoMove weak lang items to librustc_lang_items.
Camille GILLOT [Sun, 26 Jan 2020 12:16:02 +0000 (13:16 +0100)]
Move weak lang items to librustc_lang_items.

4 years agoMove get_lang_items query in librustc_passes.
Camille GILLOT [Fri, 31 Jan 2020 22:06:06 +0000 (23:06 +0100)]
Move get_lang_items query in librustc_passes.

4 years agoMove lang_items definitions to librustc_lang_items.
Camille GILLOT [Sun, 26 Jan 2020 11:49:18 +0000 (12:49 +0100)]
Move lang_items definitions to librustc_lang_items.

4 years agoMove hir::check_attr::Target to librustc_lang_items.
Camille GILLOT [Sun, 26 Jan 2020 11:07:22 +0000 (12:07 +0100)]
Move hir::check_attr::Target to librustc_lang_items.

4 years agoMove macro enum_from_u32 to rustc_data_structures.
Camille GILLOT [Thu, 30 Jan 2020 07:19:59 +0000 (08:19 +0100)]
Move macro enum_from_u32 to rustc_data_structures.

4 years agoAuto merge of #68491 - pnkfelix:hide-niches-under-unsafe-cell, r=oli
bors [Tue, 11 Feb 2020 20:48:27 +0000 (20:48 +0000)]
Auto merge of #68491 - pnkfelix:hide-niches-under-unsafe-cell, r=oli

Hide niches under UnsafeCell

Hide any niche of T from type-construction context of `UnsafeCell<T>`.

Fix #68303
Fix #68206

4 years agoKeyword docs
Giles Cope [Tue, 11 Feb 2020 20:36:36 +0000 (20:36 +0000)]
Keyword docs

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
Co-Authored-By: Tim Robinson <tim.g.robinson@gmail.com>
Co-Authored-By: Peter Todd <pete@petertodd.org>
Co-Authored-By: Dylan DPC <dylan.dpc@gmail.com>
4 years agoAdd self to .mailmap
Jason Liquorish [Tue, 11 Feb 2020 18:33:00 +0000 (18:33 +0000)]
Add self to .mailmap

4 years agoremove some dependencies on itertools
Andreas Jonson [Tue, 11 Feb 2020 18:28:38 +0000 (19:28 +0100)]
remove some dependencies on itertools

4 years agoAuto merge of #69062 - Dylan-DPC:rollup-7wpjpqu, r=Dylan-DPC
bors [Tue, 11 Feb 2020 17:45:49 +0000 (17:45 +0000)]
Auto merge of #69062 - Dylan-DPC:rollup-7wpjpqu, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #66498 (Remove unused feature gates)
 - #68816 (Tweak borrow error on `FnMut` when `Fn` is expected)
 - #68824 (Enable Control Flow Guard in rustbuild)
 - #69022 (traits: preallocate 2 Vecs of known initial size)
 - #69031 (Use `dyn Trait` more in tests)
 - #69044 (Don't run coherence twice for future-compat lints)
 - #69047 (Don't rustfmt check the vendor directory.)
 - #69055 (Clean up E0307 explanation)

Failed merges:

r? @ghost

4 years agoRollup merge of #69055 - GuillaumeGomez:clean-up-e0307, r=Dylan-DPC
Dylan DPC [Tue, 11 Feb 2020 15:37:06 +0000 (16:37 +0100)]
Rollup merge of #69055 - GuillaumeGomez:clean-up-e0307, r=Dylan-DPC

Clean up E0307 explanation

r? @Dylan-DPC

4 years agoRollup merge of #69047 - ehuss:rustfmt-vendor, r=Centril
Dylan DPC [Tue, 11 Feb 2020 15:37:04 +0000 (16:37 +0100)]
Rollup merge of #69047 - ehuss:rustfmt-vendor, r=Centril

Don't rustfmt check the vendor directory.

I need to be able to run `x.py tidy` to do license checks (which requires vendored dependencies).  However, when vendoring is enabled, it wants to rustfmt check the entire vendor directory, which doesn't work.

4 years agoRollup merge of #69044 - jonas-schievink:dont-run-coherence-twice, r=davidtwco
Dylan DPC [Tue, 11 Feb 2020 15:37:02 +0000 (16:37 +0100)]
Rollup merge of #69044 - jonas-schievink:dont-run-coherence-twice, r=davidtwco

Don't run coherence twice for future-compat lints

This fixes the regression introduced by https://github.com/rust-lang/rust/pull/65232 (which I mentioned in https://github.com/rust-lang/rust/pull/65232#issuecomment-583739037).

Old algorithm:
* Run coherence with all future-incompatible checks off, reporting errors on any overlap.
* If there's no overlap (common case), run it *again*, with the future-incompatible checks on. Report warnings for any overlap found.

New algorithm:
* Run coherence with all additional future-incompatible checks *on*, which means that we'll find *all* potentially overlapping impls immediately.
* If this found overlap, run coherence again, with the future-incompatible checks off. If that *still* gives an error, we report it. If not, it ought to be a warning.

This reduces time spent in coherence checking for the nrf52810-pac by roughly 50% relative to current master.

4 years agoRollup merge of #69031 - Centril:dyntest, r=eddyb
Dylan DPC [Tue, 11 Feb 2020 15:37:01 +0000 (16:37 +0100)]
Rollup merge of #69031 - Centril:dyntest, r=eddyb

Use `dyn Trait` more in tests

Here are some tests using the old trait object type syntax which are not testing the syntax itself.

This has been extracted from https://github.com/rust-lang/rust/pull/66364.

4 years agoRollup merge of #69022 - ljedrz:traits_tweak_vecs, r=petrochenkov
Dylan DPC [Tue, 11 Feb 2020 15:36:59 +0000 (16:36 +0100)]
Rollup merge of #69022 - ljedrz:traits_tweak_vecs, r=petrochenkov

traits: preallocate 2 Vecs of known initial size

The 2 preallocations are pretty obvious; both vectors will be as big as or larger than the collections they are created from.

In `WfPredicates::normalize` the change from a functional style improves readability and should be perf-friendly, too.

4 years agoRollup merge of #68824 - ajpaverd:cfguard-rustbuild, r=Mark-Simulacrum
Dylan DPC [Tue, 11 Feb 2020 15:36:57 +0000 (16:36 +0100)]
Rollup merge of #68824 - ajpaverd:cfguard-rustbuild, r=Mark-Simulacrum

Enable Control Flow Guard in rustbuild

Now that Rust supports Control Flow Guard (#68180), add a config.toml option to build the standard library with CFG enabled.

r? @nagisa

4 years agoRollup merge of #68816 - estebank:fn-mut-closure, r=varkor
Dylan DPC [Tue, 11 Feb 2020 15:36:55 +0000 (16:36 +0100)]
Rollup merge of #68816 - estebank:fn-mut-closure, r=varkor

Tweak borrow error on `FnMut` when `Fn` is expected

Fix #31701, fix #66097.

4 years agoRollup merge of #66498 - bjorn3:less_feature_flags, r=Dylan-DPC
Dylan DPC [Tue, 11 Feb 2020 15:36:54 +0000 (16:36 +0100)]
Rollup merge of #66498 - bjorn3:less_feature_flags, r=Dylan-DPC

Remove unused feature gates

I think many of the remaining unstable things can be easily be replaced with stable things. I have kept the `#![feature(nll)]` even though it is only necessary in `libstd`, to make regressions of it harder.

4 years agoAuto merge of #68725 - jumbatm:invert-control-in-struct_lint_level, r=Centril
bors [Tue, 11 Feb 2020 14:45:00 +0000 (14:45 +0000)]
Auto merge of #68725 - jumbatm:invert-control-in-struct_lint_level, r=Centril

Invert control in struct_lint_level.

Closes #67927

Changes the `struct_lint*` methods to take a  `decorate` function instead of a message string. This decorate function is also responsible for eventually stashing, emitting or cancelling the diagnostic. If the lint was allowed after all, the decorate function is not run at all, saving us from spending time formatting messages (and potentially other expensive work) for lints that don't end up being emitted.

r? @Centril

4 years agoPreparation for allocator aware `Box`
Tim Diekmann [Tue, 11 Feb 2020 12:02:51 +0000 (13:02 +0100)]
Preparation for allocator aware `Box`

4 years agoClean up E0307 explanation
Guillaume Gomez [Tue, 11 Feb 2020 10:39:41 +0000 (11:39 +0100)]
Clean up E0307 explanation

4 years agoFix stage2 test failures from call to span_lint.
jumbatm [Thu, 6 Feb 2020 10:22:25 +0000 (20:22 +1000)]
Fix stage2 test failures from call to span_lint.

span_lint was removed. Callers should use the `lint` method now, and
call `set_span` within the closure passed to this method.

4 years agoAvoid allocs in a few places.
jumbatm [Wed, 5 Feb 2020 17:18:40 +0000 (03:18 +1000)]
Avoid allocs in a few places.

- AnonymousParameters::check_trait_item
- TypeAliasBounds::check_item
- NonSnakeCase::check_snake_case

4 years agoAddress review nitpicks.
jumbatm [Wed, 5 Feb 2020 15:28:23 +0000 (01:28 +1000)]
Address review nitpicks.

4 years agoMove more into decorate functions.
jumbatm [Wed, 5 Feb 2020 15:27:46 +0000 (01:27 +1000)]
Move more into decorate functions.

4 years agoRun RustFmt
jumbatm [Mon, 3 Feb 2020 09:57:45 +0000 (19:57 +1000)]
Run RustFmt

4 years agoMake cx.span_lint methods lazy
jumbatm [Sun, 2 Feb 2020 09:41:14 +0000 (19:41 +1000)]
Make cx.span_lint methods lazy

- Make report_unsafe take decorate function
- Remove span_lint, replacing calls with struct_span_lint, as caller is
now responsible for emitting.
- Remove lookup_and_emit, replacing with just lookup which takes a
decorate function.
- Remove span_lint_note, span_lint_help.  These methods aren't easily
made lazy as standalone methods, private, and unused. If this
functionality is needed, to be lazy, they can easily be made into
Fn(&mut DiagnosticBuilder) that are meant to be called _within_ the
decorate function.
- Rename lookup_and_emit_with_diagnostics to lookup_with_diagnostics to
better reflect the fact that it doesn't emit for you.

4 years agoMove more work into `decorate` functions.
jumbatm [Sun, 2 Feb 2020 01:11:33 +0000 (11:11 +1000)]
Move more work into `decorate` functions.

4 years agoRun RustFmt
jumbatm [Sat, 1 Feb 2020 23:47:58 +0000 (09:47 +1000)]
Run RustFmt

4 years agoAlso check for "use fully-qualified syntax".
jumbatm [Sat, 1 Feb 2020 03:27:05 +0000 (13:27 +1000)]
Also check for "use fully-qualified syntax".

4 years agoBox `decorate` to avoid code bloat.
jumbatm [Fri, 31 Jan 2020 20:57:50 +0000 (06:57 +1000)]
Box `decorate` to avoid code bloat.

4 years agoInvert control in struct_lint_level.
jumbatm [Fri, 31 Jan 2020 12:24:57 +0000 (22:24 +1000)]
Invert control in struct_lint_level.

Caller now passes in a `decorate` function, which is only run if the
lint is allowed.

4 years agoImprove `char::is_ascii_*` code
Andrea Canciani [Tue, 24 Dec 2019 11:47:51 +0000 (12:47 +0100)]
Improve `char::is_ascii_*` code

These methods explicitly check if a char is in a specific ASCII range,
therefore the `is_ascii()` check is not needed, but LLVM seems to be
unable to remove it.

WARNING: this change improves the performance on ASCII `char`s, but
complex checks such as `is_ascii_punctuation` become slower on
non-ASCII `char`s.

4 years agoSupport linking from a .rlink file
Victor Ding [Thu, 23 Jan 2020 10:48:48 +0000 (21:48 +1100)]
Support linking from a .rlink file

Flag `-Z no-link` was previously introduced, which allows creating
an `.rlink` file to perform compilation without linking.
This change enables linking from an `.rlink` file.

4 years agorustbuild: include channel in sanitizers installed name
Marc-Antoine Perennou [Thu, 6 Feb 2020 11:32:42 +0000 (12:32 +0100)]
rustbuild: include channel in sanitizers installed name

Allows parallel install of different rust channels

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
4 years agoAuto merge of #68961 - eddyb:dbg-stack-dunk, r=nagisa
bors [Tue, 11 Feb 2020 07:36:59 +0000 (07:36 +0000)]
Auto merge of #68961 - eddyb:dbg-stack-dunk, r=nagisa

rustc_codegen_ssa: only "spill" SSA-like values to the stack for debuginfo.

This is an implementation of the idea described in https://github.com/rust-lang/rust/issues/68817#issuecomment-583719182.

In short, instead of debuginfo forcing otherwise-SSA-like MIR locals into `alloca`s, and requiring a `load` for each use (or two, for scalar pairs), the `alloca` is now *only* used for attaching debuginfo with `llvm.dbg.declare`: the `OperandRef` is stored to the `alloca`, but *never loaded* from it.

Outside of `debug_introduce_local`, nothing cares about the debuginfo-only `alloca`, and instead works with `OperandRef` the same as MIR locals without debuginfo before this PR.

This should have some of the benefits of `llvm.dbg.value`, while working today.

cc @nagisa @nikomatsakis

4 years agoDon't rustfmt the vendor directory.
Eric Huss [Tue, 11 Feb 2020 03:08:24 +0000 (19:08 -0800)]
Don't rustfmt the vendor directory.

4 years agoAuto merge of #68929 - matprec:consistent-issue-references, r=Dylan-DPC
bors [Tue, 11 Feb 2020 02:00:27 +0000 (02:00 +0000)]
Auto merge of #68929 - matprec:consistent-issue-references, r=Dylan-DPC

Make issue references consistent

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

cc https://github.com/rust-lang/rust/pull/63008

r? @varkor because you reviewed the original pr

4 years agoDon't run coherence twice for future-compat lints
Jonas Schievink [Mon, 10 Feb 2020 23:17:47 +0000 (00:17 +0100)]
Don't run coherence twice for future-compat lints

4 years agoAuto merge of #69030 - Dylan-DPC:rollup-t9uk7vc, r=Dylan-DPC
bors [Mon, 10 Feb 2020 22:46:29 +0000 (22:46 +0000)]
Auto merge of #69030 - Dylan-DPC:rollup-t9uk7vc, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #68897 (clean up E0275 explanation)
 - #68908 (Add long error code explanation message for E0637 )
 - #68932 (self-profile: Support arguments for generic_activities.)
 - #68986 (Make ASCII ctype functions unstably const )
 - #69007 (Clean up E0283 explanation)
 - #69014 (change an instance of span_bug() to struct_span_err() to avoid ICE)

Failed merges:

r? @ghost

4 years agosubmodules: update cargo from 9d32b7b01 to 3c53211c3
Matthias Krüger [Mon, 10 Feb 2020 19:47:38 +0000 (20:47 +0100)]
submodules: update cargo from 9d32b7b01 to 3c53211c3

Changes:
````
Update jobserver.
Update tar.
Emit report on error with Ztimings.
Do not run `formats_source` if `rustfmt` is not available
Fix rebuild_sub_package_then_while_package on HFS.
Remove likely brittle test.
Install rustfmt for testing in CI
Fix build-std collisions.
Fix BuildScriptOutput when a build script is run multiple times.
Fix required-features using renamed dependencies.
Fix using global options before an alias.
Update changelog for 1.42.
Bump to 0.44.0.
Log rustfmt output if it fails; also do not check that rustfmt exists
Update pretty_env_logger requirement from 0.3 to 0.4
Swap std::sync::mpsc channel with crossbeam_channel
Fix tests on Linux/MacOS
Fix typo.
Add tests
Deduplicate warnings about missing rustfmt
Log entry 2: first implementation
Refactor code
Stabilize config-profile.
Log entry 1
Format code
Remove tempdir after install
Keep existing package with git install
Use non-ephemeral workspace
Test that git install reads virtual manifest
Fix failing test
Search for root manifest with ephemeral workspaces
Support out-dir in build section of Cargo configuration file
````

4 years agoFix SGX RWLock representation for UnsafeCell niche fix
Jethro Beekman [Fri, 31 Jan 2020 14:19:22 +0000 (15:19 +0100)]
Fix SGX RWLock representation for UnsafeCell niche fix

4 years agoAdd `repr(no_niche)` to `UnsafeCell`. Fix #68303.
Felix S. Klock II [Thu, 23 Jan 2020 19:33:55 +0000 (14:33 -0500)]
Add `repr(no_niche)` to `UnsafeCell`. Fix #68303.

4 years agotests for `#[repr(no_niche)]`.
Felix S. Klock II [Wed, 22 Jan 2020 23:50:38 +0000 (18:50 -0500)]
tests for `#[repr(no_niche)]`.

4 years agoAdd `#[repr(no_niche)]`.
Felix S. Klock II [Wed, 22 Jan 2020 23:54:04 +0000 (18:54 -0500)]
Add `#[repr(no_niche)]`.

This repr-hint makes a struct/enum hide any niche within from its
surrounding type-construction context.

It is meant (at least initially) as an implementation detail for
resolving issue 68303. We will not stabilize the repr-hint unless
someone finds motivation for doing so.

(So, declaration of `no_niche` feature lives in section of file
where other internal implementation details are grouped, and
deliberately leaves out the tracking issue number.)

incorporated review feedback, and fixed post-rebase.

4 years agoEnable Control Flow Guard in rustbuild
Andrew Paverd [Tue, 28 Jan 2020 14:29:44 +0000 (14:29 +0000)]
Enable Control Flow Guard in rustbuild

4 years agoAdd missing `_zeroed` varants to `AllocRef`
Tim Diekmann [Mon, 10 Feb 2020 16:00:59 +0000 (17:00 +0100)]
Add missing `_zeroed` varants to `AllocRef`

4 years agoRemove common usage pattern from `AllocRef`
Tim Diekmann [Mon, 10 Feb 2020 15:42:00 +0000 (16:42 +0100)]
Remove common usage pattern from `AllocRef`

4 years agouse `dyn Trait` more in tests
Mazdak Farrokhzad [Mon, 10 Feb 2020 16:39:10 +0000 (17:39 +0100)]
use `dyn Trait` more in tests

4 years agoRollup merge of #69014 - dwrensha:fix-68890, r=Centril
Dylan DPC [Mon, 10 Feb 2020 16:29:03 +0000 (17:29 +0100)]
Rollup merge of #69014 - dwrensha:fix-68890, r=Centril

change an instance of span_bug() to struct_span_err() to avoid ICE

After #67148, the `span_bug()` in `parse_ty_tuple_or_parens()` is reachable because `parse_paren_comma_seq()` can return an `Ok()` even in cases where it encounters an error.
This pull request prevents an ICE in such cases by replacing the `span_bug()` with `struct_span_error()`.

Fixes #68890.

4 years agoRollup merge of #69007 - GuillaumeGomez:clean-up-e0283, r=Dylan-DPC
Dylan DPC [Mon, 10 Feb 2020 16:29:01 +0000 (17:29 +0100)]
Rollup merge of #69007 - GuillaumeGomez:clean-up-e0283, r=Dylan-DPC

Clean up E0283 explanation

r? @Dylan-DPC

4 years agoRollup merge of #68986 - ecstatic-morse:const-ascii-ctype, r=Centril
Dylan DPC [Mon, 10 Feb 2020 16:28:59 +0000 (17:28 +0100)]
Rollup merge of #68986 - ecstatic-morse:const-ascii-ctype, r=Centril

Make ASCII ctype functions unstably const

Makes the following inherent methods on `u8` and `char` unstable `const fn`:

 * `is_ascii_alphabetic`
 * `is_ascii_uppercase`
 * `is_ascii_lowercase`
 * `is_ascii_alphanumeric`
 * `is_ascii_digit`
 * `is_ascii_hexdigit`
 * `is_ascii_punctuation`
 * `is_ascii_graphic`
 * `is_ascii_whitespace`
 * `is_ascii_control`

cc #68983

4 years agoRollup merge of #68932 - michaelwoerister:self-profile-generic-activity-args, r=wesle...
Dylan DPC [Mon, 10 Feb 2020 16:28:57 +0000 (17:28 +0100)]
Rollup merge of #68932 - michaelwoerister:self-profile-generic-activity-args, r=wesleywiser

self-profile: Support arguments for generic_activities.

This PR adds support for recording arguments of "generic activities". The most notable use case is LLVM module names, which should be very interesting for `crox` profiles. In the future it might be interesting to add more fine-grained events for pre-query passes like macro expansion.

I tried to judiciously de-duplicate existing self-profile events with `extra_verbose_generic_activity`, now that the latter also generates self-profile events.

r? @wesleywiser

4 years agoRollup merge of #68908 - jwhite927:E0637, r=Dylan-DPC
Dylan DPC [Mon, 10 Feb 2020 16:28:56 +0000 (17:28 +0100)]
Rollup merge of #68908 - jwhite927:E0637, r=Dylan-DPC

Add long error code explanation message for E0637

Reference issue [#61137](https://github.com/rust-lang/rust/issues/61137)
To incorporate a long error description for E0637, I have made the necessary modification to error_codes.rs and added error_codes/E0637.md, and blessed the relevant .stderror files. ~~, however when I build rustc stage 1, I am unable to make `$ rustc --explain E0637` work even though rustc appears to be able to call up the long error explanations for other errors. I wanted to guarantee this would work before moving on the blessing the various ui tests that have been affected. @GuillaumeGomez Do you know the most likely reason(s) why this would be the case?~~
Update: `$ rustc --explain E0637` works now.

4 years agoRollup merge of #68897 - GuillaumeGomez:clean-up-e0275, r=Dylan-DPC
Dylan DPC [Mon, 10 Feb 2020 16:28:54 +0000 (17:28 +0100)]
Rollup merge of #68897 - GuillaumeGomez:clean-up-e0275, r=Dylan-DPC

clean up E0275 explanation

r? @Dylan-DPC

4 years agoAuto merge of #68835 - CAD97:sound-range-inclusive, r=Mark-Simulacrum
bors [Mon, 10 Feb 2020 15:24:59 +0000 (15:24 +0000)]
Auto merge of #68835 - CAD97:sound-range-inclusive, r=Mark-Simulacrum

Remove problematic specialization from RangeInclusive

Fixes #67194 using the approach [outlined by Mark-Simulacrum](https://github.com/rust-lang/rust/issues/67194#issuecomment-581669549).

> I believe the property we want is that if `PartialEq(&self, &other) == true`, then `self.next() == other.next()`. It is true that this is satisfied by removing the specialization and always doing `is_empty.unwrap_or_default()`; the "wrong" behavior there arises from calling `next()` having an effect on initially empty ranges, as we should be in `is_empty = true` but are not (yet) there. It might be possible to detect that the current state is always empty (i.e., `start > end`) and then not fill in the empty slot. I think this might solve the problem without regressing tests; however, this could have performance implications.

> That approach essentially states that we only use the `is_empty` slot for cases where `start <= end`. That means that `Idx: !Step` and `start > end` would both behave the same, and correctly -- we do not need the boolean if we're not ever going to emit any values from the iterator.

This is implemented here by replacing the `is_empty: Option<bool>` slot with an `exhausted: bool` slot. This flag is

- `false` upon construction,
- `false` when iteration has not yielded an element -- importantly, this means it is always `false` for an iterator empty by construction,
- `false` when iteration has yielded an element and the iterator is not exhausted, and
- only `true` when iteration has been used to exhaust the iterator.

For completeness, this also adds a note to the `Debug` representation to note when the range is exhausted.

4 years agoself-profile: Support arguments for generic_activities.
Michael Woerister [Fri, 7 Feb 2020 14:01:23 +0000 (15:01 +0100)]
self-profile: Support arguments for generic_activities.

4 years agopreallocate 2 Vecs in traits; tweak WfPredicates::normalize
ljedrz [Mon, 10 Feb 2020 13:28:56 +0000 (14:28 +0100)]
preallocate 2 Vecs in traits; tweak WfPredicates::normalize

4 years agoclean up E0275 explanation
Guillaume Gomez [Thu, 6 Feb 2020 16:53:03 +0000 (17:53 +0100)]
clean up E0275 explanation

4 years agoClean up E0283 explanation
Guillaume Gomez [Sun, 9 Feb 2020 22:11:54 +0000 (23:11 +0100)]
Clean up E0283 explanation

4 years agoAuto merge of #69012 - Dylan-DPC:rollup-13qn0fq, r=Dylan-DPC
bors [Mon, 10 Feb 2020 10:47:39 +0000 (10:47 +0000)]
Auto merge of #69012 - Dylan-DPC:rollup-13qn0fq, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #68694 (Reduce the number of `RefCell`s in `InferCtxt`.)
 - #68966 (Improve performance of coherence checks)
 - #68976 (Make `num::NonZeroX::new` an unstable `const fn`)
 - #68992 (Correctly parse `mut a @ b`)
 - #69005 (Small graphviz improvements for the new dataflow framework)
 - #69006 (parser: Keep current and previous tokens precisely)

Failed merges:

r? @ghost

4 years agoSpeed up `SipHasher128`.
Nicholas Nethercote [Thu, 6 Feb 2020 02:04:51 +0000 (13:04 +1100)]
Speed up `SipHasher128`.

The current code in `SipHasher128::short_write` is inefficient. It uses
`u8to64_le` (which is complex and slow) to extract just the right number of
bytes of the input into a u64 and pad the result with zeroes. It then
left-shifts that value in order to bitwise-OR it with `self.tail`.

For example, imagine we have a u32 input 0xIIHH_GGFF and only need three bytes
to fill up `self.tail`. The current code uses `u8to64_le` to construct
0x0000_0000_00HH_GGFF, which is just 0xIIHH_GGFF with the 0xII removed and
zero-extended to a u64. The code then left-shifts that value by five bytes --
discarding the 0x00 byte that replaced the 0xII byte! -- to give
0xHHGG_FF00_0000_0000. It then then ORs that value with self.tail.

There's a much simpler way to do it: zero-extend to u64 first, then left shift.
E.g. 0xIIHH_GGFF is zero-extended to 0x0000_0000_IIHH_GGFF, and then
left-shifted to 0xHHGG_FF00_0000_0000. We don't have to take time to exclude
the unneeded 0xII byte, because it just gets shifted out anyway! It also avoids
multiple occurrences of `unsafe`.

There's a similar story with the setting of `self.tail` at the method's end.
The current code uses `u8to64_le` to extract the remaining part of the input,
but the same effect can be achieved more quickly with a right shift on the
zero-extended input.

All that works on little-endian. It doesn't work for big-endian, but we
can just do a `to_le` before calling `short_write` and then it works.

This commit changes `SipHasher128` to use the simpler shift-based approach. The
code is also smaller, which means that `short_write` is now inlined where
previously it wasn't, which makes things faster again. This gives big
speed-ups for all incremental builds, especially "baseline" incremental
builds.

4 years ago[parser] change an instance of span_bug() to struct_span_err() to avoid ICE
David Renshaw [Mon, 10 Feb 2020 04:01:23 +0000 (23:01 -0500)]
[parser] change an instance of span_bug() to struct_span_err() to avoid ICE

4 years agoRollup merge of #69006 - petrochenkov:prevspan2, r=Centril
Dylan DPC [Mon, 10 Feb 2020 00:54:23 +0000 (01:54 +0100)]
Rollup merge of #69006 - petrochenkov:prevspan2, r=Centril

parser: Keep current and previous tokens precisely

...including their unnormalized forms.
Add more documentation for them.

Hopefully, this will help to eliminate footguns like https://github.com/rust-lang/rust/pull/68728#discussion_r373787486.

I'll try to address the FIXMEs in separate PRs during the next week.

r? @Centril

4 years agoRollup merge of #69005 - ecstatic-morse:unified-dataflow-graphviz, r=wesleywiser
Dylan DPC [Mon, 10 Feb 2020 00:54:21 +0000 (01:54 +0100)]
Rollup merge of #69005 - ecstatic-morse:unified-dataflow-graphviz, r=wesleywiser

Small graphviz improvements for the new dataflow framework

Split out from #68241. This prints the correct effect diff for each line (the before-effect and the after-effect) and makes marginal improvements to the graphviz output for the new dataflow framework including using monospaced font and better line breaking. This will only be useful when #68241 is merged and the graphviz output changes from this:

![image](https://user-images.githubusercontent.com/29463364/74107776-5e3c3300-4b28-11ea-9d33-4862228b5e87.png)

to this:

![image](https://user-images.githubusercontent.com/29463364/74107751-20d7a580-4b28-11ea-99ca-24f749386601.png)

r? @wesleywiser

4 years agoRollup merge of #68992 - matthewjasper:imm-binding-after-at, r=Centril
Dylan DPC [Mon, 10 Feb 2020 00:54:20 +0000 (01:54 +0100)]
Rollup merge of #68992 - matthewjasper:imm-binding-after-at, r=Centril

Correctly parse `mut a @ b`

r? @Centril

Closes #67861
Closes #67926

4 years agoRollup merge of #68976 - ecstatic-morse:const-non-zero, r=dtolnay
Dylan DPC [Mon, 10 Feb 2020 00:54:18 +0000 (01:54 +0100)]
Rollup merge of #68976 - ecstatic-morse:const-non-zero, r=dtolnay

Make `num::NonZeroX::new` an unstable `const fn`

cc #53718

These require `#[feature(const_if_match)]`, meaning they must remain unstable for the time being.

4 years agoRollup merge of #68966 - jonas-schievink:coherence-perf, r=varkor
Dylan DPC [Mon, 10 Feb 2020 00:54:17 +0000 (01:54 +0100)]
Rollup merge of #68966 - jonas-schievink:coherence-perf, r=varkor

Improve performance of coherence checks

The biggest perf improvement in here is expected to come from the removal of the remaining #43355 warning code since that effectively runs the expensive parts of coherence *twice*, which can even be visualized by obtaining a flamegraph:

![image](https://user-images.githubusercontent.com/5047365/74091959-e1f41200-4a8b-11ea-969d-2849d3f86c63.png)

4 years agoRollup merge of #68694 - nnethercote:reduce-RefCells-in-InferCtxt, r=varkor
Dylan DPC [Mon, 10 Feb 2020 00:54:15 +0000 (01:54 +0100)]
Rollup merge of #68694 - nnethercote:reduce-RefCells-in-InferCtxt, r=varkor

Reduce the number of `RefCell`s in `InferCtxt`.

`InferCtxt` contains six structures within `RefCell`s. Every time we
create and dispose of (commit or rollback) a snapshot we have to
`borrow_mut` each one of them.

This commit moves the six structures under a single `RefCell`, which
gives significant speed-ups by reducing the number of `borrow_mut`
calls. To avoid runtime errors I had to reduce the lifetimes of dynamic
borrows in a couple of places.

r? @varkor

4 years agoRemove vestigial #43355-compat code
Jonas Schievink [Sat, 8 Feb 2020 18:14:50 +0000 (19:14 +0100)]
Remove vestigial #43355-compat code

This was previously a future-compat warning that has since been turned into
hard error, but without actually removing all the code.

Avoids a call to `traits::overlapping_impls`, which is expensive.

4 years agoDefer error span calculation until needed
Jonas Schievink [Fri, 7 Feb 2020 23:45:03 +0000 (00:45 +0100)]
Defer error span calculation until needed

This was showing up in profiles. Also deduplicates the code to get just
the impl header span.

4 years agoAdd desc to `specialization_graph_of` query
Jonas Schievink [Fri, 7 Feb 2020 23:27:24 +0000 (00:27 +0100)]
Add desc to `specialization_graph_of` query

4 years agoReduce queries/map lookups done by coherence
Jonas Schievink [Fri, 7 Feb 2020 23:27:07 +0000 (00:27 +0100)]
Reduce queries/map lookups done by coherence

This has negligible perf impact, but it does improve the code a bit.

* Only query the specialization graph of any trait once instead of once per
  impl
* Loop over impls only once, precomputing impl DefId and TraitRef