Commit Graph

106841 Commits

Author SHA1 Message Date
Dylan DPC
5a800d7ee6
Rollup merge of #69038 - yaahc:backtrace-debug, r=dtolnay
Add initial debug fmt for Backtrace

Fixes the first point in https://github.com/rust-lang/rust/issues/65280

related to https://github.com/rust-lang/rust/issues/53487
2020-02-12 20:36:56 +01:00
Dylan DPC
29dd5df791
Rollup merge of #69002 - RalfJung:miri-op-overflow, r=oli-obk,wesleywiser
miri: improve and simplify overflow detection

This simplifies the overflow detection for signed binary operators, and adds overflow detection to unary operators so that const-prop doesn't have to crudely hand-roll that.

It also fixes some bugs in the operator implementation that however, I think, were not observable.

r? @oli-obk @wesleywiser
2020-02-12 20:36:55 +01:00
Dylan DPC
2a3c1a30c8
Rollup merge of #68981 - estebank:silence, r=davidtwco
Account for type params on method without parentheses

Account for those type parameters in the structured suggestion when forgetting to call method:

```
error[E0615]: attempted to take value of method `collect` on type `std::vec::IntoIter<_>`
  --> $DIR/method-missing-parentheses.rs:2:32
   |
LL |     let _ = vec![].into_iter().collect::<usize>;
   |                                ^^^^^^^---------
   |                                |
   |                                help: use parentheses to call the method: `collect::<usize>()`
```
2020-02-12 20:36:53 +01:00
Dylan DPC
f127aba96d
Rollup merge of #67954 - nikic:new-pm, r=nagisa
Support new LLVM pass manager

Add support for the new LLVM pass manager behind a `-Z new-llvm-pass-manager=on` option. Both the pre-link optimization and LTO pipelines use the new pass manager. There's some bits that are not supported yet:

 * `-C passes`. NewPM requires an entirely different way of specifying custom pass pipelines. We should probably expose that functionality, but it doesn't directly map to what `-C passes` does.
 * NewPM has no support for custom inline parameters right now. We'd have to add upstream support for that first.
 * NewPM does not support PGO at O0 in LLVM 9 (which is why those tests fail with NewPM enabled). This is supported in LLVM 10.
 * NewPM does not support MergeFunctions in LLVM 9. I've landed this upstream just before the cut, so we'll be able to re-enable that with LLVM 10.

Closes #64289.

r? @ghost
2020-02-12 20:36:51 +01:00
bors
a1912f2e89 Auto merge of #68679 - matthewjasper:needs-type-op, r=varkor
Improve `ty.needs_drop`

* Handle cycles in `needs_drop` correctly
* Normalize types when computing `needs_drop`
* Move queries from rustc to rustc_ty
* Avoid query in simple cases

reopens #65918
2020-02-12 19:31:49 +00:00
Tomasz Miąsko
33e2c1d863 bootstrap: Configure cmake when building sanitizer runtimes 2020-02-12 20:01:07 +01:00
bors
2d2be57097 Auto merge of #69094 - Dylan-DPC:rollup-4qe7uv1, r=Dylan-DPC
Rollup of 8 pull requests

Successful merges:

 - #67585 (Improve `char::is_ascii_*` codegen)
 - #68914 (Speed up `SipHasher128`.)
 - #68994 (rustbuild: include channel in sanitizers installed name)
 - #69032 (ICE in nightly-2020-02-08: handle TerminatorKind::Yield in librustc_mir::transform::promote_consts::Validator method)
 - #69034 (parser: Remove `Parser::prev_token_kind`)
 - #69042 (Remove backtrace header text)
 - #69059 (Remove a few unused objects)
 - #69089 (Properly use the darwin archive format on Apple targets)

Failed merges:

r? @ghost
2020-02-12 16:25:13 +00:00
Guillaume Gomez
109260f8f0 Add test to check if minified theme are handled correctly 2020-02-12 15:49:39 +01:00
Guillaume Gomez
c8e567ddc8 Minify CSS rules to be able to handle minified theme files as well 2020-02-12 15:49:39 +01:00
Igor Matuszewski
8fc4bba2c4 Update RLS and Rustfmt
Bumps rustc-ap-* packages to v642.
2020-02-12 15:47:38 +01:00
Nikita Popov
c6b0803202 Add support for new pass manager
The new pass manager can be enabled using
-Z new-llvm-pass-manager=on.
2020-02-12 15:34:16 +01:00
Nikita Popov
737f08bc28 Fix mangled names of lifetime intrinsics 2020-02-12 15:30:56 +01:00
Nikita Popov
03a73fa2cf Use IRBuilder to create memset
To avoid creating memsets with outdated signature. For some reason
SROA chokes on this when using NewPM.
2020-02-12 15:30:51 +01:00
John Kåre Alsaker
5206827933 Address comments 2020-02-12 14:37:50 +01:00
Dylan DPC
d9982f1f81
Rollup merge of #69089 - nox:sym64-crash, r=eddyb
Properly use the darwin archive format on Apple targets

