about summary refs log tree commit diff
path: root/compiler/rustc_arena
AgeCommit message (Collapse)AuthorLines
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-30Clean up `rustc_*/Cargo.toml`.Nicholas Nethercote-0/+2
- Sort dependencies and features sections. - Add `tidy` markers to the sorted sections so they stay sorted. - Remove empty `[lib`] sections. - Remove "See more keys..." comments. Excluded files: - rustc_codegen_{cranelift,gcc}, because they're external. - rustc_lexer, because it has external use. - stable_mir, because it has external use.
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-07Rollup merge of #97711 - Nilstrieb:rustc-arena-ub, r=wesleywiserDylan DPC-12/+39
Improve soundness of rustc_arena Make it runnable in miri by changing the loop iteration count for some tests in miri. Also fix a stacked borrows issue with box.
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-27Update `smallvec` to 1.8.1.Nicholas Nethercote-1/+1
This pulls in https://github.com/servo/rust-smallvec/pull/282, which gives some small wins for rustc.
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.
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-02-02Remove unused dep from rustc_arenaest31-1/+0
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-09-20Migrate to 2021Mark Rousskov-1/+1
2021-08-30Remove unused arena macro argsbjorn3-1/+1
2021-08-28Auto merge of #85690 - bstrie:m2_arena, r=jackh726,nagisabors-78/+76
Macros 2.0-ify rustc_arena For the purpose of battle-testing macros 2.0 I'm looking to dogfood it in rustc, one crate at a time. (Note that there are only 12 changed lines if you ignore whitespace.)
2021-07-29rfc3052: Remove authors field from Cargo manifestsJade-1/+0
Since RFC 3052 soft deprecated the authors field anyway, hiding it from crates.io, docs.rs, and making Cargo not add it by default, and it is not generally up to date/useful information, we should remove it from crates in this repo.