about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src
AgeCommit message (Collapse)AuthorLines
2023-01-29Auto merge of #106227 - bryangarza:ctfe-limit, r=oli-obkbors-1/+48
Use stable metric for const eval limit instead of current terminator-based logic This patch adds a `MirPass` that inserts a new MIR instruction `ConstEvalCounter` to any loops and function calls in the CFG. This instruction is used during Const Eval to count against the `const_eval_limit`, and emit the `StepLimitReached` error, replacing the current logic which uses Terminators only. The new method of counting loops and function calls should be more stable across compiler versions (i.e., not cause crates that compiled successfully before, to no longer compile when changes to the MIR generation/optimization are made). Also see: #103877
2023-01-26Rollup merge of #107168 - ↵Matthias Krüger-2/+1
Nilstrieb:if-a-tait-falls-in-the-forest,can-we-know-it-wasnt-revealed, r=oli-obk Use a type-alias-impl-trait in `ObligationForest`
2023-01-24Improve efficiency of has_back_edge(...)Bryan Garza-0/+7
2023-01-23Add comment on cause of panic in dominators algorithmBryan Garza-1/+41
2023-01-23Rollup merge of #107153 - tmiasko:dominates, r=oli-obkYuki Okushi-1/+1
Consistently use dominates instead of is_dominated_by There is a number of APIs that answer dominance queries. Previously they were named either "dominates" or "is_dominated_by". Consistently use the "dominates" form. No functional changes.
2023-01-21Use a type-alias-impl-trait in `ObligationForest`Nilstrieb-2/+1
2023-01-21Auto merge of #106977 - michaelwoerister:unord_id_collections, r=oli-obkbors-8/+235
Use UnordMap and UnordSet for id collections (DefIdMap, LocalDefIdMap, etc) This PR changes the `rustc_data_structures::define_id_collections!` macro to use `UnordMap` and `UnordSet` instead of `FxHashMap` and `FxHashSet`. This should account for a large portion of hash-maps being used in places where they can cause trouble. The changes required are moderate but non-zero: - In some places the collections are extracted into sorted vecs. - There are a few instances where for-loops have been changed to extends. ~~Let's see what the performance impact is. With a bit more refactoring, we might be able to get rid of some of the additional sorting -- but the change set is already big enough. Unless there's a performance impact, I'd like to do further changes in subsequent PRs.~~ Performance does not seem to be negatively affected ([perf-run here](https://github.com/rust-lang/rust/pull/106977#issuecomment-1396776699)). Part of [MCP 533](https://github.com/rust-lang/compiler-team/issues/533). r? `@ghost`
2023-01-21Consistently use dominates instead of is_dominated_byTomasz Miąsko-1/+1
There is a number of APIs that answer dominance queries. Previously they were named either "dominates" or "is_dominated_by". Consistently use the "dominates" form. No functional changes.
2023-01-21Auto merge of #106976 - tmiasko:borrowck-lazy-dominators, r=cjgillotbors-4/+0
Lazy dominator tree construction in borrowck Motivated by the observation that sometimes constructed dominator tree was never queried.
2023-01-20Auto merge of #106090 - WaffleLapkin:dereffffffffff, r=Nilstriebbors-24/+22
Remove some `ref` patterns from the compiler Previous PR: https://github.com/rust-lang/rust/pull/105368 r? `@Nilstrieb`
2023-01-19Clean up and document unord collections a bit.Michael Woerister-38/+66
2023-01-19Rollup merge of #107037 - tmiasko:rank, r=oli-obkGuillaume Gomez-1/+1
Fix Dominators::rank_partial_cmp to match documentation The only use site is also updated accordingly and there is no change in end-to-end behaviour.
2023-01-19Allow for more efficient sorting when exporting Unord collections.Michael Woerister-7/+80
2023-01-19Use UnordMap instead of FxHashMap in define_id_collections!().Michael Woerister-3/+109
2023-01-19Use UnordSet instead of FxHashSet in define_id_collections!().Michael Woerister-4/+24
2023-01-18Also remove `#![feature(control_flow_enum)]` where possibleScott McMurray-1/+0
2023-01-18Fix Dominators::rank_partial_cmp to match documentationTomasz Miąsko-1/+1
The only use site is also updated accordingly and there is no change in end-to-end behaviour.
2023-01-17Stop using `BREAK` & `CONTINUE` in compilerScott McMurray-4/+4
Switching them to `Break(())` and `Continue(())` instead. libs-api would like to remove these constants, so stop using them in compiler to make the removal PR later smaller.
2023-01-17Lazy dominator tree construction in borrowckTomasz Miąsko-4/+0
Motivated by the observation that sometimes constructed dominator tree was never queried.
2023-01-17Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726Matthias Krüger-3/+3
Remove double spaces after dots in comments Most of the comments do not have double spaces, so I assume these are typos.
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-3/+3
2023-01-17`rustc_data_structures`: remove `ref` patterns and other artifacts of the pastMaybe Waffle-24/+22
2023-01-16Document wf constraints on control flow in cleanup blocksJakob Degen-1/+4
Also fixes a bug in dominator computation
2023-01-12Harden the pre-tyctxt query system against accidental recomputationOli Scherer-0/+5
2023-01-05Fix `uninlined_format_args` for some compiler cratesnils-18/+15
Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).
2023-01-02Reduce HIR debug outputNilstrieb-1/+8
HIR debug output is currently very verbose, especially when used with the alternate (`#`) flag. This commit reduces the amount of noisy newlines by forcing a few small key types to stay on one line, which makes the output easier to read and scroll by. ``` $ rustc +after hello_world.rs -Zunpretty=hir-tree | wc -l 582 $ rustc +before hello_world.rs -Zunpretty=hir-tree | wc -l 932 ```
2022-12-25fix some typosKaDiWa-1/+1
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-11/+8
2022-12-18A few small cleanups for `newtype_index`Nilstrieb-1/+1
Remove the `..` from the body, only a few invocations used it and it's inconsistent with rust syntax. Use `;` instead of `,` between consts. As the Rust syntax gods inteded.
2022-12-15more clippy::complexity fixesMatthias Krüger-4/+4
2022-12-12minor code cleanupsMatthias Krüger-1/+1
2022-12-10compiler: remove unnecessary imports and qualified pathsKaDiWa-20/+5
2022-12-06Rollup merge of #104898 - oli-obk:group_all_the_things, r=wesleywiserMatthias Krüger-83/+0
Put all cached values into a central struct instead of just the stable hash cc `@nnethercote` this allows re-use of the type for Predicate without duplicating all the logic for the non-hash cached fields
2022-12-06Auto merge of #105175 - michaelwoerister:add-stable-ord-trait, r=nagisabors-33/+79
Add StableOrd trait as proposed in MCP 533. The `StableOrd` trait can be used to mark types as having a stable sort order across compilation sessions. Collections that sort their items in a stable way can safely implement HashStable by hashing items in sort order. See https://github.com/rust-lang/compiler-team/issues/533 for more information.
2022-12-05StableOrd: Address review comments.Michael Woerister-19/+19
2022-12-03Auto merge of #105218 - matthiaskrgr:rollup-8d3k08n, r=matthiaskrgrbors-24/+24
Rollup of 9 pull requests Successful merges: - #104199 (Keep track of the start of the argument block of a closure) - #105050 (Remove useless borrows and derefs) - #105153 (Create a hacky fail-fast mode that stops tests at the first failure) - #105164 (Restore `use` suggestion for `dyn` method call requiring `Sized`) - #105193 (Disable coverage instrumentation for naked functions) - #105200 (Remove useless filter in unused extern crate check.) - #105201 (Do not call fn_sig on non-functions.) - #105208 (Add AmbiguityError for inconsistent resolution for an import) - #105214 (update Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-12-03Rollup merge of #105050 - WaffleLapkin:uselessrefign, r=jyn514Matthias Krüger-24/+24
Remove useless borrows and derefs They are nothing more than noise. <sub>These are not all of them, but my clippy started crashing (stack overflow), so rip :(</sub>
2022-12-03Auto merge of #97485 - bjorn3:new_archive_writer, r=wesleywiserbors-0/+6
Rewrite LLVM's archive writer in Rust This allows it to be used by other codegen backends. Fixes https://github.com/bjorn3/rustc_codegen_cranelift/issues/1155
2022-12-02Add StableOrd trait as proposed in MCP 533.Michael Woerister-34/+80
The StableOrd trait can be used to mark types as having a stable sort order across compilation sessions. Collections that sort their items in a stable way can safely implement HashStable by hashing items in sort order.
2022-12-01`rustc_data_structures` deref in a more humane wayMaybe Waffle-12/+12
2022-12-01Remove useless borrows and derefsMaybe Waffle-12/+12
2022-12-01rustc_hir: Change representation of import paths to support multiple resolutionsVadim Petrochenkov-1/+1
2022-11-30move WithCachedTypeInfo to rustc_type_irOli Scherer-83/+0
2022-11-30s/WithStableHash/WithCachedTypeInfo/Oli Scherer-10/+10
2022-11-28fix documentNeutron3529-2/+2
https://users.rust-lang.org/t/is-the-document-in-sortedmap-in-rustc-data-structures-sorted-map-correct/84939 SortedMap have `O(n)` insertions and removal rather than `O(log(n))`
2022-11-26Rewrite LLVM's archive writer in Rustbjorn3-0/+6
This allows it to be used by other codegen backends
2022-11-19Auto merge of #97870 - eggyal:inplace_fold_spec, r=wesleywiserbors-34/+2
Use liballoc's specialised in-place vec collection liballoc already specialises in-place vector collection, so manually reimplementing it in `IdFunctor::try_map_id` was superfluous.
2022-11-11Use the interned stable hash as plain hash.Camille GILLOT-1/+5
2022-11-11Hash spans when interning.Camille GILLOT-7/+2
2022-11-01Add track_caller to some Lock methodsCameron Steffen-0/+11