about summary refs log tree commit diff
path: root/compiler/rustc_index/src
AgeCommit message (Collapse)AuthorLines
2023-04-24Decorative changes to `IndexVec`Maybe Waffle-13/+12
2023-04-24`const`-ify some `{IndexVec, IndexSlice}` methodsMaybe Waffle-11/+11
2023-04-24move index code aroundMaybe Waffle-99/+100
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-297/+317
2023-04-18Don't allocate it `IndexVec::remove`Maybe Waffle-1/+1
2023-04-17Make `IndexVec::ensure_contains_elem` return a reference to the elementMaybe Waffle-9/+9
2023-04-09Fix some clippy::complexityNilstrieb-8/+5
2023-04-06Auto merge of #109915 - scottmcm:layout-indexvec, r=oli-obkbors-0/+43
Use `FieldIdx` in `FieldsShape` Finally got to the main motivating example from https://github.com/rust-lang/compiler-team/issues/606 :)
2023-04-04Use `FieldIdx` in `FieldsShape`Scott McMurray-0/+43
Finally got to the main motivating example from the MCP :)
2023-04-03Doc-comment `IndexVec::from_elem` and use it in a few more placesScott McMurray-0/+11
2023-04-02Use `&IndexSlice` instead of `&IndexVec` where possibleScott McMurray-2/+40
All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*.
2023-04-01Use `FieldIdx` in various things related to aggregatesScott McMurray-0/+6
Shrank `AggregateKind` by 8 bytes on x64, since the active field of a union is tracked as an `Option<FieldIdx>` instead of `Option<usize>`.
2023-03-30Add `IndexSlice` to go with `IndexVec`Scott McMurray-70/+160
Moves the methods that don't need full `IndexVec`-ness over to `IndexSlice`, and have `IndexVec` deref to `IndexSlice` so everything keeps working.
2023-03-29Rename `IndexVec::last` → `last_index`Scott McMurray-1/+1
As I've been trying to replace a `Vec` with an `IndexVec`, having `last` exist on both but returning very different types makes the transition a bit awkward -- the errors are later, where you get things like "there's no `ty` method on `mir::Field`" rather than a more localized error like "hey, there's no `last` on `IndexVec`". So I propose renaming `last` to `last_index` to help distinguish `Vec::last`, which returns an element, and `IndexVec::last_index`, which returns an index. (Similarly, `Iterator::last` also returns an element, not an index.)
2023-03-21Use `SmallVec` in bitsetsNilstrieb-5/+7
This doesn't increase their size and means that we don't have to heap allocate for small sets.
2023-03-03Match unmatched backticks in compiler/ that are part of rustdocest31-1/+1
2023-01-19Fix IndexVec::drain_enumeratedMichael Goulet-1/+6
2023-01-05Fix `uninlined_format_args` for some compiler cratesnils-5/+2
Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).
2022-12-18A few small cleanups for `newtype_index`Nilstrieb-1/+1
Remove the `..` from the body, only a few invocations used it and it's inconsistent with rust syntax. Use `;` instead of `,` between consts. As the Rust syntax gods inteded.
2022-12-18Make `#[max]` an attribute in `newtype_index`Nilstrieb-1/+4
2022-12-12minor code cleanupsMatthias Krüger-1/+1
2022-12-10compiler: remove unnecessary imports and qualified pathsKaDiWa-1/+0
2022-11-24move things from rustc_target::abi to rustc_abihkalbasi-7/+12
2022-11-24make rustc_target usable outside of rustchkalbasi-7/+15
2022-11-01Implement Idx for OwnerId.Camille GILLOT-0/+2
2022-09-28Rollup merge of #102232 - Urgau:stabilize-bench_black_box, r=TaKO8KiYuki Okushi-1/+0
Stabilize bench_black_box This PR stabilize `feature(bench_black_box)`. ```rust pub fn black_box<T>(dummy: T) -> T; ``` The FCP was completed in https://github.com/rust-lang/rust/issues/64102. `@rustbot` label +T-libs-api -T-libs
2022-09-27Stabilize bench_black_boxUrgau-1/+0
2022-09-26remove cfg(bootstrap)Pietro Albini-1/+0
2022-09-15Only enable the let_else feature on bootstrapest31-1/+1
On later stages, the feature is already stable. Result of running: rg -l "feature.let_else" compiler/ src/librustdoc/ library/ | xargs sed -s -i "s#\\[feature.let_else#\\[cfg_attr\\(bootstrap, feature\\(let_else\\)#"
2022-08-18Add diagnostic translation lints to crates that don't emit them5225225-0/+2
2022-08-12debuginfo: Change C++-like encoding for enums.Michael Woerister-1/+3
The updated encoding should be able to handle niche layouts where more than one variant has fields.
2022-07-31Auto merge of #99052 - tmiasko:bitset-clone-from, r=Mark-Simulacrumbors-6/+19
Fix cloning from a BitSet with a different domain size The previous implementation incorrectly assumed that the number of words in a bit set is equal to the domain size. The new implementation delegates to `Vec::clone_from` which is specialized for `Copy` elements. Fixes #99006.
2022-07-21Edit `rustc_index::vec::IndexVec::pick3_mut` docspierwill-2/+6
Clarify when this method will panic. Also fix formatting for `pick2_mut`.
2022-07-08Fix cloning from a BitSet with a different domain sizeTomasz Miąsko-6/+19
The previous implementation incorrectly assumed that the number of words in a bit set is equal to the domain size. The new implementation delegates to `Vec::clone_from` which is specialized for `Copy` elements.
2022-07-04Use a bitset instead of a hash map in HIR ID validatorJakub Beránek-0/+10
2022-06-21Auto merge of #95576 - DrMeepster:box_erasure, r=oli-obkbors-0/+12
Remove dereferencing of Box from codegen Through #94043, #94414, #94873, and #95328, I've been fixing issues caused by Box being treated like a pointer when it is not a pointer. However, these PRs just introduced special cases for Box. This PR removes those special cases and instead transforms a deref of Box into a deref of the pointer it contains. Hopefully, this is the end of the Box<T, A> ICEs.
2022-06-17Auto merge of #97863 - JakobDegen:bitset-choice, r=nnethercotebors-18/+135
`BitSet` related perf improvements This commit makes two changes: 1. Changes `MaybeLiveLocals` to use `ChunkedBitSet` 2. Overrides the `fold` method for the iterator for `ChunkedBitSet` I have local benchmarks verifying that each of these changes individually yield significant perf improvements to #96451 . I'm hoping this will be true outside of that context too. If that is not the case, I'll try to gate things on where they help as needed r? `@nnethercote` who I believe was working on closely related things, cc `@tmiasko` because of the destprop pr
2022-06-15add From impls for BitSet and GrowableBitSetDrMeepster-0/+12
2022-06-14`BitSet` perf improvementsJakob Degen-18/+135
This commit makes two changes: 1. Changes `MaybeLiveLocals` to use `ChunkedBitSet` 2. Overrides the `fold` method for the iterator for `ChunkedBitSet`
2022-06-09Auto merge of #97862 - SparrowLii:superset, r=lcnrbors-13/+58
optimize `superset` method of `IntervalSet` Given that intervals in the `IntervalSet` are sorted and strictly separated( it means the `end` of the previous interval will not be equal to the `start` of the next interval), we can reduce the complexity of the `superset` method from O(NMlogN) to O(2N) (N is the number of intervals and M is the length of each interval)
2022-06-08correct the test if IntervalSetSparrowLii-1/+1
2022-06-08fix the impl error in `insert_all`SparrowLii-1/+3
2022-06-08add `check_invariants` methodSparrowLii-7/+33
2022-06-08optimize `superset` method of `IntervalSet`SparrowLii-4/+21
2022-06-08Use delayed error handling for `Encodable` and `Encoder` infallible.Nicholas Nethercote-2/+2
There are two impls of the `Encoder` trait: `opaque::Encoder` and `opaque::FileEncoder`. The former encodes into memory and is infallible, the latter writes to file and is fallible. Currently, standard `Result`/`?`/`unwrap` error handling is used, but this is a bit verbose and has non-trivial cost, which is annoying given how rare failures are (especially in the infallible `opaque::Encoder` case). This commit changes how `Encoder` fallibility is handled. All the `emit_*` methods are now infallible. `opaque::Encoder` requires no great changes for this. `opaque::FileEncoder` now implements a delayed error handling strategy. If a failure occurs, it records this via the `res` field, and all subsequent encoding operations are skipped if `res` indicates an error has occurred. Once encoding is complete, the new `finish` method is called, which returns a `Result`. In other words, there is now a single `Result`-producing method instead of many of them. This has very little effect on how any file errors are reported if `opaque::FileEncoder` has any failures. Much of this commit is boring mechanical changes, removing `Result` return values and `?` or `unwrap` from expressions. The more interesting parts are as follows. - serialize.rs: The `Encoder` trait gains an `Ok` associated type. The `into_inner` method is changed into `finish`, which returns `Result<Vec<u8>, !>`. - opaque.rs: The `FileEncoder` adopts the delayed error handling strategy. Its `Ok` type is a `usize`, returning the number of bytes written, replacing previous uses of `FileEncoder::position`. - Various methods that take an encoder now consume it, rather than being passed a mutable reference, e.g. `serialize_query_result_cache`.
2022-05-20Auto merge of #95418 - cjgillot:more-disk, r=davidtwcobors-6/+0
Cache more queries on disk One of the principles of incremental compilation is to allow saving results on disk to avoid recomputing them. This PR investigates persisting a lot of queries whose result are to be saved into metadata. Some of the queries are cheap reads from HIR, but we may also want to get rid of these reads for incremental lowering.
2022-05-13Cache more queries on disk.Camille GILLOT-6/+0
2022-05-10optimize `insert_range` method of `IntervalSet`SparrowLii-48/+45
2022-04-30Add element iterator for ChunkedBitSetTomasz Miąsko-0/+82
2022-04-27tut tut tutEllen-1/+1