about summary refs log tree commit diff
path: root/compiler/rustc_data_structures
AgeCommit message (Collapse)AuthorLines
2024-10-20Update rustc-hash to version 2Noratrieb-1/+1
This brings in the new algorithm.
2024-10-16Auto merge of #131767 - cuviper:bump-stage0, r=Mark-Simulacrumbors-1/+1
Bump bootstrap compiler to 1.83.0-beta.1 https://forge.rust-lang.org/release/process.html#master-bootstrap-update-tuesday
2024-10-16Auto merge of #131422 - GnomedDev:smallvec-predicate-obligations, ↵bors-34/+133
r=compiler-errors Use `ThinVec` for PredicateObligation storage ~~I noticed while profiling clippy on a project that a large amount of time is being spent allocating `Vec`s for `PredicateObligation`, and the `Vec`s are often quite small. This is an attempt to optimise this by using SmallVec to avoid heap allocations for these common small Vecs.~~ This PR turns all the `Vec<PredicateObligation>` into a single type alias while avoiding referring to `Vec` around it, then swaps the type over to `ThinVec<PredicateObligation>` and fixes the fallout. This also contains an implementation of `ThinVec::extract_if`, copied from `Vec::extract_if` and currently being upstreamed to https://github.com/Gankra/thin-vec/pull/66. This leads to a small (0.2-0.7%) performance gain in the latest perf run.
2024-10-15update bootstrap configsJosh Stone-1/+1
2024-10-12Rollup merge of #131277 - ↵Matthias Krüger-0/+1
ismailarilik:handle-potential-query-instability-lint-for-clippy, r=xFrednet Handle `clippy` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`src/tools/clippy/clippy_lints/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/src/tools/clippy/clippy_lints/src/lib.rs#L30) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: https://github.com/rust-lang/rust/issues/84447
2024-10-12Swap PredicateObligation to ThinVecGnomedDev-33/+38
2024-10-12Swap Vec<PredicateObligation> to type aliasGnomedDev-1/+2
2024-10-12Add ExtractIf for ThinVecGnomedDev-0/+93
2024-10-05Handle `clippy` cases of `rustc::potential_query_instability` lintismailarilik-0/+1
2024-10-01formatHenry Jiang-2/+2
2024-10-01increase stack size for aixHenry Jiang-0/+4
2024-09-28Auto merge of #130874 - klensy:bumpme, r=jieyouxubors-1/+1
bump few deps Bumps cargo_metadata, thorin-dwp, windows. Should dedupe some crates around.
2024-09-27bump few depsklensy-1/+1
cargo_metadata, thorin-dwp, windows
2024-09-26Use `&raw` in the compilerJosh Stone-1/+1
Like #130865 did for the standard library, we can use `&raw` in the compiler now that stage0 supports it. Also like the other issue, I did not make any doc or test changes at this time.
2024-09-24Dogfood `feature(file_buffered)`Josh Stone-2/+2
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-92/+99
2024-09-03Add an internal lint that warns when accessing untracked dataNadrieril-0/+1
2024-09-02chore: Fix typos in 'compiler' (batch 1)Alexander Cyon-8/+8
2024-08-28Update stacker to 0.1.17Rain-1/+1
The main new feature is support for detecting the current stack size on illumos. (See my blog post [1] for the context which led to this.) [1]: https://sunshowers.io/posts/rustc-segfault-illumos/
2024-08-13Update `indexmap` and use `IndexMap::append`Josh Stone-1/+1
2024-08-12Rollup merge of #128978 - compiler-errors:assert-matches, r=jieyouxuGuillaume Gomez-1/+3
Use `assert_matches` around the compiler more It's a useful assertion, especially since it actually prints out the LHS.
2024-08-11Use assert_matches around the compilerMichael Goulet-1/+3
2024-08-11Rollup merge of #128762 - fmease:use-more-slice-pats, r=compiler-errorsMatthias Krüger-3/+3
Use more slice patterns inside the compiler Nothing super noteworthy. Just replacing the common 'fragile' pattern of "length check followed by indexing or unwrap" with slice patterns for legibility and 'robustness'. r? ghost
2024-08-08Tweak wordingNadrieril-1/+4
Co-authored-by: lcnr <rust@lcnr.de>
2024-08-08Add `Steal::is_stolen()`Nadrieril-0/+6
2024-08-07Use more slice patterns inside the compilerLeón Orell Valerian Liehr-3/+3
2024-07-30Auto merge of #128083 - Mark-Simulacrum:bump-bootstrap, r=albertlarsan68bors-1/+0
Bump bootstrap compiler to new beta https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday
2024-07-29Reformat `use` declarations.Nicholas Nethercote-144/+158
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-28step cfg(bootstrap)Mark Rousskov-1/+0
2024-07-15Use dep: for crate dependenciesMichael Goulet-1/+1
2024-07-11Use uplifted `rustc-stable-hash` crate in `rustc_data_structures`Urgau-1049/+22
2024-07-04Auto merge of #127226 - mat-1:optimize-siphash-round, r=nnethercotebors-5/+6
Optimize SipHash by reordering compress instructions This PR optimizes hashing by changing the order of instructions in the sip.rs `compress` macro so the CPU can parallelize it better. The new order is taken directly from Fig 2.1 in [the SipHash paper](https://eprint.iacr.org/2012/351.pdf) (but with the xors moved which makes it a little faster). I attempted to optimize it some more after this, but I think this might be the optimal instruction order. Note that this shouldn't change the behavior of hashing at all, only statements that don't depend on each other were reordered. It appears like the current order hasn't changed since its [original implementation from 2012](https://github.com/rust-lang/rust/commit/fada46c4214f26dbdc0fd150a713aced476e75b5#diff-b751133c229259d7099bbbc7835324e5504b91ab1aded9464f0c48cd22e5e420R35) which doesn't look like it was written with data dependencies in mind. Running `./x bench library/core --stage 0 --test-args hash` before and after this change shows the following results: Before: ``` benchmarks: hash::sip::bench_bytes_4 7.20/iter +/- 0.70 hash::sip::bench_bytes_7 9.01/iter +/- 0.35 hash::sip::bench_bytes_8 8.12/iter +/- 0.10 hash::sip::bench_bytes_a_16 10.07/iter +/- 0.44 hash::sip::bench_bytes_b_32 13.46/iter +/- 0.71 hash::sip::bench_bytes_c_128 37.75/iter +/- 0.48 hash::sip::bench_long_str 121.18/iter +/- 3.01 hash::sip::bench_str_of_8_bytes 11.20/iter +/- 0.25 hash::sip::bench_str_over_8_bytes 11.20/iter +/- 0.26 hash::sip::bench_str_under_8_bytes 9.89/iter +/- 0.59 hash::sip::bench_u32 9.57/iter +/- 0.44 hash::sip::bench_u32_keyed 6.97/iter +/- 0.10 hash::sip::bench_u64 8.63/iter +/- 0.07 ``` After: ``` benchmarks: hash::sip::bench_bytes_4 6.64/iter +/- 0.14 hash::sip::bench_bytes_7 8.19/iter +/- 0.07 hash::sip::bench_bytes_8 8.59/iter +/- 0.68 hash::sip::bench_bytes_a_16 9.73/iter +/- 0.49 hash::sip::bench_bytes_b_32 12.70/iter +/- 0.06 hash::sip::bench_bytes_c_128 32.38/iter +/- 0.20 hash::sip::bench_long_str 102.99/iter +/- 0.82 hash::sip::bench_str_of_8_bytes 10.71/iter +/- 0.21 hash::sip::bench_str_over_8_bytes 11.73/iter +/- 0.17 hash::sip::bench_str_under_8_bytes 10.33/iter +/- 0.41 hash::sip::bench_u32 10.41/iter +/- 0.29 hash::sip::bench_u32_keyed 9.50/iter +/- 0.30 hash::sip::bench_u64 8.44/iter +/- 1.09 ``` I ran this on my computer so there's some noise, but you can tell at least `bench_long_str` is significantly faster (~18%). Also, I noticed the same compress function from the library is used in the compiler as well, so I took the liberty of copy-pasting this change to there as well. Thanks `@semisol` for porting SipHash for another project which led me to notice this issue in Rust, and for helping investigate. <3
2024-07-01Optimize SipHash by reordering compress instructionsmat-5/+6
2024-07-01rustc_data_structures: fix wrong markdown syntaxMichael Howell-2/+2
This didn't produce working footnote links. The unportable markdown lint warned about it.
2024-06-28rustc_data_structures: Explicitly check for 64-bit atomics supportJohn Paul Adrian Glaubitz-9/+7
Instead of keeping a list of architectures which have native support for 64-bit atomics, just use #[cfg(target_has_atomic = "64")] and its inverted counterpart to determine whether we need to use portable AtomicU64 on the target architecture.
2024-06-27Auto merge of #126907 - glaubitz:sparc-fixes, r=nagisabors-7/+7
Fixes for 32-bit SPARC on Linux This PR fixes a number of issues which previously prevented `rustc` from being built successfully for 32-bit SPARC using the `sparc-unknown-linux-gnu` triplet. In particular, it adds linking against `libatomic` where necessary, uses portable `AtomicU64` for `rustc_data_structures` and rewrites the spec for `sparc_unknown_linux_gnu` to use `TargetOptions` and replaces the previously used `-mv8plus` with the more portable `-mcpu=v9 -m32`. To make `rustc` build successfully, support for 32-bit SPARC needs to be added to the `object` crate as well as the `nix` crate which I will be sending out later as well. r? nagisa
2024-06-26Auto merge of #120924 - xFrednet:rfc-2383-stabilization-party, r=Urgau,blyxyasbors-1/+1
Let's `#[expect]` some lints: Stabilize `lint_reasons` (RFC 2383) Let's give this another try! The [previous stabilization attempt](https://github.com/rust-lang/rust/pull/99063) was stalled by some unresolved questions. These have been discussed in a [lang team](https://github.com/rust-lang/lang-team/issues/191) meeting. The last open question, regarding the semantics of the `#[expect]` attribute was decided on in https://github.com/rust-lang/rust/issues/115980 I've just updated the [stabilization report](https://github.com/rust-lang/rust/issues/54503#issuecomment-1179563964) with the discussed questions and decisions. Luckily, the decision is inline with the current implementation. This hopefully covers everything. Let's hope that the CI will be green like the spring. fixes #115980 fixes #54503 --- r? `@wesleywiser` Tacking Issue: https://github.com/rust-lang/rust/issues/54503 Stabilization Report: https://github.com/rust-lang/rust/issues/54503#issuecomment-1179563964 Documentation Update: https://github.com/rust-lang/reference/pull/1237 <!-- For Clippy: changelog: [`allow_attributes`]: Is now available on stable, since the `lint_reasons` feature was stabilized changelog: [`allow_attributes_without_reason`]: Is now available on stable, since the `lint_reasons` feature was stabilized --> --- Roses are red, Violets are blue, Let's expect lints, With reason clues
2024-06-25Auto merge of #126326 - eggyal:ununsafe-StableOrd, r=michaelwoeristerbors-17/+54
Un-unsafe the `StableOrd` trait Whilst incorrect implementations of this trait can cause miscompilation, they cannot cause memory unsafety in rustc. [Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Policy.20of.20.60unsafe.60.20within.20the.20compiler). cc [MCP 533](https://github.com/rust-lang/compiler-team/issues/533), #105175, `@michaelwoerister` r? `@Nilstrieb`
2024-06-25RFC 2383: Stabilize `lint_reasons` :tada:xFrednet-1/+1
2024-06-24Replace `MaybeUninit::uninit_array()` with array repeat expression.Kevin Reid-2/+1
This is possible now that inline const blocks are stable; the idea was even mentioned as an alternative when `uninit_array()` was added: <https://github.com/rust-lang/rust/pull/65580#issuecomment-544200681> > if it’s stabilized soon enough maybe it’s not worth having a > standard library method that will be replaceable with > `let buffer = [MaybeUninit::<T>::uninit(); $N];` Const array repetition and inline const blocks are now stable (in the next release), so that circumstance has come to pass, and we no longer have reason to want `uninit_array()` other than convenience. Therefore, let’s evaluate the inconvenience by not using `uninit_array()` in the standard library, before potentially deleting it entirely.
2024-06-24rustc_data_structures: Use portable AtomicU64 on 32-bit SPARCJohn Paul Adrian Glaubitz-7/+7
While at it, order the list of architectures alphabetically.
2024-06-22Ensure careful consideration is given by implsAlan Egerton-7/+43
Added an associated `const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED` to the `StableOrd` trait to ensure that implementors carefully consider whether the trait's contract is upheld, as incorrect implementations can cause miscompilations.
2024-06-20Convert some module-level `//` and `///` comments to `//!`.Nicholas Nethercote-2/+3
This makes their intent and expected location clearer. We see some examples where these comments were not clearly separate from `use` declarations, which made it hard to understand what the comment is describing.
2024-06-16Use Linux file locking on RedoxJeremy Soller-0/+4
2024-06-14Rollup merge of #126368 - nnethercote:rm-more-unused-crate-deps, r=jackh726Matthias Krüger-1/+5
Remove some unnecessary crate dependencies. A follow-up to #126063. r? ``@jackh726``
2024-06-13Remove some unnecessary crate dependencies.Nicholas Nethercote-1/+5
2024-06-12Address code review comments on the commentsAmanda Stjerna-1/+4
2024-06-12Revise documentation after @lqd's commentsAmanda Stjerna-8/+4
2024-06-12Remove a few unnecessary constructionsAmanda Stjerna-4/+7
This shaves off ca 6% of the cycles in `start_walk_from()` in my experiments.
2024-06-12Slightly faster version of `find_state`Amanda Stjerna-24/+27
This version shaves off ca 2% of the cycles in my experiments and makes the control flow easier to follow for me and hopefully others, including the compiler. Someone gave me a working profiler and by God I'm using it.