summary refs log tree commit diff
path: root/compiler/rustc_data_structures
AgeCommit message (Collapse)AuthorLines
2024-02-15Update jobserver-rs to 0.1.28Vadim Petrochenkov-2/+5
(cherry picked from commit 83f3bc42714250633cacadcde8b15da28bf443f0)
2024-01-25Remove unused featuresclubby789-1/+1
2024-01-24rustc_data_structures: use either instead of itertoolsJosh Stone-3/+3
2024-01-22Auto merge of #120080 - cuviper:128-align-packed, r=nikicbors-0/+72
Pack u128 in the compiler to mitigate new alignment This is based on #116672, adding a new `#[repr(packed(8))]` wrapper on `u128` to avoid changing any of the compiler's size assertions. This is needed in two places: * `SwitchTargets`, otherwise its `SmallVec<[u128; 1]>` gets padded up to 32 bytes. * `LitKind::Int`, so that entire `enum` can stay 24 bytes. * This change definitely has far-reaching effects though, since it's public.
2024-01-20Auto merge of #116185 - Zoxc:rem-one-thread, r=cjgillotbors-57/+0
Remove `OneThread` This removes `OneThread` by switching `incr_comp_session` over to `RwLock`.
2024-01-19Add Pu128 = #[repr(packed(8))] u128Josh Stone-0/+72
2024-01-19Auto merge of #120076 - Mark-Simulacrum:unhash, r=cjgillotbors-2/+24
Use UnhashMap for a few more maps This avoids a few cases of hashing data that's already hashed. cc https://github.com/rust-lang/rust/issues/56308
2024-01-18Auto merge of #114231 - ttsugriy:binary_search_slice, r=cjgillotbors-21/+4
[rustc_data_structures] Use partition_point to find slice range end. This PR uses approach introduced in https://github.com/rust-lang/rust/pull/114152 to find the end of the range. It's much easier to understand and reason about invariants of such implementation. Technically it's possible to make it even shorter by returning `&[start..end]` unconditionally because even if searched item is not present in the slice, `start` and `end` would point at the same index, so the range would be empty. The reason I decided not to use this shorter implementation is because it would involve more comparisons in case there are no elements in the slice with key equal to `key`. Also, not that it matters much, but this implementation also improves perf according to the benchmark below: https://gist.github.com/ttsugriy/63c0ed39ae132b131931fa1f8a3dea55 The results on my M1 macbook air are: ``` Running benches/bin_search_slice_benchmark.rs (target/release/deps/bin_search_slice_benchmark-90fa6d68c3bd1298) Benchmarking multiply add/binary_search_slice: Collecting 100 samples in estimated 5.0002 s (1 multiply add/binary_search_slice time: [44.719 ns 44.918 ns 45.158 ns] No change in performance detected. Found 3 outliers among 100 measurements (3.00%) 1 (1.00%) high mild 2 (2.00%) high severe Benchmarking multiply add/binary_search_slice_new: Collecting 100 samples in estimated 5.0001 multiply add/binary_search_slice_new time: [36.955 ns 37.060 ns 37.221 ns] No change in performance detected. Found 7 outliers among 100 measurements (7.00%) 3 (3.00%) high mild 4 (4.00%) high severe ```
2024-01-18Remove `OneThread`John Kåre Alsaker-57/+0
2024-01-17Use UnhashMap for a few more mapsMark Rousskov-2/+24
This avoids hashing data that's already hashed.
2024-01-13Update measureme crate to version 11Michael Woerister-1/+1
2024-01-09Rollup merge of #119527 - klensy:ordering, r=compiler-errorsGuillaume Gomez-5/+2
don't reexport atomic::ordering via rustc_data_structures, use std import This looks simpler.
2024-01-06Rollup merge of #119591 - Enselic:DestinationPropagation-stable, r=cjgillotMatthias Krüger-0/+1
rustc_mir_transform: Make DestinationPropagation stable for queries By using `FxIndexMap` instead of `FxHashMap`, so that the order of visiting of locals is deterministic. We also need to bless `copy_propagation_arg.foo.DestinationPropagation.panic*.diff`. Do not review the diff of the diff. Instead look at the diff files before and after this commit. Both before and after this commit, 3 statements are replaced with nop. It's just that due to change in ordering, different statements are replaced. But the net result is the same. In other words, compare this diff (before fix): * https://github.com/rust-lang/rust/blob/090d5eac722000906cc00d991f2bf052b0e388c3/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff With this diff (after fix): * https://github.com/rust-lang/rust/blob/f603babd63a607e155609dc0277806e559626ea0/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff and you can see that both before and after the fix, we replace 3 statements with `nop`s. I find it _slightly_ surprising that the test this PR affects did not previously fail spuriously due to the indeterminism of `FxHashMap`, but I guess in can be explained with the predictability of small `FxHashMap`s with `usize` (`Local`) keys, or something along those lines. This should fix [this](https://github.com/rust-lang/rust/pull/119252#discussion_r1436101791) comment, but I wanted to make a separate PR for this fix for a simpler development and review process. Part of https://github.com/rust-lang/rust/issues/84447 which is E-help-wanted. r? `@cjgillot` who is reviewer for the highly related PR https://github.com/rust-lang/rust/pull/119252.
2024-01-06don't reexport atomic::ordering via rustc_data_structures, use std importklensy-5/+2
2024-01-06Auto merge of #119478 - bjorn3:no_serialize_specialization, r=wesleywiserbors-5/+5
Avoid specialization in the metadata serialization code With the exception of a perf-only specialization for byte slices and byte vectors. This uses the same trick of introducing a new trait and having the Encodable and Decodable derives add a bound to it as used for TyEncoder/TyDecoder. The new code is clearer about which encoder/decoder uses which impl and it reduces the dependency of rustc on specialization, making it easier to remove support for specialization entirely or turn it into a construct that is only allowed for perf optimizations if we decide to do this.
2024-01-06Auto merge of #119459 - cjgillot:inline-mir-utils, r=compiler-errorsbors-0/+1
Inline a few utility functions around MIR Most of them are small enough to benefit from inlining.
2024-01-05rustc_mir_transform: Make DestinationPropagation stable for queriesMartin Nordholts-0/+1
By using FxIndexMap instead of FxHashMap, so that the order of visiting of locals is deterministic. We also need to bless copy_propagation_arg.foo.DestinationPropagation.panic*.diff. Do not review the diff of the diff. Instead look at the diff file before and after this commit. Both before and after this commit, 3 statements are replaced with nop. It's just that due to change in ordering, different statements are replaced. But the net result is the same.
2024-01-04Address review comments and add back some #[inline] attrs from removed commits.Michael Woerister-0/+2
2024-01-04Provide generalized collect methods for UnordItemsMichael Woerister-29/+45
2024-01-04Split StableCompare trait out of StableOrd trait.Michael Woerister-15/+91
StableCompare is a companion trait to `StableOrd`. Some types like `Symbol` can be compared in a cross-session stable way, but their `Ord` implementation is not stable. In such cases, a `StableOrd` implementation can be provided to offer a lightweight way for stable sorting. (The more heavyweight option is to sort via `ToStableHashKey`, but then sorting needs to have access to a stable hashing context and `ToStableHashKey` can also be expensive as in the case of `Symbol` where it has to allocate a `String`.)
2023-12-31Avoid specialization for the Span Encodable and Decodable implsbjorn3-5/+5
2023-12-31Inline dominator check.Camille GILLOT-0/+1
2023-12-30Update to bitflags 2 in the compilerNilstrieb-8/+20
This involves lots of breaking changes. There are two big changes that force changes. The first is that the bitflag types now don't automatically implement normal derive traits, so we need to derive them manually. Additionally, bitflags now have a hidden inner type by default, which breaks our custom derives. The bitflags docs recommend using the impl form in these cases, which I did.
2023-12-24Do not store stable crate id in on-disk hash map.Camille GILLOT-1/+1
2023-12-22update cfg(bootstrap)sPietro Albini-144/+0
2023-12-15NFC don't convert types to identical typesMatthias Krüger-1/+1
2023-12-13Auto merge of #117050 - c410-f3r:here-we-go-again, r=petrochenkovbors-0/+144
[`RFC 3086`] Attempt to try to resolve blocking concerns Implements what is described at https://github.com/rust-lang/rust/issues/83527#issuecomment-1744822345 to hopefully make some progress. It is unknown if such approach is or isn't desired due to the lack of further feedback, as such, it is probably best to nominate this PR to the official entities. `@rustbot` labels +I-compiler-nominated
2023-12-10remove redundant importssurechen-5/+1
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-12-081. fix jobserver GLOBAL_CLIENT_CHECKED uninitialized before useoksbsb-1/+1
2. jobserver::initialize_checked should call before build_session, still should use EarlyErrorHandler, so revert stderr change in #118635
2023-12-01Attempt to try to resolve blocking concernsCaio-0/+144
2023-11-29jobserver: check file descriptorsbelovdv-30/+68
2023-11-28Avoid an unnecessary `by_ref`.Nicholas Nethercote-1/+1
2023-11-23Enforce NonZeroUsize on thread countMark Rousskov-4/+7
This allows avoiding some if != 0 checks when allocating worker-local datasets.
2023-11-22Replace `no_ord_impl` with `orderable`.Nicholas Nethercote-0/+1
Similar to the previous commit, this replaces `newtype_index`'s opt-out `no_ord_impl` attribute with the opt-in `orderable` attribute.
2023-11-22Auto merge of #117928 - nnethercote:rustc_ast_pretty, r=fee1-deadbors-1/+1
`rustc_ast_pretty` cleanups Some improvements I found while looking at this code. r? `@fee1-dead`
2023-11-22Update itertools to 0.11.Nicholas Nethercote-1/+1
Because the API for `with_position` improved in 0.11 and I want to use it.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-2/+2
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-15Bump cfg(bootstrap)sMark Rousskov-2/+2
2023-11-14Fix some typoscui fliter-5/+5
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-11-09Auto merge of #117557 - Zoxc:panic-prio, r=petrochenkovbors-13/+29
Make `FatalErrorMarker` lower priority than other panics This makes `FatalErrorMarker` lower priority than other panics in a parallel sections. If any other panics occur, they will be unwound instead of `FatalErrorMarker`. This ensures `rustc` will exit with the correct error code on ICEs. This fixes https://github.com/rust-lang/rust/issues/116659.
2023-11-06Auto merge of #117435 - SparrowLii:nightly_parallel, r=oli-obk,davidtwcobors-2/+24
enable parallel rustc front end in nightly builds Refers to the [MCP](https://github.com/rust-lang/compiler-team/issues/681), this pr does: 1. Enable the parallel front end in nightly builds, and keep the default number of threads as 1. Then users can use the parallel rustc front end via -Z threads=n option. 2. Set it up to serial front end for beta/stable builds via bootstrap. 3. Switch over the alt builders from parallel rustc to serial, so we have artifacts without parallel to test against the artifacts with parallel. r? `@oli-obk` cc `@cjgillot` `@nnethercote` `@bjorn3` `@Kobzol`
2023-11-06use portable AtomicU64 for powerPC and MIPSSparrowLii-2/+24
2023-11-05Remove invariant commentsTaras Tsugrii-4/+0
2023-11-03Make `FatalErrorMarker` lower priority than other panicsJohn Kåre Alsaker-13/+29
2023-11-03Use `filter_map` in `try_par_for_each_in`Josh Stone-7/+6
This simplifies the expression, especially for the rayon part, and also lets us drop the `E: Copy` constraint.
2023-10-30Clean up `rustc_*/Cargo.toml`.Nicholas Nethercote-11/+11
- Sort dependencies and features sections. - Add `tidy` markers to the sorted sections so they stay sorted. - Remove empty `[lib`] sections. - Remove "See more keys..." comments. Excluded files: - rustc_codegen_{cranelift,gcc}, because they're external. - rustc_lexer, because it has external use. - stable_mir, because it has external use.
2023-10-23Auto merge of #116849 - oli-obk:error_shenanigans, r=cjgillotbors-1/+30
Avoid a `track_errors` by bubbling up most errors from `check_well_formed` I believe `track_errors` is mostly papering over issues that a sufficiently convoluted query graph can hit. I made this change, while the actual change I want to do is to stop bailing out early on errors, and instead use this new `ErrorGuaranteed` to invoke `check_well_formed` for individual items before doing all the `typeck` logic on them. This works towards resolving https://github.com/rust-lang/rust/issues/97477 and various other ICEs, as well as allowing us to use parallel rustc more (which is currently rather limited/bottlenecked due to the very sequential nature in which we do `rustc_hir_analysis::check_crate`) cc `@SparrowLii` `@Zoxc` for the new `try_par_for_each_in` function
2023-10-20Avoid a `track_errors` by bubbling up most errors from `check_well_formed`Oli Scherer-1/+30
2023-10-19Initiate the inner usage of `cfg_match`Caio-48/+50
2023-10-18Auto merge of #116830 - nnethercote:rustc_type_ir, r=compiler-errorsbors-121/+0
Remove `IdFunctor` trait. It's defined in `rustc_data_structures` but is only used in `rustc_type_ir`. The code is shorter and easier to read if we remove this layer of abstraction and just do the things directly where they are needed. r? `@BoxyUwU`