about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src
AgeCommit message (Collapse)AuthorLines
2025-04-02Invalidate all dereferences for non-local assignmentsdianqk-0/+2
2025-03-26Add `TyCtx::env_var_os`Mads Marquart-0/+2
Along with `TyCtx::env_var` helper. These can be used to track environment variable accesses in the query system. Since `TyCtx::env_var_os` uses `OsStr`, this commit also adds the necessary trait implementations for that to work.
2025-03-21Use hashbrown from crates.ioJohn Kåre Alsaker-2/+0
2025-03-21Optimize hash map operations in the query systemJohn Kåre Alsaker-1/+3
2025-03-15Auto merge of #138532 - matthiaskrgr:rollup-mgcynqu, r=matthiaskrgrbors-0/+6
Rollup of 5 pull requests Successful merges: - #138283 (Enforce type of const param correctly in MIR typeck) - #138439 (feat: check ARG_MAX on Unix platforms) - #138502 (resolve: Avoid some unstable iteration) - #138514 (Remove fake borrows of refs that are converted into non-refs in `MakeByMoveBody`) - #138524 (Mark myself as unavailable for reviews temporarily) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-15Use {Decodable,Encodable}_NoContext in type_irMichael Goulet-8/+8
2025-03-14resolve: Avoid some unstable iterationVadim Petrochenkov-0/+6
2025-03-12Rollup merge of #138331 - nnethercote:use-RUSTC_LINT_FLAGS-more, ↵Matthias Krüger-6/+6
r=onur-ozkan,jieyouxu Use `RUSTC_LINT_FLAGS` more An alternative to the failed #138084. Fixes #138106. r? ````@jieyouxu````
2025-03-12Rollup merge of #137701 - cuviper:sharded-hashtable, r=fmeaseMatthias Krüger-18/+80
Convert `ShardedHashMap` to use `hashbrown::HashTable` The `hash_raw_entry` feature (#56167) has finished fcp-close, so the compiler should stop using it to allow its removal. Several `Sharded` maps were using raw entries to avoid re-hashing between shard and map lookup, and we can do that with `hashbrown::HashTable` instead.
2025-03-11Auto merge of #128440 - oli-obk:defines, r=lcnrbors-0/+1
Add `#[define_opaques]` attribute and require it for all type-alias-impl-trait sites that register a hidden type Instead of relying on the signature of items to decide whether they are constraining an opaque type, the opaque types that the item constrains must be explicitly listed. A previous version of this PR used an actual attribute, but had to keep the resolved `DefId`s in a side table. Now we just lower to fields in the AST that have no surface syntax, instead a builtin attribute macro fills in those fields where applicable. Note that for convenience referencing opaque types in associated types from associated methods on the same impl will not require an attribute. If that causes problems `#[defines()]` can be used to overwrite the default of searching for opaques in the signature. One wart of this design is that closures and static items do not have generics. So since I stored the opaques in the generics of functions, consts and methods, I would need to add a custom field to closures and statics to track this information. During a T-types discussion we decided to just not do this for now. fixes #131298
2025-03-11Implement `#[define_opaque]` attribute for functions.Oli Scherer-0/+1
2025-03-11Add `unreachable_pub` to `RUSTC_LINT_FLAGS` for `compiler/` crates.Nicholas Nethercote-6/+6
And fix the new errors in the handful of crates that didn't have a `#![warn(unreachable_pub)]`.
2025-03-10Convert `ShardedHashMap` to use `hashbrown::HashTable`Josh Stone-18/+80
The `hash_raw_entry` feature has finished fcp-close, so the compiler should stop using it to allow its removal. Several `Sharded` maps were using raw entries to avoid re-hashing between shard and map lookup, and we can do that with `hashbrown::HashTable` instead.
2025-03-10Revert "Use workspace lints for crates in `compiler/` #138084"许杰友 Jieyou Xu (Joe)-6/+6
Revert <https://github.com/rust-lang/rust/pull/138084> to buy time to consider options that avoids breaking downstream usages of cargo on distributed `rustc-src` artifacts, where such cargo invocations fail due to inability to inherit `lints` from workspace root manifest's `workspace.lints` (this is only valid for the source rust-lang/rust workspace, but not really the distributed `rustc-src` artifacts). This breakage was reported in <https://github.com/rust-lang/rust/issues/138304>. This reverts commit 48caf81484b50dca5a5cebb614899a3df81ca898, reversing changes made to c6662879b27f5161e95f39395e3c9513a7b97028.
2025-03-09Rollup merge of #138084 - nnethercote:workspace-lints, r=jieyouxuMatthias Krüger-6/+6
Use workspace lints for crates in `compiler/` This is nicer and hopefully less error prone than specifying lints via bootstrap. r? ``@jieyouxu``
2025-03-09Rollup merge of #138040 - thaliaarchi:use-prelude-size-of.compiler, ↵Matthias Krüger-11/+7
r=compiler-errors compiler: Use `size_of` from the prelude instead of imported Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them. Apply this change across the compiler. These functions were added to all preludes in Rust 1.80. r? ``@compiler-errors``
2025-03-08Add `unreachable_pub` to the default lints for `compiler/` crates.Nicholas Nethercote-6/+6
And fix the new errors in the handful of crates that didn't have a `#![warn(unreachable_pub)]`.
2025-03-07compiler: Use size_of from the prelude instead of importedThalia Archibald-11/+7
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them. These functions were added to all preludes in Rust 1.80.
2025-03-06Rollup merge of #137764 - compiler-errors:always-applicable-negative-impl, ↵Michael Goulet-4/+6
r=lcnr Ensure that negative auto impls are always applicable r? lcnr (or reassign if you dont want to review) https://github.com/rust-lang/rust/issues/68318#issuecomment-2689265030
2025-03-05Auto merge of #138031 - workingjubilee:rollup-5bsotpz, r=workingjubileebors-5/+6
Rollup of 15 pull requests Successful merges: - #137829 (Stabilize [T]::split_off... methods) - #137850 (Stabilize `box_uninit_write`) - #137912 (Do not recover missing lifetime with random in-scope lifetime) - #137913 (Allow struct field default values to reference struct's generics) - #137923 (Simplify `<Postorder as Iterator>::size_hint`) - #137949 (Update MSVC INSTALL.md instructions to recommend VS 2022 + recent Windows 10/11 SDK) - #137963 (Add ``dyn`` keyword to `E0373` examples) - #137975 (Remove unused `PpMode::needs_hir`) - #137981 (rustdoc search: increase strictness of typechecking) - #137986 (Fix some typos) - #137991 (Add `avr-none` to SUMMARY.md and platform-support.md) - #137993 (Remove obsolete comment from DeduceReadOnly) - #137996 (Revert "compiler/rustc_data_structures/src/sync/worker_local.rs: delete "unsafe impl Sync"") - #138019 (Pretty-print `#[deprecated]` attribute in HIR.) - #138026 (Make CrateItem::body() function return an option) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-04Ensure that negative auto impls are always applicableMichael Goulet-4/+6
2025-03-04Revert "compiler/rustc_data_structures/src/sync/worker_local.rs: delete ↵Askar Safin-5/+6
"unsafe impl Sync"" This reverts commit 02406903b0c26440428580a4bbaf30da973c5b23.
2025-03-04Adapt `librustdoc` to 2024 edition lifetieme capture rulesYotam Ofek-9/+0
Get rid of the `Captures` hack
2025-03-03Tidy imports in `rustc_data_structures::sync`Zalathar-27/+30
2025-03-03Remove some unnecessary aliases from `rustc_data_structures::sync`Zalathar-10/+0
With the removal of `cfg(parallel_compiler)`, these are always shared references and `std::sync::OnceLock`.
2025-03-03Remove leading underscores from parameter names in `Sharded`Zalathar-8/+8
With the removal of `cfg(parallel_compiler)`, these parameters are never considered unused.
2025-03-02Auto merge of #137704 - nnethercote:opt-empty-prov-range-checks, r=oli-obkbors-0/+33
Optimize empty provenance range checks. Currently it gets the pointers in the range and checks if the result is empty, but it can be done faster if you combine those two steps. r? `@oli-obk`
2025-02-27Rollup merge of #136579 - bjorn3:fix_thinvec_ext_ub, r=BoxyUwUMatthias Krüger-17/+25
Fix UB in ThinVec::flat_map_in_place `thin_vec.as_ptr()` goes through the `Deref` impl of `ThinVec`, which will not allow access to any memory as we did call `set_len(0)` first. Found in the process of investigating https://github.com/rust-lang/rust/issues/135870.
2025-02-27Optimize empty provenance range checks.Nicholas Nethercote-0/+33
Currently it gets the pointers in the range and checks if the result is empty, but it can be done faster if you combine those two steps.
2025-02-26Fix UB in ThinVec::flat_map_in_placebjorn3-17/+25
thin_vec.as_ptr() goes through the Deref impl of ThinVec, which will not allow access to any memory as we did call set_len(0) first.
2025-02-26Auto merge of #137354 - FractalFir:intern_with_cap, r=FractalFirbors-0/+3
Change interners to start preallocated with an increased capacity Inspired by https://github.com/rust-lang/rust/issues/137005. Added a `with_capacity` function to `InternedSet`. Changed the `CtxtInterners` to start with `InternedSets` preallocated with a capacity. This *does* increase memory usage at very slightly(by ~1 MB at the start), altough that increase quickly disaperars for larger crates(since they require such capacity anyway). A local perf run indicates this improves compiletimes for small crates(like `ripgrep`), without a negative effect on larger ones.
2025-02-25Changed interners to start with preallocated capacityMichał Kostrubiec-0/+3
2025-02-24Rollup merge of #136610 - Jarcho:range_idx, r=NoratriebJacob Pratt-1/+1
Allow `IndexSlice` to be indexed by ranges. This comes with some annoyances as the index type can no longer inferred from indexing expressions. The biggest offender for this is `IndexVec::from_fn_n(|idx| ..., n)` where the index type won't be inferred from the call site or any index expressions inside the closure. My main use case for this is mapping a `Place` to `Range<Idx>` for value tracking where the range represents all the values the place contains.
2025-02-23Auto merge of #137237 - cuviper:stage0, r=Mark-Simulacrumbors-88/+0
Master bootstrap update https://forge.rust-lang.org/release/process.html#master-bootstrap-update-tuesday r? `@Mark-Simulacrum`
2025-02-22Greatly simplify lifetime captures in edition 2024Michael Goulet-12/+12
2025-02-22Fix binding mode problemsMichael Goulet-1/+1
2025-02-22Fix overcapturing, unsafe extern blocks, and new unsafe opsMichael Goulet-1/+1
2025-02-21Allow SliceIndex to be indexed by ranges.Jason Newcomb-1/+1
2025-02-21Stacker now handles miri using a noop impl itselfbjorn3-12/+0
2025-02-18update `cfg(bootstrap)`Josh Stone-88/+0
2025-02-17Enforce T: Hash for Interned<...>Mark Rousskov-1/+4
This adds panicking Hash impls for several resolver types that don't actually satisfy this condition. It's not obvious to me that rustc_resolve actually upholds the Interned guarantees but fixing that seems pretty hard (the structures have at minimum some interior mutability, so it's not really recursively hashable in place...).
2025-02-16Move hashes from rustc_data_structure to rustc_hashes so they can be shared ↵Ben Kimock-159/+5
with rust-analyzer
2025-02-15Replace some u64 hashes with Hash64Ben Kimock-0/+5
2025-02-11compiler/rustc_data_structures/src/sync/worker_local.rs: delete "unsafe impl ↵Askar Safin-6/+5
Sync"
2025-02-11compiler/rustc_data_structures/src/sync.rs: delete Sync and SendAskar Safin-11/+5
2025-02-11compiler/rustc_data_structures/src/sync.rs: remove atomics, but not AtomicU64!Askar Safin-8/+2
2025-02-11compiler/rustc_data_structures/src/sync.rs: delete WeakAskar Safin-2/+1
2025-02-11compiler/rustc_data_structures/src/sync.rs: delete MappedLockGuardAskar Safin-3/+2
It seems it is left-over after some refactoring
2025-02-11compiler/rustc_data_structures/src/sync.rs: remove "impl Clone for RwLock"Askar Safin-8/+0
parking_lot::RwLock doesn't have "impl Clone", so we should not have, either
2025-02-11compiler/rustc_data_structures/src/sync.rs: these RwLock methods are never ↵Askar Safin-20/+0
called, so let's remove them