Commit graph

1360 commits

Author SHA1 Message Date
pierwill 4f89224f7f Use an indexmap to avoid sorting LocalDefIds
Update `indexmap` to 1.8.0.

Bless test
2022-01-22 22:34:16 -06:00
bors 10c4c4afec Auto merge of #92998 - Amanieu:hashbrown12, r=Mark-Simulacrum
Update hashbrown to 0.12.0

[Changelog](https://github.com/rust-lang/hashbrown/blob/master/CHANGELOG.md#v0120---2022-01-17)
2022-01-22 23:39:21 +00:00
Matthias Krüger f8335d96fa
Rollup merge of #93012 - GuillaumeGomez:pulldown-list, r=camelid
Update pulldown-cmark version to fix markdown list issue

Fixes #92971.

r? ```@camelid```
2022-01-22 15:32:50 +01:00
Amanieu d'Antras 88149d13e3 Update hashbrown to 0.12.0 2022-01-21 17:20:38 +00:00
bors 84e918971d Auto merge of #92896 - lqd:update-deps, r=Mark-Simulacrum
Update some rustc dependencies to deduplicate them

This PR updates `rand` and `itertools` in rustc (not the whole workspace) in order to deduplicate them (and hopefully slightly improve compile times).

~~Currently, `object` is still duplicated, but https://github.com/rust-lang/thorin/pull/15 and updating `thorin` in the future will remove the use of version 0.27.~~  Update: Thorin 0.2 has now been released, and this PR updates `rustc_codegen_ssa` to use it and deduplicate the `object` crate.

There's a final tiny rustc dependency, `cfg-if`, which will be left: as both versions 0.1.x and 1.0 looked to be heavily depended on, they will require a few cascading updates to be removed.
2022-01-21 10:38:30 +00:00
Matthias Krüger b1a405df19
Rollup merge of #93091 - pierwill:chalk-0.76, r=jackh726
⬆ chalk to 0.76.0

This update contains https://github.com/rust-lang/chalk/pull/740, which is needed for work on #90317.
2022-01-20 23:37:37 +01:00
Matthias Krüger 3d10c64b26
Rollup merge of #91032 - eholk:generator-drop-tracking, r=nikomatsakis
Introduce drop range tracking to generator interior analysis

This PR addresses cases such as this one from #57478:
```rust
struct Foo;
impl !Send for Foo {}

let _: impl Send = || {
    let guard = Foo;
    drop(guard);
    yield;
};
```

Previously, the `generator_interior` pass would unnecessarily include the type `Foo` in the generator because it was not aware of the behavior of `drop`. We fix this issue by introducing a drop range analysis that finds portions of the code where a value is guaranteed to be dropped. If a value is dropped at all suspend points, then it is no longer included in the generator type. Note that we are using "dropped" in a generic sense to include any case in which a value has been moved. That is, we do not only look at calls to the `drop` function.

There are several phases to the drop tracking algorithm, and we'll go into more detail below.
1. Use `ExprUseVisitor` to find values that are consumed and borrowed.
2. `DropRangeVisitor` uses consume and borrow information to gather drop and reinitialization events, as well as build a control flow graph.
3. We then propagate drop and reinitialization information through the CFG until we reach a fix point (see `DropRanges::propagate_to_fixpoint`).
4. When recording a type (see `InteriorVisitor::record`), we check the computed drop ranges to see if that value is definitely dropped at the suspend point. If so, we skip including it in the type.

## 1. Use `ExprUseVisitor` to find values that are consumed and borrowed.

We use `ExprUseVisitor` to identify the places where values are consumed. We track both the `hir_id` of the value, and the `hir_id` of the expression that consumes it. For example, in the expression `[Foo]`, the `Foo` is consumed by the array expression, so after the array expression we can consider the `Foo` temporary to be dropped.

In this process, we also collect values that are borrowed. The reason is that the MIR transform for generators conservatively assumes anything borrowed is live across a suspend point (see `rustc_mir_transform::generator::locals_live_across_suspend_points`). We match this behavior here as well.

## 2. Gather drop events, reinitialization events, and control flow graph

After finding the values of interest, we perform a post-order traversal over the HIR tree to find the points where these values are dropped or reinitialized. We use the post-order index of each event because this is how the existing generator interior analysis refers to the position of suspend points and the scopes of variables.

During this traversal, we also record branching and merging information to handle control flow constructs such as `if`, `match`, and `loop`. This is necessary because values may be dropped along some control flow paths but not others.

## 3. Iterate to fixed point

The previous pass found the interesting events and locations, but now we need to find the actual ranges where things are dropped. Upon entry, we have a list of nodes ordered by their position in the post-order traversal. Each node has a set of successors. For each node we additionally keep a bitfield with one bit per potentially consumed value. The bit is set if we the value is dropped along all paths entering this node.

To compute the drop information, we first reverse the successor edges to find each node's predecessors. Then we iterate through each node, and for each node we set its dropped value bitfield to the intersection of all incoming dropped value bitfields.

If any bitfield for any node changes, we re-run the propagation loop again.

## 4. Ignore dropped values across suspend points

At this point we have a data structure where we can ask whether a value is guaranteed to be dropped at any post order index for the HIR tree. We use this information in `InteriorVisitor` to check whether a value in question is dropped at a particular suspend point. If it is, we do not include that value's type in the generator type.

Note that we had to augment the region scope tree to include all yields in scope, rather than just the last one as we did before.

r? `@nikomatsakis`
2022-01-20 23:37:29 +01:00
Rémy Rakic 820fd05e29 Update thorin-dwp to deduplicate object 2022-01-20 15:09:05 +01:00
pierwill 8d27c28e39 ⬆ chalk to 0.76.0 2022-01-19 13:44:43 -06:00
Guillaume Gomez 48f5dcad10 Move back templates into html folder 2022-01-19 11:13:24 +01:00
Guillaume Gomez 80b26bd401 Update dependencies 2022-01-19 11:02:24 +01:00
Eric Huss bfacc5cc73 Update cargo 2022-01-18 19:14:33 -08:00
Eric Holk b39fb9bb7b Fix control flow handling in generator_interior
All tests pass now! The issue was that we weren't handling all edges
correctly, but now they are handled consistently.

This includes code to dump a graphviz file for the CFG we built for drop
tracking.

Also removes old DropRanges tests.
2022-01-18 14:25:26 -08:00
Eric Holk ff0e8f4ba2 Revamped DropRange data structure
Not currently working. Need to flow drop information.
2022-01-18 14:25:26 -08:00
Eric Holk aa029d4bbe Support conditional drops
This adds support for branching and merging control flow and uses this
to correctly handle the case where a value is dropped in one branch of
an if expression but not another.

There are other cases we need to handle, which will come in follow up
patches.

Issue #57478
2022-01-18 14:25:24 -08:00
David Tolnay fe86dcf0cc
Delete pretty printer tracing 2022-01-18 12:33:42 -08:00
Guillaume Gomez ecd39aae0e Update pulldown-cmark version to fix markdown list issue 2022-01-17 20:58:42 +01:00
kadmin 67f56671d0 Use Term in ProjectionPredicate
ProjectionPredicate should be able to handle both associated types and consts so this adds the
first step of that. It mainly just pipes types all the way down, not entirely sure how to handle
consts, but hopefully that'll come with time.
2022-01-17 17:44:56 +00:00
Matthias Krüger 681271e045
Rollup merge of #92819 - euclio:atty, r=CraftSpider
rustdoc: remove hand-rolled isatty

This PR replaces bindings to the platform-specific isatty APIs with the `isatty` crate, as done elsewhere in the repository.
2022-01-17 06:08:14 +01:00
Igor Matuszewski 69c3b723d2 Use new Racer from crates.io 2022-01-16 15:30:47 +01:00
Igor Matuszewski d83c44a03b Update RLS and drop rustc-ap-packages 2022-01-16 15:30:46 +01:00
bors 42852d7857 Auto merge of #92740 - cuviper:update-rayons, r=Mark-Simulacrum
Update rayon and rustc-rayon

This updates rayon for various tools and rustc-rayon for the compiler's parallel mode.

- rayon v1.3.1 -> v1.5.1
- rayon-core v1.7.1 -> v1.9.1
- rustc-rayon v0.3.1 -> v0.3.2
- rustc-rayon-core v0.3.1 -> v0.3.2

... and indirectly, this updates all of crossbeam-* to their latest versions.

Fixes #92677 by removing crossbeam-queue, but there's still a lingering question about how tidy discovers "runtime" dependencies. None of this is truly in the standard library's dependency tree at all.
2022-01-16 08:12:23 +00:00
Rémy Rakic 3713562c6a Update rand to deduplicate it 2022-01-14 13:05:27 +01:00
Rémy Rakic 5928056af2 Update itertools to deduplicate it 2022-01-14 12:33:54 +01:00
Matthias Krüger ccfee3d53b
Rollup merge of #92849 - flip1995:clippyup, r=Manishearth
Clippyup

r? ```@Manishearth```
2022-01-14 07:47:37 +01:00
Andy Russell 51d7665be1
rustdoc: remove hand-rolled isatty 2022-01-13 11:13:01 -05:00
flip1995 159d6c356e
Update Cargo.lock 2022-01-13 13:18:51 +01:00
Matthias Krüger a9fe2b95da
Rollup merge of #92807 - ehuss:update-cargo, r=ehuss
Update cargo

6 commits in 358e79fe56fe374649275ca7aebaafd57ade0e8d..06b9d31743210b788b130c8a484c2838afa6fc27
2022-01-04 18:39:45 +0000 to 2022-01-11 23:47:29 +0000
- Port cargo to clap3 (rust-lang/cargo#10265)
- feat: support rustflags per profile (rust-lang/cargo#10217)
- Make bors ignore the PR template so it doesn't end up in merge messages (rust-lang/cargo#10267)
- Be resilient to most IO error and filesystem loop while walking dirs (rust-lang/cargo#10214)
- Remove the option to disable pipelining (rust-lang/cargo#10258)
- Always ask rustc for messages about artifacts, and always process them (rust-lang/cargo#10255)
2022-01-13 08:11:22 +01:00
Matthias Krüger c7ada001ec
Rollup merge of #90001 - Fearyncess:master, r=alexcrichton
Make rlib metadata strip works with MIPSr6 architecture

Because MIPSr6 has many differences with previous MIPSr2 arch, the previous rlib metadata stripping code in `rustc_codegen_ssa` is only for MIPSr2/r3/r5 (which share the same elf e_flags).

This commit fixed this problem. It makes `rustc_codegen_ssa` happy when compiling rustc for MIPSr6 target or hosts.

e_flags REF: e356027016/llvm/include/llvm/BinaryFormat/ELF.h (L562)
2022-01-13 08:11:16 +01:00
Eric Huss 66f1e322c6 Update cargo 2022-01-11 20:18:29 -08:00
Josh Stone f3b8812f24 Update rayon and rustc-rayon 2022-01-10 11:34:07 -08:00
Dirkjan Ochtman 93a16cb7e2 Migrate rustdoc from Tera to Askama
See #84419.
2022-01-10 18:40:54 +01:00
Lain Yang 9a337b6fe0 update Cargo.lock and gimli-rs/object for rustc_codegen_ssa 2022-01-07 13:33:20 +08:00
David Wood 2dc1a8a779 cg: use thorin instead of llvm-dwp
`thorin` is a Rust implementation of a DWARF packaging utility that
supports reading DWARF objects from archive files (i.e. rlibs) and
therefore is better suited for integration into rustc.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-01-06 09:32:42 +00:00
Matthias Krüger a0673468ae
Rollup merge of #92579 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/92527
2022-01-05 11:26:09 +01:00
Matthias Krüger d83dd85253
Rollup merge of #92545 - dtolnay:rustlog, r=petrochenkov
Extract init_env_logger to crate

I've been doing some work on rustc_ast_pretty using an out-of-tree main.rs and Cargo.toml with the following:

```toml
[dependencies]
rustc_ast = { path = "../rust/compiler/rustc_ast" }
rustc_ast_pretty = { path = "../rust/compiler/rustc_ast_pretty" }
rustc_span = { path = "../rust/compiler/rustc_span" }
```

Rustc_ast_pretty helpfully uses `tracing::debug!` but I found that in order to enable the debug output, my test crate must depend on rustc_driver which is an enormously bigger dependency than what I have been using so far, and slows down iteration time because an enormous dependency tree between rustc_ast and rustc_driver must now be rebuilt after every ast change.

I pulled out the tracing initialization to a new minimal rustc_log crate so that projects depending on the other rustc crates, like rustc_ast_pretty, can access the `debug!` messages in them without building all the rest of rustc.
2022-01-05 11:26:08 +01:00
Ralf Jung e568423815 update Miri 2022-01-05 10:41:22 +01:00
David Tolnay ffbeebbf7a
Make rustc_log doc test runnable 2022-01-03 22:31:56 -08:00
David Tolnay 6152d15e7c
Extract init_env_logger to crate 2022-01-03 16:45:21 -08:00
Krasimir Georgiev a9698e22ec revert #92254 "Bump gsgdt to 0.1.3"
gsgdt 0.1.3 was yanked:
https://github.com/rust-lang/rust/pull/92254#issuecomment-1004269481
2022-01-03 20:25:46 +01:00
bjorn3 ad6f98cd28 Remove the merge dependency 2022-01-01 17:03:24 +01:00
bjorn3 043745cb96 Avoid the merge derive macro in rustbuild
The task of the macro is simple enough that a decl macro is almost ten
times shorter than the original proc macro. The proc macro is 159 lines
while the decl macro is just 18 lines.

This reduces the amount of dependencies of rustbuild from 45 to 37. It
also slight reduces compilation time from 47s to 44s for debug builds.
2022-01-01 16:56:03 +01:00
bjorn3 2fe2728fa9 Remove the lazy_static dependency from rustbuild
Rustbuild already depends on once_cell which in the future can be
replaced with std::lazy::Lazy.
2022-01-01 16:53:47 +01:00
bors ad0d4190fa Auto merge of #92374 - ehuss:update-libssh2-sys, r=Mark-Simulacrum
Update libssh2-sys

Updates libssh2-sys from 0.2.19 to 0.2.23.  This brings in libssh2 1.10 ([RELEASE-NOTES](https://github.com/libssh2/libssh2/blob/libssh2-1.10.0/RELEASE-NOTES)).  One of the major changes is to add support for OpenSSH agent on Windows.

Closes https://github.com/rust-lang/cargo/issues/10237
2022-01-01 05:21:22 +00:00
bors cfa3fe5af3 Auto merge of #90637 - Mark-Simulacrum:liveness-btree, r=lqd
Store liveness in interval sets for region inference

On the 100,000 line test case from https://github.com/rust-lang/rust/issues/90445, this reduces memory usage from 35 GB to 444 MB at peak (based on DHAT results, though with regular malloc), and yields a 9.4x speedup, with wall time going from 14.5 seconds to 1.5s. Performance results show that for the majority of real-world code this has little to no impact, but it's expected to generally scale better for auto-generated functions and other cases which stress this area of the compiler, as results on #90445 illustrate.

There may also be further room for improvement in future PRs making use of this data structures benefits over raw bitsets (which, at some level, are a less perfect fit for representing liveness, which is almost always composed of contiguous ranges, not point locations).

Fixes #90445.
2021-12-31 19:54:10 +00:00
bors 8ed935e92d Auto merge of #92252 - GuillaumeGomez:update-pulldown, r=camelid,xFrednet
Update pulldown-cmark version to 0.9

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

r? `@camelid`
2021-12-31 12:46:38 +00:00
Mark Rousskov 00c55a1bb8 Introduce IntervalSet
This is a compact, fast storage for variable-sized sets, typically consisting of
larger ranges. It is less efficient than a bitset if ranges are both small and
the domain size is small, but will still perform acceptably. With enormous
domain sizes and large ranges, the interval set performs much better, as it can
be much more densely packed in memory than the uncompressed bit set alternative.
2021-12-30 22:33:44 -05:00
Eric Huss 000d336216 Update libssh2-sys 2021-12-28 13:24:03 -08:00
Guillaume Gomez 4e2024c55d Update pulldown-cmark version in clippy 2021-12-28 16:19:23 +01:00
Guillaume Gomez b5898a1137 Update pulldown-cmark version to 0.9 2021-12-28 16:17:22 +01:00