about summary refs log tree commit diff
path: root/compiler/rustc_index
AgeCommit message (Collapse)AuthorLines
2025-01-19Run `clippy --fix` for `unnecessary_map_or` lintYotam Ofek-1/+1
2025-01-14Add `DenseBitSet::union_not`Zalathar-0/+56
This is similar to the existing `union`, except that bits in the RHS are negated before being incorporated into the LHS. Currently only `DenseBitSet` is supported. Supporting other bitset types is possible, but non-trivial, and currently isn't needed.
2025-01-11document the use-cases of `DenseBitSet` a bit moreRémy Rakic-1/+7
2025-01-11rename `BitSet` to `DenseBitSet`Rémy Rakic-68/+72
This should make it clearer that this bitset is dense, with the advantages and disadvantages that it entails.
2024-12-29improve `bit_set` assertionRémy Rakic-1/+6
it missed the index and bounds info
2024-12-21Rollup merge of #134526 - onur-ozkan:nightly-feat-rustc, r=jieyouxuMatthias Krüger-1/+1
update `rustc_index_macros` feature handling It seems that cargo can't [conditionally propagate features](https://github.com/rust-lang/rust/blob/214587c89d527dd0ccbe1f2150c737d3bdee67b0/compiler/rustc_index/Cargo.toml#L20) if they were enabled by default on the target crate, but disabled with `default-features = false` in the current/parent crate. Fixes #118129
2024-12-19update `rustc_index_macros` feature handlingonur-ozkan-1/+1
It seems that cargo can't conditionally propagate features when `default-features` is set to `false`. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-12-17add `MixedBitSet::clear`Rémy Rakic-0/+8
2024-12-09Use `BitSet` in `SparseBitMatrix`.Nicholas Nethercote-13/+13
A `ChunkedBitSet` has to be at least 2048 bits for it to outperform a `BitSet`, because that's the chunk size. The largest `SparseBitMatrix` encountered when compiling the compiler and the entire rustc-perf benchmark suite is less than 600 bits. This change is a tiny perf win, but the motivation is more about avoiding uses of `ChunkedBitSet` outside of `MixedBitSet`. The test change is necessary to avoid hitting the `<BitSet<T> as BitRelations<ChunkedBitSet<T>>>::subtract` method that has `unimplemented!` in its body and isn't otherwise used.
2024-12-05Introduce `MixedBitSet`.Nicholas Nethercote-0/+155
It just uses `BitSet` for small/medium sizes (<= 2048 bits) and `ChunkedBitSet` for larger sizes. This is good because `ChunkedBitSet` is slow and memory-hungry at smaller sizes.
2024-12-05Move some `BitSet` code blocks to a better place.Nicholas Nethercote-105/+105
These blocks are currently interleaved with `ChunkedBitSet` blocks. It makes things hard to find and has annoyed me for a while.
2024-11-29Remove `HybridBitSet`.Nicholas Nethercote-692/+3
It's no longer used.
2024-11-29Stop using `HybridBitSet` in `SparseBitMatrix`.Nicholas Nethercote-13/+18
Use `ChunkedBitSet` instead.
2024-11-29Speed up `ChunkedBitIter`Nicholas Nethercote-55/+40
The current implementation is slow because it does an operation for every bit in the set, even zero bits. So if you have a large bitset with many zero bits (which is common) it's very slow. This commit improves the iterator to skip over `Zeros` chunks in a single step, and uses the fast `BitIter` for `Mixed` chunks. It also removes the existing `fold` implementation, which was only there because the old iterator was slow.
2024-11-29Tiny `ChunkedBitSet` improvements.Nicholas Nethercote-19/+16
- Fix a typo in a comment. - Remove unnecessary `Chunk::` qualifiers. - Rename `ChunkedBitIter::bitset` as `ChunkedBitIter::bit_set`, because `bit_set` is the form used everywhere else. - Avoid some unnecessary local variables.
2024-11-29Clarify `ChunkSize` invariants.Nicholas Nethercote-4/+8
`ChunkedBitSet::is_empty` currently does an unnecessary check. This commit removes that check and adds clarifying comments and an assertion that demonstrate why it's unnecessary.
2024-11-20reduce false positives of tail-expr-drop-order from consumed valuesDing Xiang Fei-4/+136
take 2 open up coroutines tweak the wordings the lint works up until 2021 We were missing one case, for ADTs, which was causing `Result` to yield incorrect results. only include field spans with significant types deduplicate and eliminate field spans switch to emit spans to impl Drops Co-authored-by: Niko Matsakis <nikomat@amazon.com> collect drops instead of taking liveness diff apply some suggestions and add explantory notes small fix on the cache let the query recurse through coroutine new suggestion format with extracted variable name fine-tune the drop span and messages bugfix on runtime borrows tweak message wording filter out ecosystem types earlier apply suggestions clippy check lint level at session level further restrict applicability of the lint translate bid into nop for stable mir detect cycle in type structure
2024-10-10Rollup merge of #130625 - heiseish:issue-124028-fix, r=jieyouxuMatthias Krüger-0/+1
Fix a few relative paths in rustc doc ## Changes - Don't inline the doc for re-exporting some structs that have relative paths in doc. ## Context See #124028. - Most of the relative links in rustdoc are there because of circular import (so syntax like `[MyType]: rustc_foo::bar` is difficult to achieve when we cannot import `rustc_xxx` due to circular import) - Here, I disable new links for re-exports. I think it's fine for re-exported items in `hir::*`. - There is a few more relative links in other `rustc` crates, however they are not addressed in this PR, as they are not re-exported and/so the relative paths are working. Closes #124028. r​? `@fmease` Let me know if I miss anything or there's any other way to address this issue.
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-50/+42
2024-09-20no_inline for index vecGiang Dao-0/+1
2024-09-17assert that unexpectedly unsized fields are sized in the param envLukas Markeffsky-1/+1
2024-09-08IntervalSet: add comment about representationRalf Jung-1/+1
2024-09-08Auto merge of #129346 - nnethercote:fix-double-handling-in-collect_tokens, ↵bors-1/+1
r=petrochenkov Fix double handling in `collect_tokens` Double handling of AST nodes can occur in `collect_tokens`. This is when an inner call to `collect_tokens` produces an AST node, and then an outer call to `collect_tokens` produces the same AST node. This can happen in a few places, e.g. expression statements where the statement delegates `HasTokens` and `HasAttrs` to the expression. It will also happen more after #124141. This PR fixes some double handling cases that cause problems, including #129166. r? `@petrochenkov`
2024-08-31disable size asserts in the compiler when randomizing layoutsThe 8472-0/+12
2024-08-28Rollup merge of #129401 - ↵Jubilee-1/+1
workingjubilee:partial-initialization-of-stabilization, r=dtolnay,joboet Partially stabilize `feature(new_uninit)` Finished comment period: https://github.com/rust-lang/rust/issues/63291#issuecomment-2183022955 The following API has been stabilized from https://github.com/rust-lang/rust/issues/63291 ```rust impl<T> Box<T> { pub fn new_uninit() -> Box<MaybeUninit<T>> {…} } impl<T> Rc<T> { pub fn new_uninit() -> Rc<MaybeUninit<T>> {…} } impl<T> Arc<T> { pub fn new_uninit() -> Arc<MaybeUninit<T>> {…} } impl<T> Box<[T]> { pub fn new_uninit_slice(len: usize) -> Box<[MaybeUninit<T>]> {…} } impl<T> Rc<[T]> { pub fn new_uninit_slice(len: usize) -> Rc<[MaybeUninit<T>]> {…} } impl<T> Arc<[T]> { pub fn new_uninit_slice(len: usize) -> Arc<[MaybeUninit<T>]> {…} } impl<T> Box<MaybeUninit<T>> { pub unsafe fn assume_init(self) -> Box<T> {…} } impl<T> Box<[MaybeUninit<T>]> { pub unsafe fn assume_init(self) -> Box<[T]> {…} } impl<T> Rc<MaybeUninit<T>> { pub unsafe fn assume_init(self) -> Rc<T> {…} } impl<T> Rc<[MaybeUninit<T>]> { pub unsafe fn assume_init(self) -> Rc<[T]> {…} } impl<T> Arc<MaybeUninit<T>> { pub unsafe fn assume_init(self) -> Arc<T> {…} } impl<T> Arc<[MaybeUninit<T>]> { pub unsafe fn assume_init(self) -> Arc<[T]> {…} } ``` The remaining API is split between new issues - `new_zeroed_alloc`: https://github.com/rust-lang/rust/issues/129396 - `box_uninit_write`: https://github.com/rust-lang/rust/issues/129397 All relevant code is thus either stabilized or split out of that issue, so this closes #63291 as, with the FCP concluded, that issue has served its purpose. try-job: x86_64-rust-for-linux
2024-08-27compiler: Remove feature(new_uninit)Jubilee Young-1/+1
2024-08-27Add `warn(unreachable_pub)` to `rustc_index`.Nicholas Nethercote-0/+1
2024-08-23library: Move unstable API of new_uninit to new featuresJubilee Young-0/+1
- `new_zeroed` variants move to `new_zeroed_alloc` - the `write` fn moves to `box_uninit_write` The remainder will be stabilized in upcoming patches, as it was decided to only stabilize `uninit*` and `assume_init`.
2024-08-24Avoid double-handling of attributes in `collect_tokens`.Nicholas Nethercote-1/+1
By keeping track of attributes that have been previously processed. This fixes the `macro-rules-derive-cfg.stdout` test, and is necessary for #124141 which removes nonterminals. Also shrink the `SmallVec` inline size used in `IntervalSet`. 2 gives slightly better perf than 4 now that there's an `IntervalSet` in `Parser`, which is cloned reasonably often.
2024-08-13Add and use `IndexVec::append`Josh Stone-0/+5
2024-07-29Reformat `use` declarations.Nicholas Nethercote-24/+15
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-15Fix feature gating on rustc_index to not use implicit featuresMichael Goulet-3/+3
2024-07-15Use dep: for crate dependenciesMichael Goulet-1/+5
2024-07-04Auto merge of #127170 - bjorn3:no_specialize_index_borrowck, r=michaelwoeristerbors-4/+1
Stop using specialization in rustc_index and rustc_borrowck For rustc_borrowck the version with specialization isn't much more readable anyway IMO. For rustc_index it probably doesn't affect perf in any noticeable way anyway.
2024-07-04Use `IndexVec` for coroutine local mappingLiu Dingming-0/+5
2024-06-30Remove usage of specialization from newtype_index!bjorn3-4/+1
2024-06-12Use `tidy` to sort crate attributes for all compiler crates.Nicholas Nethercote-1/+3
We already do this for a number of crates, e.g. `rustc_middle`, `rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`. For the ones we don't, in many cases the attributes are a mess. - There is no consistency about order of attribute kinds (e.g. `allow`/`deny`/`feature`). - Within attribute kind groups (e.g. the `feature` attributes), sometimes the order is alphabetical, and sometimes there is no particular order. - Sometimes the attributes of a particular kind aren't even grouped all together, e.g. there might be a `feature`, then an `allow`, then another `feature`. This commit extends the existing sorting to all compiler crates, increasing consistency. If any new attribute line is added there is now only one place it can go -- no need for arbitrary decisions. Exceptions: - `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`, because they have no crate attributes. - `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's ignored in `rustfmt.toml`).
2024-04-18Simplify `static_assert_size`s.Nicholas Nethercote-1/+1
We want to run them on all 64-bit platforms.
2024-04-03Check `x86_64` size assertions on `aarch64`, tooZalathar-1/+1
This makes it easier for contributors on aarch64 workstations (e.g. Macs) to notice when these assertions have been violated.
2024-03-06doc: Add better explanationorion GONZALEZ (contractor)-1/+18
2024-02-06Invert diagnostic lints.Nicholas Nethercote-2/+0
That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has be converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted.
2024-01-27Auto merge of #120024 - Mark-Simulacrum:fast-union-merge, r=cjgillotbors-0/+6
Merge into larger interval set This reduces the work done while merging rows. In at least one case (#50450), we have thousands of union([range], [20,000 ranges]), which previously inserted each of the 20,000 ranges one by one. Now we only insert one range into the right hand set after copying the set over. This cuts the runtime of the test case in #50450 from ~26 seconds to ~6 seconds locally, though it doesn't change the memory usage peak (~9.5GB).
2024-01-26Rollup merge of #119800 - dev-ardi:tmp, r=wesleywiserMatthias Krüger-0/+7
Document `rustc_index::vec::IndexVec` Document a few of the methods. Part of https://github.com/rust-lang/rust/issues/93792.
2024-01-26Update compiler/rustc_index/src/vec.rsArdi-0/+1
Co-authored-by: Wesley Wiser <wwiser@gmail.com>
2024-01-25Remove unused featuresclubby789-9/+2
2024-01-22Remove uses of HybridBitSet.Camille GILLOT-2/+2
2024-01-16Merge into larger interval setMark Rousskov-0/+6
This reduces the work done while merging rows. In at least one case (issue 50450), we have thousands of union([range], [20,000 ranges]), which previously inserted each of the 20,000 ranges one by one. Now we only insert one range into the right hand set after copying the set over.
2024-01-10Fix some mistakes + new docardi-6/+5
2024-01-10Oh wellardi-15/+3
2024-01-10Document the struct and a few methodsardi-0/+19