See https://github.com/servo/servo/issues/25550.
2020-02-12 14:21:16 +01:00
Dylan DPC
db48a8a6aa
Rollup merge of #69059 - ljedrz:unused_stuff, r=Dylan-DPC
Remove a few unused objects

As far as I can tell, these won't be missed:

- `infer::region_constraints::ConstraintInfo`
- `driver::DefaultCallbacks`
- ~~`hir::intravisit::ParDeepVisitor`~~
2020-02-12 14:21:14 +01:00
Dylan DPC
6b40f59db1
Rollup merge of #69042 - yaahc:backtrace-header, r=dtolnay
Remove backtrace header text

Fixes point 3 from https://github.com/rust-lang/rust/issues/65280

related to https://github.com/rust-lang/rust/issues/53487

This should probably be double checked by someone who works on fuschia because theres some extra fuschia specific output in `add_context` that is also removed by this change.
2020-02-12 14:21:13 +01:00
Dylan DPC
42f371c2eb
Rollup merge of #69034 - petrochenkov:notokind, r=Centril
parser: Remove `Parser::prev_token_kind`

Follow-up to https://github.com/rust-lang/rust/pull/69006.
r? @Centril
2020-02-12 14:21:11 +01:00
Dylan DPC
b695f99deb
Rollup merge of #69032 - chrissimpkins:ice-yield-println-#69017, r=petrochenkov
ICE in nightly-2020-02-08: handle TerminatorKind::Yield in librustc_mir::transform::promote_consts::Validator method

IR: https://github.com/rust-lang/rust/issues/69017
regressed commit: f8fd462447
Source: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=55e65a869e1f5fef64cc4462b1a5a087

Addresses ICE reported in #69017 by handling `TerminatorKind::Yield` in 4d1241f515/src/librustc_mir/transform/promote_consts.rs (L465-L468).

<details><summary>Nightly build</summary>
<p>

```
$ cargo +nightly build
Compiling yielder v0.1.0 (/Users/chris/Desktop/tests/rustlang-tests/yielder)
error: internal compiler error: src/librustc_mir/transform/promote_consts.rs:467: _1 = suspend(move _21) -> [resume: bb2, drop: bb3] not promotable
 --> src/main.rs:8:27
  |
8 |         println!("-> {}", yield);
  |                           ^^^^^

thread 'rustc' panicked at 'Box<Any>', <::std::macros::panic macros>:2:4
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.43.0-nightly (71c7e149e 2020-02-09) running on x86_64-apple-darwin

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

error: aborting due to previous error

error: could not compile `yielder`.

To learn more, run the command again with --verbose.
```

</p>
</details>

<details><summary>Stage 1 dev build</summary>
<p>

```
$ cargo +stage1 build
Compiling yielder v0.1.0 (/Users/chris/Desktop/tests/rustlang-tests/yielder)
warning: function is never used: `gen`
 --> src/main.rs:6:4
  |
6 | fn gen() -> impl Generator<usize> {
  |    ^^^
  |
  = note: `#[warn(dead_code)]` on by default

    Finished dev [unoptimized + debuginfo] target(s) in 0.53s
