summary refs log tree commit diff
path: root/compiler/rustc_arena/src/lib.rs
AgeCommit message (Collapse)AuthorLines
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-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-03-29mark FIXMES for all the places found that are probably offset_fromAria Beingessner-0/+6
2022-03-29Make some rustc code conform to strict provenance.Aria Beingessner-9/+11
There's some really bad stuff around `ty` and pointer tagging stuff that was too much work to handle here.
2022-01-28Clarify `ArenaAllocatable`'s second parameter.Nicholas Nethercote-5/+10
It's simply a binary thing to allow different behaviour for `Copy` vs `!Copy` types. The new code makes this much clearer; I was scratching my head over the old code for some time.
2022-01-28Add some comments.Nicholas Nethercote-7/+21
2022-01-26Rename `TypedArenaChunk` as `ArenaChunk`.Nicholas Nethercote-9/+9
Because it's used within both `TypedArena` and `DroplessArena`. The commit also makes `<u8>` the default parameter.
2021-11-19Add some comments.Nicholas Nethercote-3/+12
Also use `Default::default()` in one `TypedArena::default()`, for consistency with `DroplessArena::default()`.
2021-11-17Remove unnecessary lifetime argument from arena macros.Nicholas Nethercote-5/+5
Because it's always `'tcx`. In fact, some of them use a mixture of passed-in `$tcx` and hard-coded `'tcx`, so no other lifetime would even work. This makes the code easier to read.
2021-11-15Remove `DropArena`.Nicholas Nethercote-134/+7
Most arena-allocate types that impl `Drop` get their own `TypedArena`, but a few infrequently used ones share a `DropArena`. This sharing adds complexity but doesn't help performance or memory usage. Perhaps it was more effective in the past prior to some other improvements to arenas. This commit removes `DropArena` and the sharing of arenas via the `few` attribute of the `arena_types` macro. This change removes over 100 lines of code and nine uses of `unsafe` (one of which affects the parallel compiler) and makes the remaining code easier to read.
2021-08-30Remove unused arena macro argsbjorn3-1/+1
2021-05-25rustc_arena: macros 2.0bstrie-78/+76
2021-03-27Remove (lots of) dead codeJoshua Nelson-20/+0
Found with https://github.com/est31/warnalyzer. Dubious changes: - Is anyone else using rustc_apfloat? I feel weird completely deleting x87 support. - Maybe some of the dead code in rustc_data_structures, in case someone wants to use it in the future? - Don't change rustc_serialize I plan to scrap most of the json module in the near future (see https://github.com/rust-lang/compiler-team/issues/418) and fixing the tests needed more work than I expected. TODO: check if any of the comments on the deleted code should be kept.
2021-03-19Rollup merge of #83197 - jyn514:cfg-test-dead-code, r=joshtriplettDylan DPC-16/+0
Move some test-only code to test files Split out from https://github.com/rust-lang/rust/pull/83185.
2021-03-17Move some test-only code to test filesJoshua Nelson-16/+0
This also relaxes the bounds on some structs and moves them to the impl block instead.
2021-03-10Update to rustc-rayon 0.3.1Josh Stone-9/+25
This pulls in rust-lang/rustc-rayon#8 to fix #81425. (h/t @ammaraskar) That revealed weak constraints on `rustc_arena::DropArena`, because its `DropType` was holding type-erased raw pointers to generic `T`. We can implement `Send` for `DropType` (under `cfg(parallel_compiler)`) by requiring all `T: Send` before they're type-erased.
2021-02-20Update the bootstrap compilerJoshua Nelson-1/+0
Note this does not change `core::derive` since it was merged after the beta bump.
2021-02-13Edit `rustc_arena::DropArena` docspierwill-6/+9
- Add a "Safety" section, edit formatting for clarity - Add missing punctuation in code comments
2021-01-31Rollup merge of #80470 - SimonSapin:array-intoiter-type, r=m-ou-seJonas Schievink-2/+0
Stabilize by-value `[T; N]` iterator `core::array::IntoIter` Tracking issue: https://github.com/rust-lang/rust/issues/65798 This is unblocked now that `min_const_generics` has been stabilized in https://github.com/rust-lang/rust/pull/79135. This PR does *not* include the corresponding `IntoIterator` impl, which is https://github.com/rust-lang/rust/pull/65819. Instead, an iterator can be constructed through the `new` method. `new` would become unnecessary when `IntoIterator` is implemented and might be deprecated then, although it will stay stable.