summary refs log tree commit diff
path: root/src/librustc_data_structures
AgeCommit message (Collapse)AuthorLines
2020-01-23Revert parts of #66405.Nicholas Nethercote-111/+80
Because it caused major performance regressions in some cases. That PR had five commits, two of which affected performance, and three of which were refactorings. This change undoes the performance-affecting changes, while keeping the refactorings in place. Fixes #67454.
2020-01-23fmt data data structuresMark Rousskov-68/+51
2019-12-13Avoid re-processing nodes in `find_cycles_from_node`.Nicholas Nethercote-4/+8
2019-12-13Remove an unnecessary local variable.Nicholas Nethercote-2/+1
2019-12-13Remove some `debug!` statements.Nicholas Nethercote-19/+1
Because I am tired of looking at them.
2019-12-13Move functions around.Nicholas Nethercote-59/+59
In particular, it has bugged me for some time that `process_cycles` is currently located before `mark_still_waiting_nodes` despite being called afterwards.
2019-12-13Remove `NodeState::{Waiting,Done}`.Nicholas Nethercote-87/+126
`NodeState` has two states, `Success` and `Done`, that are only used within `ObligationForest` methods. This commit removes them, and renames the existing `Waiting` state as `Success`. We are left with three states: `Pending`, `Success`, and `Error`. `Success` is augmented with a new `WaitingState`, which indicates when (if ever) it was last waiting on one or more `Pending` nodes. This notion of "when" requires adding a "process generation" to `ObligationForest`; it is incremented on each call to `process_obligtions`. This commit is a performance win. - Most of the benefit comes from `mark_as_waiting` (which the commit renames as `mark_still_waiting_nodes`). This function used to do two things: (a) change all `Waiting` nodes to `Success`, and (b) mark all nodes that depend on a pending node as `Waiting`. In practice, many nodes went from `Waiting` to `Success` and then immediately back to `Waiting`. The use of generations lets us skip step (a). - A smaller benefit comes from not having to change nodes to the `Done` state in `process_cycles`.
2019-12-11Make TinyList::remove iterate instead of recurseAndre Bogus-24/+16
2019-12-09Auto merge of #67016 - lqd:placeholder_loans, r=matthewjasperbors-0/+8
In which we implement illegal subset relations errors using Polonius This PR is the rustc side of implementing subset errors using Polonius. That is, in ```rust fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'a u32 { y } ``` returning `y` requires that `'b: 'a` but we have no evidence of that, so this is an error. (Evidence that the relation holds could come from explicit bounds, or via implied bounds). Polonius outputs one such error per CFG point where the free region's placeholder loan unexpectedly flowed into another free region. While all these CFG locations could be useful in diagnostics in the future, rustc does not do that (and the duplication is only partially handled in the rest of the errors/diagnostics infrastructure, e.g. duplicate suggestions will be shown by the "outlives suggestions" or some of the `#[rustc_*]` NLL/MIR debug dumps), so I deduplicated the errors. (The ordering also matters, otherwise some of the elided lifetime naming would change behaviour). I've blessed a couple of tests, where the output is currently suboptimal: - the `hrtb-perfect-forwarding` tests mix subset errors with higher-ranked subtyping, however the plan is for chalk to eventually take care of some of this to generate polonius constraints (i.e. it's not polonius' job). Until that happens, polonius will not see the error that NLL sees. - some other tests have errors and diagnostics specific to `'static`, I _believe_ this to be because of it being treated as more "special" than in polonius. I believe the output is not wrong, but could be better, and appears elsewhere (I feel we'll need to look at polonius' handling of `'static` at some point in the future, maybe to match a bit more what NLL does when it produces errors) I'll create a tracking issue in the polonius repo to record these 2 points (and a general "we'll need to go over the blessed output" issue, much like we did for NLLs) The last blessed test is because it's an improvement: in this case, more errors/suggestions were computed, instead of the existing code path where this case apparently stops at the first error. The `Naive` variant in Polonius computes those errors, so this PR also switches the default variant to that, as we're also in the process of temporarily deactivating all other variants (which exist mostly for performance considerations) until we have completed more work on completeness and correctness, before focusing on efficiency once again. While most of the correctness in this PR is hidden in the polonius compare-mode (which of course passes locally), I've added a couple of smoke-tests to the existing ones, so that we have some confidence that it works (and keeps working) until we're in a position where we can run them on CI. As mentioned during yesterday's wg-polonius meeting, @nikomatsakis has already read through most of this PR (and which is matching what they thought needed to be done [during the recent Polonius sprint](https://hackmd.io/CGMNjt1hR_qYtsR9hgdGmw#Compiler-notes-on-generating-the-placeholder-loans-support)), but Matthew was hopefully going to review (again, not urgent), so: r? @matthewjasper (This updates to the latest `polonius-engine` release, and I'm not sure whether `Cargo.lock` updates can easily be rolled up, but apart from that: this changes little that's tested on CI, so seems safe-ish to rollup ?)
2019-12-08Auto merge of #66981 - michaelwoerister:measureme-0.5.0, r=Mark-Simulacrumbors-12/+9
Update measureme crate to 0.5.0 This PR updates the `measureme` self-profiling crate to the latest release. Heads up, this version changes the trace file format, so the `summarize` tool on perf.rlo needs to be updated to 0.5 too. r? @Mark-Simulacrum cc @wesleywiser
2019-12-06Add a way to list the base non-transitive edges in `TransitiveRelation`Remy Rakic-0/+8
2019-12-04Auto merge of #66408 - nnethercote:greedy-process_obligations, r=nmatsakisbors-10/+33
Make `process_obligations()` greedier. `process_obligations()` adds new nodes, but it does not process these new nodes until the next time it is called. This commit changes it so that it does process these new nodes within the same call. This change reduces the number of calls to `process_obligations()` required to complete processing, sometimes giving significant speed-ups. The change required some changes to tests. - The output of `cycle-cache-err-60010.rs` is slightly different. - The unit tests required extra cases to handle the earlier processing of the added nodes. I mostly did these in the simplest possible way, by making the added nodes be ignored, thus giving outcomes the same as with the old behaviour. But I changed `success_in_grandchildren()` more extensively so that some obligations are completed earlier than they used to be. r? @nikomatsakis
2019-12-03Re-export Client from rustc_data_structures::jobserverMark Rousskov-1/+1
2019-12-03Update measureme crate to 0.5.0.Michael Woerister-12/+9
2019-12-02Undo minor changes that weren't needed, fix one lifetime typoPaul Daniel Faria-0/+1
2019-12-02Account for new maybe_sideeffect helper that requires predecessorsPaul Daniel Faria-34/+3
2019-12-02Move predecessor cache outside of Body, use wrapper types to manage Cache ↵Paul Daniel Faria-11/+42
and Body (WIP, amend this commit)
2019-11-26Fix spelling typosBrian Wignall-1/+1
2019-11-23Rollup merge of #66657 - ollie27:rustdoc_flock_panic, r=GuillaumeGomezMazdak Farrokhzad-12/+0
rustdoc: Don't panic when failing to write .lock file It can be treated like any other unexpected IO error. I couldn't think of a good way to add a test for this unfortunately. r? @GuillaumeGomez
2019-11-23rustdoc: Don't panic when failing to write .lock fileOliver Middleton-12/+0
It can be treated like any other unexpected IO error.
2019-11-17Implement HashStable for RangeInclusive.Camille GILLOT-0/+10
2019-11-15Rollup merge of #66013 - nnethercote:avoid-hashing-twice-in-get_query, r=ZoxcYuki Okushi-0/+6
Avoid hashing the key twice in `get_query()`. For a single-threaded parallel compiler, this reduces instruction counts across several benchmarks, by up to 2.8%. The commit also adds documentation about `Sharded`'s use of `FxHasher`. r? @Zoxc
2019-11-15Make `process_obligations()` greedier.Nicholas Nethercote-10/+33
`process_obligations()` adds new nodes, but it does not process these new nodes until the next time it is called. This commit changes it so that it does process these new nodes within the same call. This change reduces the number of calls to `process_obligations()` required to complete processing, sometimes giving significant speed-ups. The change required some changes to tests. - The output of `cycle-cache-err-60010.rs` is slightly different. - The unit tests required extra cases to handle the earlier processing of the added nodes. I mostly did these in the simplest possible way, by making the added nodes be ignored, thus giving outcomes the same as with the old behaviour. But I changed `success_in_grandchildren()` more extensively so that some obligations are completed earlier than they used to be.
2019-11-12Register queries with self profiler in rustc_interfaceMark Rousskov-0/+6
2019-11-12Move self-profile infrastructure to data structuresMark Rousskov-0/+318
The single dependency on queries (QueryName) can be fairly easily abstracted via a trait and this further decouples Session from librustc (the primary goal).
2019-11-04bump smallvec to 1.0Ralf Jung-1/+1
2019-11-04Avoid hashing the key twice in `get_query()`.Nicholas Nethercote-0/+6
For a single-threaded parallel compiler, this reduces instruction counts across several benchmarks, by up to 2.8%. The commit also adds documentation about `Sharded`'s use of `FxHasher`.
2019-11-01Rollup merge of #65997 - spastorino:fix-init_locking-rustdoc, r=Mark-SimulacrumTyler Mandry-4/+4
Fix outdated rustdoc of Once::init_locking function r? @Mark-Simulacrum related to https://github.com/rust-lang/rust/pull/65979
2019-11-01Rollup merge of #65112 - jack-t:type-parens-lint, r=varkorTyler Mandry-4/+4
Add lint and tests for unnecessary parens around types This is my first contribution to the Rust project, so I apologize if I'm not doing things the right way. The PR fixes #64169. It adds a lint and tests for unnecessary parentheses around types. I've run `tidy` and `rustfmt` &mdash; I'm not totally sure it worked right, though &mdash; and I've tried to follow the instructions linked in the readme. I tried to think through all the variants of `ast::TyKind` to find exceptions to this lint, and I could only find the one mentioned in the original issue, which concerns types with `dyn`. I'm not a Rust expert, thought, so I may well be missing something. There's also a problem with getting this to build. The new lint catches several things in the, e.g., `core`. Because `x.py` seems to build with an equivalent of `-Werror`, what would have been warnings cause the build to break. I got it to build and the tests to pass with `--warnings warn` on my `x.py build` and `x.py test` commands.
2019-10-31Fix outdated rustdoc of Once::init_locking functionSantiago Pastorino-4/+4
2019-10-30Make init_locking return a reference to the initialized dataSantiago Pastorino-6/+8
2019-10-29Add lint for unnecessary parens around typesjack-t-4/+4
2019-10-23Rollup merge of #65648 - nnethercote:rm-intersect_opt, r=nikomatsakisMazdak Farrokhzad-21/+6
Eliminate `intersect_opt`. Its fourth argument is always `Some(pred)`, so the pattern matching is unnecessary. This commit inlines and removes it. r? @nikomatsakis
2019-10-21Remove many unnecessary trait derivations.Nicholas Nethercote-11/+11
2019-10-21Eliminate `intersect_opt`.Nicholas Nethercote-21/+6
Its fourth argument is always `Some(pred)`, so the pattern matching is unnecessary. This commit inlines and removes it.
2019-10-21Remove unnecessary `Hash` bounds from various types.Nicholas Nethercote-5/+5
2019-10-17Use a sharded dep node to dep node index mapJohn Kåre Alsaker-7/+23
2019-10-14Rename serial_join and serial_scope to join and scopeSantiago Pastorino-25/+22
2019-10-14Move serial_scope and serial_join to parallel_compiler = falseSantiago Pastorino-23/+23
2019-10-14Minor comment tweaksSantiago Pastorino-2/+2
2019-10-07Rebase rustc-rayon on rayon-1.2Josh Stone-2/+2
See also https://github.com/rust-lang/rustc-rayon/pull/3
2019-10-01Rollup merge of #64942 - JohnTitor:fix-clippy, r=eddybTyler Mandry-2/+2
Fix clippy warnings * Use `match` instead of `if` chain * Remove redundant `into_iter()` * Use `copied()` instead of `map()` etc.
2019-10-01Rollup merge of #64805 - nnethercote:ObligForest-still-more, r=nikomatsakisTyler Mandry-126/+115
Still more `ObligationForest` improvements. Following on from #64627, more readability improvements, but negligible effects on speed. r? @nikomatsakis
2019-10-01Fix clippy warningsYuki Okushi-2/+2
2019-09-30Avoid the popping loop at the end of `compress()`.Nicholas Nethercote-34/+40
By collecting the done obligations (when necessary) in the main loop. This makes the code cleaner. The commit also changes the order in which successful obligations are returned -- they are now returned in the registered order, rather than reversed. Because this order doesn't actually matter, being only used by tests, the commit uses `sort()` to make the test agnostic w.r.t. the order.
2019-09-30Remove an out-of-date sentence in a comment.Nicholas Nethercote-3/+2
2019-09-30Rename `nodes_len` and use it in a few more places.Nicholas Nethercote-9/+9
2019-09-30Convert some `match` expressions to `if`s.Nicholas Nethercote-36/+21
These make the code more concise.
2019-09-30Introduce some intermediate variables that aid readability.Nicholas Nethercote-3/+5
2019-09-30Remove unnecessary uses of `ObligationForest::scratch`.Nicholas Nethercote-12/+8
They don't help performance at all, and just complicate things.