about summary refs log tree commit diff
path: root/compiler/rustc_data_structures
AgeCommit message (Collapse)AuthorLines
2025-01-28Rollup merge of #136149 - cuviper:rustc-rayon-indexmap, r=compiler-errorsMatthias Krüger-2/+2
Flip the `rustc-rayon`/`indexmap` dependency order [`rustc-rayon v0.5.1`](https://github.com/rust-lang/rustc-rayon/pull/14) added `indexmap` implementations that will allow `indexmap` to drop its own "internal-only" implementations. (This is separate from `indexmap`'s implementation for normal `rayon`.)
2025-01-27Flip the `rustc-rayon`/`indexmap` dependency orderJosh Stone-2/+2
[`rustc-rayon v0.5.1`](https://github.com/rust-lang/rustc-rayon/pull/14) added `indexmap` implementations that will allow `indexmap` to drop its own "internal-only" implementations. (This is separate from `indexmap`'s implementation for normal `rayon`.)
2025-01-26Incorporate `iter_nodes` into `graph::DirectedGraph`Zalathar-2/+18
This assumes that the set of valid node IDs is exactly `0..num_nodes`. In practice, we have a lot of graph-algorithm code that already assumes that nodes are densely numbered, by using `num_nodes` to allocate per-node indexed data structures.
2025-01-21bumpt compiler and tools to windows 0.59klensy-3/+3
2025-01-16Auto merge of #135592 - matthiaskrgr:rollup-4t69l7i, r=matthiaskrgrbors-0/+53
Rollup of 7 pull requests Successful merges: - #134754 (Implement `use` associated items of traits) - #135481 (coverage: Completely overhaul counter assignment, using node-flow graphs) - #135504 (Allow coercing safe-to-call target_feature functions to safe fn pointers) - #135561 (Update docs for `-Clink-dead-code` to discourage its use) - #135574 (ci: mirror ubuntu:22.04 to ghcr.io) - #135585 (resolve symlinks of LLVM tool binaries before copying them) - #135588 (Add license-metadata.json to rustc-src tarball.) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-16Rollup merge of #133720 - c410-f3r:cfg-match-foo-bar-baz, r=joshtriplettMatthias Krüger-0/+88
[cfg_match] Adjust syntax A year has passed since the creation of #115585 and the feature, as expected, is not moving forward. Let's change that. This PR proposes changing the arm's syntax from `cfg(SOME_CONDITION) => { ... }` to `SOME_CODITION => {}`. ```rust match_cfg! { unix => { fn foo() { /* unix specific functionality */ } } target_pointer_width = "32" => { fn foo() { /* non-unix, 32-bit functionality */ } } _ => { fn foo() { /* fallback implementation */ } } } ``` Why? Because after several manual migrations in https://github.com/rust-lang/rust/pull/116342 it became clear, at least for me, that `cfg` prefixes are unnecessary, verbose and redundant. Again, everything is just a proposal to move things forward. If the shown syntax isn't ideal, feel free to close this PR or suggest other alternatives.
2025-01-16coverage: Completely overhaul counter assignment, using node-flow graphsZalathar-0/+10
2025-01-14Add wrapper type `ReversedGraph` for swapping successors/predecessorsZalathar-0/+43
2025-01-12De-abstract tagged pointer abstractionBoxy-984/+290
2025-01-11rename `BitSet` to `DenseBitSet`Rémy Rakic-19/+19
This should make it clearer that this bitset is dense, with the advantages and disadvantages that it entails.
2024-12-27MatchBranchSimplification: Consider empty-unreachable otherwise branchclubby789-0/+7
2024-12-22Adjust syntaxCaio-0/+88
2024-12-13Remove jobserver from Sessionbjorn3-1/+1
It is effectively a global resource and the jobserver::Client in Session was a clone of GLOBAL_CLIENT anyway.
2024-12-02Assert that obligations are empty before deeply normalizingMichael Goulet-0/+4
2024-11-20Add `UnordMap::clear` methodGuillaume Gomez-0/+5
2024-11-19Auto merge of #124780 - Mark-Simulacrum:lockless-cache, r=lcnrbors-0/+421
Improve VecCache under parallel frontend This replaces the single Vec allocation with a series of progressively larger buckets. With the cfg for parallel enabled but with -Zthreads=1, this looks like a slight regression in i-count and cycle counts (~1%). With the parallel frontend at -Zthreads=4, this is an improvement (-5% wall-time from 5.788 to 5.4688 on libcore) than our current Lock-based approach, likely due to reducing the bouncing of the cache line holding the lock. At -Zthreads=32 it's a huge improvement (-46%: 8.829 -> 4.7319 seconds). try-job: i686-gnu-nopt try-job: dist-x86_64-linux
2024-11-15Improve VecCache under parallel frontendMark Rousskov-0/+421
This replaces the single Vec allocation with a series of progressively larger buckets. With the cfg for parallel enabled but with -Zthreads=1, this looks like a slight regression in i-count and cycle counts (<0.1%). With the parallel frontend at -Zthreads=4, this is an improvement (-5% wall-time from 5.788 to 5.4688 on libcore) than our current Lock-based approach, likely due to reducing the bouncing of the cache line holding the lock. At -Zthreads=32 it's a huge improvement (-46%: 8.829 -> 4.7319 seconds).
2024-11-12Delete the `cfg(not(parallel))` serial compilerNoratrieb-841/+430
Since it's inception a long time ago, the parallel compiler and its cfgs have been a maintenance burden. This was a necessary evil the allow iteration while not degrading performance because of synchronization overhead. But this time is over. Thanks to the amazing work by the parallel working group (and the dyn sync crimes), the parallel compiler has now been fast enough to be shipped by default in nightly for quite a while now. Stable and beta have still been on the serial compiler, because they can't use `-Zthreads` anyways. But this is quite suboptimal: - the maintenance burden still sucks - we're not testing the serial compiler in nightly Because of these reasons, it's time to end it. The serial compiler has served us well in the years since it was split from the parallel one, but it's over now. Let the knight slay one head of the two-headed dragon!
2024-10-24Replace an FTP link in comments with an equivalent HTTPS linkZalathar-1/+1
2024-10-22Move `cmp_in_dominator_order` out of graph dominator computationZalathar-22/+1
Dominator-order information is only needed for coverage graphs, and is easy enough to collect by just traversing the graph again. This avoids wasted work when computing graph dominators for any other purpose.
2024-10-21Rollup merge of #130350 - RalfJung:strict-provenance, r=dtolnayMatthias Krüger-1/+0
stabilize Strict Provenance and Exposed Provenance APIs Given that [RFC 3559](https://rust-lang.github.io/rfcs/3559-rust-has-provenance.html) has been accepted, t-lang has approved the concept of provenance to exist in the language. So I think it's time that we stabilize the strict provenance and exposed provenance APIs, and discuss provenance explicitly in the docs: ```rust // core::ptr pub const fn without_provenance<T>(addr: usize) -> *const T; pub const fn dangling<T>() -> *const T; pub const fn without_provenance_mut<T>(addr: usize) -> *mut T; pub const fn dangling_mut<T>() -> *mut T; pub fn with_exposed_provenance<T>(addr: usize) -> *const T; pub fn with_exposed_provenance_mut<T>(addr: usize) -> *mut T; impl<T: ?Sized> *const T { pub fn addr(self) -> usize; pub fn expose_provenance(self) -> usize; pub fn with_addr(self, addr: usize) -> Self; pub fn map_addr(self, f: impl FnOnce(usize) -> usize) -> Self; } impl<T: ?Sized> *mut T { pub fn addr(self) -> usize; pub fn expose_provenance(self) -> usize; pub fn with_addr(self, addr: usize) -> Self; pub fn map_addr(self, f: impl FnOnce(usize) -> usize) -> Self; } impl<T: ?Sized> NonNull<T> { pub fn addr(self) -> NonZero<usize>; pub fn with_addr(self, addr: NonZero<usize>) -> Self; pub fn map_addr(self, f: impl FnOnce(NonZero<usize>) -> NonZero<usize>) -> Self; } ``` I also did a pass over the docs to adjust them, because this is no longer an "experiment". The `ptr` docs now discuss the concept of provenance in general, and then they go into the two families of APIs for dealing with provenance: Strict Provenance and Exposed Provenance. I removed the discussion of how pointers also have an associated "address space" -- that is not actually tracked in the pointer value, it is tracked in the type, so IMO it just distracts from the core point of provenance. I also adjusted the docs for `with_exposed_provenance` to make it clear that we cannot guarantee much about this function, it's all best-effort. There are two unstable lints associated with the strict_provenance feature gate; I moved them to a new [strict_provenance_lints](https://github.com/rust-lang/rust/issues/130351) feature since I didn't want this PR to have an even bigger FCP. ;) `@rust-lang/opsem` Would be great to get some feedback on the docs here. :) Nominating for `@rust-lang/libs-api.` Part of https://github.com/rust-lang/rust/issues/95228. [FCP comment](https://github.com/rust-lang/rust/pull/130350#issuecomment-2395114536)
2024-10-21move strict provenance lints to new feature gate, remove old feature gatesRalf Jung-1/+0
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.