about summary refs log tree commit diff
path: root/compiler/rustc_index/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2025-07-19Stabilize `new_zeroed_alloc`Thalia Archibald-1/+1
2025-03-11Remove `#![warn(unreachable_pub)]` from all `compiler/` crates.Nicholas Nethercote-1/+0
It's no longer necessary now that `-Wunreachable_pub` is being passed.
2025-03-10Revert "Use workspace lints for crates in `compiler/` #138084"许杰友 Jieyou Xu (Joe)-0/+1
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-08Remove `#![warn(unreachable_pub)]` from all `compiler/` crates.Nicholas Nethercote-1/+0
(Except for `rustc_codegen_cranelift`.) It's no longer necessary now that `unreachable_pub` is in the workspace lints.
2025-02-21Allow SliceIndex to be indexed by ranges.Jason Newcomb-1/+2
2024-09-20no_inline for index vecGiang Dao-0/+1
2024-08-31disable size asserts in the compiler when randomizing layoutsThe 8472-0/+11
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-07-29Reformat `use` declarations.Nicholas Nethercote-2/+3
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
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-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-25Remove unused featuresclubby789-9/+2
2023-12-15Make `rustc_index::bit_set` available on stableNadrieril-1/+0
2023-11-18Begin nightly-ifying rustc_type_irMichael Goulet-2/+1
2023-08-24Auto merge of #115094 - Mark-Simulacrum:bootstrap-update, r=ozkanonurbors-1/+1
Update bootstrap compiler to 1.73.0 beta
2023-08-23Bump cfg(bootstrap)Mark Rousskov-1/+1
2023-08-22Convert it into a warningNilstrieb-1/+6
Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2023-08-22Add disclaimer on size assertion macroNilstrieb-0/+7
Sometimes people are inspired by rustc to add size assertions to their code and copy the macro. This is bad because it causes hard build errors. rustc happens to be special where it makes this okay.
2023-08-03Add `internal_features` lintNilstrieb-0/+1
It lints against features that are inteded to be internal to the compiler and standard library. Implements MCP #596. We allow `internal_features` in the standard library and compiler as those use many features and this _is_ the standard library from the "internal to the compiler and standard library" after all. Marking some features as internal wasn't exactly the most scientific approach, I just marked some mostly obvious features. While there is a categorization in the macro, it's not very well upheld (should probably be fixed in another PR). We always pass `-Ainternal_features` in the testsuite About 400 UI tests and several other tests use internal features. Instead of throwing the attribute on each one, just always allow them. There's nothing wrong with testing internal features^^
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-1/+6
2022-11-24move things from rustc_target::abi to rustc_abihkalbasi-7/+12
2022-11-24make rustc_target usable outside of rustchkalbasi-7/+10
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-02-24Convert `newtype_index` to a proc macroAaron Hill-0/+2
The `macro_rules!` implementation was becomng excessively complicated, and difficult to modify. The new proc macro implementation should make it much easier to add new features (e.g. skipping certain `#[derive]`s)
2022-02-23Introduce `ChunkedBitSet` and use it for some dataflow analyses.Nicholas Nethercote-1/+11
This reduces peak memory usage significantly for some programs with very large functions, such as: - `keccak`, `unicode_normalization`, and `match-stress-enum`, from the `rustc-perf` benchmark suite; - `http-0.2.6` from crates.io. The new type is used in the analyses where the bitsets can get huge (e.g. 10s of thousands of bits): `MaybeInitializedPlaces`, `MaybeUninitializedPlaces`, and `EverInitializedPlaces`. Some refactoring was required in `rustc_mir_dataflow`. All existing analysis domains are either `BitSet` or a trivial wrapper around `BitSet`, and access in a few places is done via `Borrow<BitSet>` or `BorrowMut<BitSet>`. Now that some of these domains are `ClusterBitSet`, that no longer works. So this commit replaces the `Borrow`/`BorrowMut` usage with a new trait `BitSetExt` containing the needed bitset operations. The impls just forward these to the underlying bitset type. This required fiddling with trait bounds in a few places. The commit also: - Moves `static_assert_size` from `rustc_data_structures` to `rustc_index` so it can be used in the latter; the former now re-exports it so existing users are unaffected. - Factors out some common "clear excess bits in the final word" functionality in `bit_set.rs`. - Uses `fill` in a few places instead of loops.
2022-01-12remove unused FIXMElcnr-4/+0
2021-12-30Introduce IntervalSetMark Rousskov-0/+1
This is a compact, fast storage for variable-sized sets, typically consisting of larger ranges. It is less efficient than a bitset if ranges are both small and the domain size is small, but will still perform acceptably. With enormous domain sizes and large ranges, the interval set performs much better, as it can be much more densely packed in memory than the uncompressed bit set alternative.
2021-12-14Stabilize iter::zip.PFPoitras-1/+0
2021-11-03Optimize live point computationMark Rousskov-0/+2
This is just replicating the previous algorithm, but taking advantage of the bitset structures to optimize into tighter and better optimized loops. Particularly advantageous on enormous MIR blocks, which are relatively rare in practice.
2021-10-03Replace Fn impls with RPIT impls in rustc_indexbjorn3-1/+0
This is cleaner and removes an unstable feature usage
2021-10-02Swap out unboxed_closures feature gate for min_specializationbjorn3-1/+1
For some reason unboxed_closures supresses the feature gate for min_specialization when implementing TrustedStep. min_specialization is the true feature that is used.
2021-05-31Remove unused feature gatesbjorn3-1/+0
2021-05-31Use allow_internal_unstable more in rustc_indexbjorn3-1/+0
2021-05-26Specialize implementationsJacob Pratt-0/+1
Implementations in stdlib are now optimized as they were before.
2021-04-25fix sanitizer testsRalf Jung-1/+0
2021-04-25move core::hint::black_box under its own feature gateRalf Jung-0/+2
2021-04-18fix feature use in rustc libsRalf Jung-1/+0
2021-03-26Use iter::zip in compiler/Josh Stone-0/+1
2021-01-29Apply workaround from #72003 for #56935Thomas Eizinger-0/+4
Related: #72017.
2020-11-22Stabilise `then`varkor-1/+0
2020-08-30mv compiler to compiler/mark-0/+11