250 Commits

Author SHA1 Message Date
Josh Stone
8fd2dc0034 Update #[cfg(bootstrap)] 2025-10-28 13:35:43 -07:00
Camille Gillot
0156eaf0d1 Introduce indexvec macro. 2025-10-22 00:52:52 +00:00
Matthias Krüger
7604d12e05 Rollup merge of #147751 - nnethercote:bit_set-Word, r=Zalathar
Use `bit_set::Word` in a couple more places.

It's a synonym for `u64` and there are a couple of places where we use `u64` where we should use `Word`, which this commit fixes.

I found this when I tried changing `Word` to `u128` (which made performance worse).

r? `````@Zalathar`````
2025-10-16 19:35:27 +02:00
bors
779e19d8ba Auto merge of #147644 - cjgillot:bitsetvec, r=jackh726
Use regular Vec in BitSet.

That code is hot enough for the branch in all accesses to `SmallVec` to appear in profiles.
2025-10-16 14:06:35 +00:00
Nicholas Nethercote
8787c0b863 Use bit_set::Word in a couple more places.
It's a synonym for `u64` and there are a couple of places where we use
`u64` where we should use `Word`, which this commit fixes.

I found this when I tried changing `Word` to `u128` (which made
performance worse).
2025-10-16 11:45:07 +11:00
Nicholas Nethercote
60481827f6 Add a != check to ChunkedBitSet::union.
It's a big speed win for cranelift-codegen-0.119.0.
2025-10-15 13:49:38 +11:00
Nicholas Nethercote
facb9aca79 Refactor some ChunkedBitSet operations.
For less indentation, mostly.
2025-10-15 13:49:05 +11:00
Matthias Krüger
b134c9c135 Rollup merge of #147630 - nnethercote:bitset-cleanups, r=cjgillot,Zalathar
Bitset cleanups

Some minor cleanups I did while working on rust-lang/rust#147619.

r? ```@Zalathar```
2025-10-14 19:47:30 +02:00
Nicholas Nethercote
8386278866 Factor out a recurring pattern as count_ones. 2025-10-14 16:35:56 +11:00
Camille Gillot
04323227f4 Use regular Vec in BitSet. 2025-10-13 18:15:25 +00:00
Nicholas Nethercote
6e85c4e2d9 Remove some unused bitset code. 2025-10-13 21:51:56 +11:00
Nicholas Nethercote
2611bf753e Tidy some patterns in ChunkedBitSet ops. 2025-10-13 14:07:06 +11:00
Zalathar
9ff52bf332 Clear ChunkedBitSet without reallocating 2025-10-13 13:58:01 +11:00
Mark Rousskov
201f299ef6 Apply cfg(bootstrap) replacement 2025-09-26 19:09:23 -04:00
Stuart Cook
7a5819d154 Rollup merge of #144091 - thaliaarchi:stabilize-new-zeroed, r=Mark-Simulacrum
Stabilize `new_zeroed_alloc`

The corresponding `new_uninit` and `new_uninit_slice` functions were stabilized in rust-lang/rust#129401, but the zeroed counterparts were left for later out of a [desire](https://github.com/rust-lang/rust/issues/63291#issuecomment-2161039756) to stabilize only the minimal set. These functions are straightforward mirrors of the uninit functions and well-established. Since no blockers or design questions have surfaced in the past year, I think it's time to stabilize them.

Tracking issue: rust-lang/rust#129396
2025-09-21 14:42:33 +10:00
Matthias Krüger
d0ba5e33ff Rollup merge of #144765 - Qelxiros:range-inclusive-last, r=jhpratt
inclusive `Range`s: change `end` to `last`

Tracking issue: rust-lang/rust#125687
ACP: rust-lang/libs-team#511
2025-09-10 14:17:37 +02:00
Jeremy Smart
8d0c07f1a1 change end to last 2025-09-08 22:07:43 -04:00
Camille Gillot
4e9dd1b67b Do not use prepend to avoid quadratic behaviour. 2025-09-07 16:36:30 +00:00
Camille Gillot
b9262bce67 Use regular MaybeLiveLocals. 2025-09-07 16:35:30 +00:00
Camille GILLOT
9b8a719ae4 Reimplement DestinationPropagation according to live ranges. 2025-09-07 16:24:46 +00:00
Camille GILLOT
2ff92e83af Introduce fast insertion at extremities to IntervalSet. 2025-09-07 16:06:40 +00:00
Camille Gillot
9c9a89a18a Update documentation. 2025-08-24 22:15:19 +00:00
Camille GILLOT
262c8c9238 Remove chunk size from each chunk. 2025-08-23 17:56:37 +00:00
Nicholas Nethercote
704f2ca172 Tidy up Cargo.toml files.
- Add some missing `tidy-alphabetical-*` markers.
- Remove some unnecessary blank lines.
2025-07-31 19:58:04 +10:00
Thalia Archibald
175afd7618 Stabilize new_zeroed_alloc 2025-07-19 20:25:35 -07:00
Folkert de Vries
ed3711ea29 use div_ceil instead of manual logic 2025-07-05 10:55:42 +02:00
Nia Espera
a0c19ee577 index: add method for checking range on DenseBitSet 2025-06-04 00:47:12 +02:00
Jason Newcomb
52694034ba Add copy_within to IndexSlice 2025-04-15 10:44:28 -04:00
Michael Goulet
6438b9eca8 Use {Decodable,Encodable}_NoContext in type_ir 2025-03-15 06:34:36 +00:00
Matthias Krüger
d93ef397ce Rollup merge of #138331 - nnethercote:use-RUSTC_LINT_FLAGS-more, r=onur-ozkan,jieyouxu
Use `RUSTC_LINT_FLAGS` more

