about summary refs log tree commit diff
path: root/compiler/rustc_arena/src
AgeCommit message (Collapse)AuthorLines
2025-04-19Introduce Arena::try_alloc_from_iter.Camille GILLOT-23/+45
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-09Rollup merge of #138084 - nnethercote:workspace-lints, r=jieyouxuMatthias Krüger-1/+0
Use workspace lints for crates in `compiler/` This is nicer and hopefully less error prone than specifying lints via bootstrap. r? ``@jieyouxu``
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-03-07compiler: Use size_of from the prelude instead of importedThalia Archibald-13/+13
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-01-11Add inherent versions of MaybeUninit methods for slicesltdk-1/+1
2024-10-21move strict provenance lints to new feature gate, remove old feature gatesRalf Jung-1/+0
2024-09-13Remove unnecessary lifetimes from `Arena`.Nicholas Nethercote-14/+14
2024-08-27compiler: Remove feature(new_uninit)Jubilee Young-1/+0
2024-08-16Add `warn(unreachable_pub)` to `rustc_arena`.Nicholas Nethercote-11/+12
2024-07-29Reformat `use` declarations.Nicholas Nethercote-5/+6
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-12Use `tidy` to sort crate attributes for all compiler crates.Nicholas Nethercote-7/+9
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-21rename ptr::invalid -> ptr::without_provenanceRalf Jung-1/+1
also introduce ptr::dangling matching NonNull::dangling
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-19Fix `Stable` trait and its impls to work with the new `with_tables`Oli Scherer-0/+13
2023-12-05rustc_arena: add `alloc_str`Josh Stone-0/+22
Two places called `from_utf8_unchecked` for strings from `alloc_slice`, and one's SAFETY comment said this was for lack of `alloc_str` -- so let's just add that instead!
2023-12-04Document reentrancy in `*Arena::alloc_from_iter`Nadrieril-16/+25
2023-11-15Bump cfg(bootstrap)sMark Rousskov-2/+2
2023-10-25Stabilize `[const_]pointer_byte_offsets`Maybe Waffle-1/+0
2023-10-08rustdoc: remove rust logo from non-Rust cratesMichael Howell-0/+2
2023-10-03Remove the `TypedArena::alloc_from_iter` specialization.Nicholas Nethercote-90/+45
It was added in #78569. It's complicated and doesn't actually help performance. Also, add a comment explaining why the two `alloc_from_iter` functions are so different.
2023-09-28Inline and remove `DroplessArena::alloc_raw_without_grow`.Nicholas Nethercote-29/+22
It has a single call site. I find the code clearer with it gone.
2023-09-28Reduce `grow_and_alloc_raw` to a single call site.Nicholas Nethercote-12/+12
The current structure is clumsy, calling `alloc_raw_without_grow` in one function, and then if that fails, calling another function that calls `alloc_raw_without_grow` again.
2023-09-28Make `DroplessArena::alloc` call `DroplessArena::alloc_raw`.Nicholas Nethercote-8/+1
They're very similar.
2023-09-28Use `Layout::new` consistently in `DroplessArena::alloc`.Nicholas Nethercote-2/+3
2023-09-28Remove `unsafe` from `TypedArena::alloc_raw_slice`.Nicholas Nethercote-4/+4
There's no good reason for it.
2023-09-28Inline and remove `TypedArena::ensure_capacity`.Nicholas Nethercote-12/+7
It has a single callsite.
2023-09-28Inline and remove `DroplessArena::grow_and_alloc`.Nicholas Nethercote-7/+1
It has a single callsite.
2023-09-28Remove some unnecessary lifetimes.Nicholas Nethercote-3/+3
2023-09-28rustc_arena: tweak some comments.Nicholas Nethercote-2/+4
2023-09-25Rename `cold_path` to `outline`John Kåre Alsaker-2/+3
2023-08-23Bump cfg(bootstrap)Mark Rousskov-1/+1
2023-08-14Address commentsJohn Kåre Alsaker-7/+16
2023-08-14Allocate extra space to account for alignment lossesJohn Kåre Alsaker-4/+8
2023-08-14Optimize DroplessArena arena allocationJohn Kåre Alsaker-15/+55
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-06-15Extend `unused_must_use` to cover block exprs许杰友 Jieyou Xu (Joe)-1/+1
2023-04-28Deny the `unsafe_op_in_unsafe_fn` lint inJohn Bobbo-11/+31
`rustc_arena`.
2023-04-27Use `NonNull::new_unchecked` and `NonNull::len` inJohn Bobbo-5/+5
`rustc_arena`.
2023-04-09Allow `clippy::from_mut_ref`Nilstrieb-0/+9
This pattern is fine for arena allocators.
2022-12-10compiler: remove unnecessary imports and qualified pathsKaDiWa-1/+1
2022-11-22`rustc_arena`: remove a couple of `ref` patternsMaybe Waffle-10/+6
2022-08-23Make use of `[wrapping_]byte_{add,sub}`Maybe Waffle-1/+2
...replacing `.cast().wrapping_offset().cast()` & similar code.
2022-08-21Rollup merge of #100822 - WaffleLapkin:no_offset_question_mark, r=scottmcmMatthias Krüger-1/+1
Replace most uses of `pointer::offset` with `add` and `sub` As PR title says, it replaces `pointer::offset` in compiler and standard library with `pointer::add` and `pointer::sub`. This generally makes code cleaner, easier to grasp and removes (or, well, hides) integer casts. This is generally trivially correct, `.offset(-constant)` is just `.sub(constant)`, `.offset(usized as isize)` is just `.add(usized)`, etc. However in some cases we need to be careful with signs of things. r? ````@scottmcm```` _split off from #100746_
2022-08-21Replace most uses of `pointer::offset` with `add` and `sub`Maybe Waffle-1/+1
2022-08-18Add diagnostic translation lints to crates that don't emit them5225225-0/+2
2022-08-10Stabilize ptr_const_castMartin Habovstiak-1/+0
This stabilizes `ptr_const_cast` feature as was decided in a recent [FCP](https://github.com/rust-lang/rust/issues/92675#issuecomment-1190660233) Closes #92675
2022-07-06Fix stacked borrows violation in rustc_arenaNilstrieb-8/+19
There was a problem with storing a `Box<T>` in a struct, where the current rules would invalidate the value. this makes it store a raw pointer instead, circumventing the aliasing problems.
2022-06-03Adapt tests to be able to run in miriNilstrieb-4/+20
Decrease the Ns of bug loops to a smaller N, which makes them a lot faster in miri.