```

</p>
</details>

@jonas-schievink @oli-obk
2020-02-12 14:21:10 +01:00
Dylan DPC
75a977dd47
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
2020-02-12 14:21:08 +01:00
Dylan DPC
f2d829ce6a
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
2020-02-12 14:21:06 +01:00
Dylan DPC
79ebf53cbb
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
2020-02-12 14:21:05 +01:00
bors
2ed25f0697 Auto merge of #68241 - ecstatic-morse:unified-dataflow-impls, r=pnkfelix
Migrate borrowck dataflow impls to new framework

This uses #65672 to implement the dataflow analyses needed by borrowck. These include all the `InitializedPlaces` analyses as well as `Borrows`. Additionally, this PR contains several independent changes around the dataflow API which improve performance and make it more ergonomic.

* An optimization that inhibits the caching of block transfer functions for acyclic MIR (~0.3% I-CNT savings).
* A `ResultsVisitor` for dataflow results that is more efficient than `ResultsCursor` when we have to visit every statement unconditionally (~0.3% I-CNT savings).
* An `into_engine` method on `Analysis` that selects the appropriate `Engine` constructor.
* A `contains` method for `ResultsCursor` as a shorthand for `.get().contains()`.
* A `find_descendants` helper on `MovePath` that replaces `has_any_child_of` on the old `FlowsAtLocation`

These changes made porting the dataflow analyses much easier. Finally, this PR removes some now-unused code in `dataflow/at_location.rs` and elsewhere.

You can view the perf results for the final version of this PR [here](https://perf.rust-lang.org/compare.html?start=29b854fb741809c29764e33fc17c32ba9c6523ba&end=6e516c1410c18cfe4eb6d030a39fdb73c8d8a4fe). Here's an example of the graphviz diagrams that are generated for the `MaybeInitializedPlaces` analysis.

![image](https://user-images.githubusercontent.com/29463364/72846117-c3e97d80-3c54-11ea-8171-3d48981c9ddd.png)
2020-02-12 13:16:58 +00:00
John Kåre Alsaker
5de82b9264 Drop the lock guard 2020-02-12 12:33:31 +01:00
Anthony Ramine
15adbf6e08 Properly use the darwin archive format on Apple targets
See https://github.com/servo/servo/issues/25550.
2020-02-12 12:06:14 +01:00
John Kåre Alsaker
19c1012483 Use a counter instead of pointers to the stack 2020-02-12 11:50:00 +01:00
bors
cd5441faf4 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
2020-02-12 10:10:15 +00:00
Yuki Okushi
486856f75f
Rollup merge of #69077 - jumbatm:fix-comment, r=Dylan-DPC
Fix outdated doc comment.

r? @RalfJung
2020-02-12 18:55:51 +09:00
Yuki Okushi
77a324508e
Rollup merge of #69070 - Bassetts:master, r=alexcrichton
Add self to .mailmap
2020-02-12 18:55:49 +09:00
Yuki Okushi
5fbfaacab3
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
2020-02-12 18:55:48 +09:00
Yuki Okushi
a50ccd980a
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
2020-02-12 18:55:46 +09:00
Yuki Okushi
9bc003da11
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
2020-02-12 18:55:44 +09:00
Yuki Okushi
9b51a52084
Rollup merge of #68999 - andjo403:itertools, r=Centril
remove dependency on itertools

r? @Centril
2020-02-12 18:55:42 +09:00
Yuki Okushi
931005d549
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
2020-02-12 18:55:41 +09:00
Yuki Okushi
4b82b51213
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
2020-02-12 18:55:39 +09:00
Yuki Okushi
19b0c00da3
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
2020-02-12 18:55:37 +09:00
Yuki Okushi
344f8d9e62
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
2020-02-12 18:55:36 +09:00
Yuki Okushi
b6a9aa9dd7
Rollup merge of #67695 - gilescope:truth, r=centril
Added dyn and true keyword docs

r? @Centril
2020-02-12 18:55:34 +09:00
John Kåre Alsaker
77ab0d091e Construct query job latches on-demand 2020-02-12 10:30:23 +01:00
ljedrz
d8544ce248 remove some unused objects 2020-02-12 09:21:39 +01:00
bors
7cba853b4f Auto merge of #68998 - lzutao:clippyup, r=Manishearth
Update clippy

Closes #68901
2020-02-12 07:05:15 +00:00
Tyler Mandry
ee85e913a2 Update compiler-builtins to 0.1.25 2020-02-11 22:25:32 -08:00
bors
e6db6697fa Auto merge of #68823 - matthiaskrgr:submodule_upd, r=ehuss
submodules: update cargo
2020-02-12 01:47:01 +00:00
Lzu Tao
1db0a224eb Update clippy 2020-02-12 02:25:44 +01:00
Jane Lusby
090a1571d8 Fix failing backtrace ui tests 2020-02-11 16:57:22 -08:00
Nicholas Nethercote
9aea154e78 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.
2020-02-12 11:32:57 +11:00
jumbatm
c1ed84e6ec Fix outdated doc comment. 2020-02-12 08:53:35 +10:00
Dylan MacKenzie
ee52fe6d51 Test failure of unchecked arithmetic intrinsics in const eval 2020-02-11 14:46:12 -08:00
Camille GILLOT
fc73e196d9 Review comments. 2020-02-11 23:21:21 +01:00
Camille GILLOT
513eb744c0 Merge rustc::middle::*lang_items. 2020-02-11 23:15:27 +01:00