An alternative to the failed #138084.

Fixes #138106.

r? ````@jieyouxu````
2025-03-12 17:59:08 +01:00
Matthias Krüger
2bdb10f164 Rollup merge of #138372 - Eclips4:issue-138196, r=scottmcm
Refactor `pick2_mut` & `pick3_mut` to use `get_disjoint_mut`

Closes #138196
2025-03-12 08:06:50 +01:00
bors
d2b52c5c48 Auto merge of #137795 - Jarcho:idx_opt, r=davidtwco
Allow bounds checks when enumerating `IndexSlice` to be elided

Without this hint, each loop iteration has to separately bounds check the index. See https://godbolt.org/z/zrfPY4Ten for an example.

This is technically a behaviour change, but only in cases where the compiler is going to crash anyways.
2025-03-12 00:30:16 +00:00
Kirill Podoprigora
7398b39a0b Make panic's more specific 2025-03-12 00:35:16 +02:00
Kirill Podoprigora
64d143326f Refactor pick2_mut & pick3_mut to use get_disjoint_mut 2025-03-11 22:57:01 +02:00
Nicholas Nethercote
ff0a5fe975 Remove #![warn(unreachable_pub)] from all compiler/ crates.
It's no longer necessary now that `-Wunreachable_pub` is being passed.
2025-03-11 13:14:21 +11:00
许杰友 Jieyou Xu (Joe)
063ef18fdc Revert "Use workspace lints for crates in compiler/ #138084"
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 48caf81484, reversing
changes made to c6662879b2.
2025-03-10 18:12:47 +08:00
Matthias Krüger
48caf81484 Rollup merge of #138084 - nnethercote:workspace-lints, r=jieyouxu
Use workspace lints for crates in `compiler/`

This is nicer and hopefully less error prone than specifying lints via bootstrap.

r? ``@jieyouxu``
2025-03-09 10:34:50 +01:00
Nicholas Nethercote
8a3e03392e Remove #![warn(unreachable_pub)] from all compiler/ crates.
(Except for `rustc_codegen_cranelift`.)

It's no longer necessary now that `unreachable_pub` is in the workspace
lints.
2025-03-08 08:41:43 +11:00
Nicholas Nethercote
beba32cebb Specify rust lints for compiler/ crates via Cargo.
By naming them in `[workspace.lints.rust]` in the top-level
`Cargo.toml`, and then making all `compiler/` crates inherit them with
`[lints] workspace = true`. (I omitted `rustc_codegen_{cranelift,gcc}`,
because they're a bit different.)

The advantages of this over the current approach:
- It uses a standard Cargo feature, rather than special handling in
  bootstrap. So, easier to understand, and less likely to get
  accidentally broken in the future.
- It works for proc macro crates.

It's a shame it doesn't work for rustc-specific lints, as the comments
explain.
2025-03-08 08:41:09 +11:00
Thalia Archibald
38fad984c6 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.

These functions were added to all preludes in Rust 1.80.
2025-03-07 13:37:04 -08:00
Jason Newcomb
da0fbc19a5 Allow the optimizer to elide bounds checks when enumerating IndexSlice/IndecVec. 2025-02-28 09:10:09 -05:00
Jacob Pratt
6aa015ae9d Rollup merge of #136610 - Jarcho:range_idx, r=Noratrieb
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-24 02:11:32 -05:00
Michael Goulet
12e3911d81 Greatly simplify lifetime captures in edition 2024 2025-02-22 22:24:52 +00:00
Michael Goulet
3d5438accd Fix binding mode problems 2025-02-22 00:13:19 +00:00
Michael Goulet
76d341fa09 Upgrade the compiler to edition 2024 2025-02-22 00:01:48 +00:00
Jason Newcomb
162fb713ac Allow SliceIndex to be indexed by ranges. 2025-02-21 16:10:31 -05:00
bjorn3
1fcae03369 Rustfmt 2025-02-08 22:12:13 +00:00
Yotam Ofek
264fa0fc54 Run clippy --fix for unnecessary_map_or lint 2025-01-19 19:15:00 +00:00
Zalathar
e70112caf8 Add DenseBitSet::union_not
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-14 23:49:10 +11:00
Rémy Rakic
d1f8a2c109 document the use-cases of DenseBitSet a bit more 2025-01-11 11:34:03 +00:00