Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
e23f9b3
add additional lookup path for ref/ptr/array template args
Walnut356 Sep 30, 2025
8760d55
benchmark path.components() iteration
the8472 Oct 24, 2025
ea3a4e7
skip some Path prefix-component logic on platforms that don't have pr…
the8472 Oct 24, 2025
d263ab3
replace u8 iterator with slice matching
the8472 Oct 25, 2025
b247f67
Rename downcast_[ref|mut]_unchecked -> downcast_unchecked_[ref|mut]
taj-p Oct 24, 2025
2e5d395
refactor ub_checks and contract_checks to share logic
pitaj May 4, 2025
abd9fb4
O_NOFOLLOW is not supported on VxWorks
hax0kartik Oct 26, 2025
5943d07
Add Allocator proxy impls for Box, Rc, and Arc
cramertj Nov 5, 2025
12cde30
Add note for identifier with attempted hygiene violation
chenyukang Nov 7, 2025
5ed01e9
Switch hexagon targets to rust-lld
androm3da Nov 7, 2025
b827732
Enable std locking functions on AIX
amy-kwan Nov 7, 2025
fc20a28
Modify contributor email entries in .mailmap
hkBst Oct 28, 2025
fdced17
[bootstrap] Make `--open` option work with `doc src/tools/error_index…
GuillaumeGomez Nov 7, 2025
bd23d55
`invalid_atomic_ordering`: also lint `update` & `try_update`
GrigorenkoPV Nov 6, 2025
c07f11a
don't completely reset `HeadUsages`
lcnr Nov 7, 2025
566a86b
show packed alignment in mir_transform_unaligned_packed_ref
21aslade Oct 20, 2025
eac0c5a
Remove eslint-js from npm dependencies
Kobzol Nov 7, 2025
d1052e4
Recover `[T: N]` as `[T; N]`
ShE3py Nov 8, 2025
67802e0
rustc_builtin_macros: rename bench parameter to avoid collisions with…
IntegralPilot Oct 30, 2025
474501b
Remove a remnant of `dyn*` from the parser
fmease Nov 7, 2025
c52b703
Remove unused argument `features` from `eval_config_entry`
JonathanBrouwer Nov 8, 2025
7298174
add parser check for multi-reference self
Kivooeo Sep 7, 2025
cc8b95c
add `overflow_checks` intrinsic
pitaj Aug 4, 2024
0d64a5f
Use the current lint note id when parsing `cfg!()`
JonathanBrouwer Nov 8, 2025
edd7d8a
constify result unwrap unchecked
bend-n Oct 31, 2025
d347514
Rollup merge of #128666 - pitaj:intrinsic-overflow_checks, r=BoxyUwU
Zalathar Nov 9, 2025
0a74011
Rollup merge of #146305 - Kivooeo:a-lot-of-references-in-self, r=Jona…
Zalathar Nov 9, 2025
2f575f3
Rollup merge of #147179 - Walnut356:template_lookup, r=Mark-Simulacrum
Zalathar Nov 9, 2025
068e784
Rollup merge of #147743 - 21aslade:packed-diagnostic, r=RalfJung
Zalathar Nov 9, 2025
f424eb9
Rollup merge of #148079 - taj-p:master, r=Mark-Simulacrum
Zalathar Nov 9, 2025
1ad9e95
Rollup merge of #148084 - the8472:prefixless-path-components-iter, r=…
Zalathar Nov 9, 2025
5226e15
Rollup merge of #148126 - hax0kartik:vx-fix-148125, r=Mark-Simulacrum
Zalathar Nov 9, 2025
e3ced35
Rollup merge of #148204 - hkBst:patch-5, r=nnethercote
Zalathar Nov 9, 2025
645aa92
Rollup merge of #148279 - IntegralPilot:master, r=hkBst
Zalathar Nov 9, 2025
020dd31
Rollup merge of #148333 - bend-n:const_result_unwrap_unchecked, r=mar…
Zalathar Nov 9, 2025
ebb1777
Rollup merge of #148539 - cramertj:alloc-arc, r=Amanieu
Zalathar Nov 9, 2025
b0c4434
Rollup merge of #148601 - GrigorenkoPV:invalid_atomic_ordering, r=Kiv…
Zalathar Nov 9, 2025
99af1bc
Rollup merge of #148612 - chenyukang:yukang-fix-148580-macro-hygiene-…
Zalathar Nov 9, 2025
2fe368d
Rollup merge of #148613 - androm3da:bcain/hex_lld, r=JonathanBrouwer,…
Zalathar Nov 9, 2025
9663de0
Rollup merge of #148619 - amy-kwan:amyk/AddLockingFunctions_AIX, r=wo…
Zalathar Nov 9, 2025
6ced155
Rollup merge of #148644 - GuillaumeGomez:error-index-index-open, r=Ko…
Zalathar Nov 9, 2025
ec4e6e6
Rollup merge of #148649 - lcnr:rarwwww, r=BoxyUwU
Zalathar Nov 9, 2025
2fe69a9
Rollup merge of #148673 - fmease:del-dyn_star-remnant, r=JonathanBrouwer
Zalathar Nov 9, 2025
9fe2f4c
Rollup merge of #148675 - Kobzol:eslint-js, r=yotamofek
Zalathar Nov 9, 2025
784e91d
Rollup merge of #148680 - ShE3py:array-colon, r=JonathanBrouwer
Zalathar Nov 9, 2025
74e90d8
Rollup merge of #148688 - JonathanBrouwer:remove_features, r=jdonszel…
Zalathar Nov 9, 2025
4cf1d39
Rollup merge of #148711 - JonathanBrouwer:cfg_macro_lint_node_id, r=K…
Zalathar Nov 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add Allocator proxy impls for Box, Rc, and Arc
This adds to the existing proxy impl for &T.
  • Loading branch information
cramertj committed Nov 5, 2025
commit 5943d07fb34198b7eb7d70e9df060cfbc445270a
52 changes: 52 additions & 0 deletions library/alloc/src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2241,3 +2241,55 @@ impl<E: Error> Error for Box<E> {
Error::provide(&**self, request);
}
}

#[unstable(feature = "allocator_api", issue = "32838")]
unsafe impl<T: ?Sized + Allocator, A: Allocator> Allocator for Box<T, A> {
#[inline]
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
(**self).allocate(layout)
}

#[inline]
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
(**self).allocate_zeroed(layout)
}

#[inline]
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout) {
// SAFETY: the safety contract must be upheld by the caller
unsafe { (**self).deallocate(ptr, layout) }
}

#[inline]
unsafe fn grow(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError> {
// SAFETY: the safety contract must be upheld by the caller
unsafe { (**self).grow(ptr, old_layout, new_layout) }
}

#[inline]
unsafe fn grow_zeroed(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError> {
// SAFETY: the safety contract must be upheld by the caller
unsafe { (**self).grow_zeroed(ptr, old_layout, new_layout) }
}

#[inline]
unsafe fn shrink(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError> {
// SAFETY: the safety contract must be upheld by the caller
unsafe { (**self).shrink(ptr, old_layout, new_layout) }
}
}
52 changes: 52 additions & 0 deletions library/alloc/src/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4413,3 +4413,55 @@ impl<T: ?Sized, A: Allocator> Drop for UniqueRcUninit<T, A> {
}
}
}

#[unstable(feature = "allocator_api", issue = "32838")]
unsafe impl<T: ?Sized + Allocator, A: Allocator> Allocator for Rc<T, A> {
#[inline]
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
(**self).allocate(layout)
}

#[inline]
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
(**self).allocate_zeroed(layout)
}

#[inline]
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout) {
// SAFETY: the safety contract must be upheld by the caller
unsafe { (**self).deallocate(ptr, layout) }
}

#[inline]
unsafe fn grow(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError> {
// SAFETY: the safety contract must be upheld by the caller
unsafe { (**self).grow(ptr, old_layout, new_layout) }
}

#[inline]
unsafe fn grow_zeroed(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError> {
// SAFETY: the safety contract must be upheld by the caller
unsafe { (**self).grow_zeroed(ptr, old_layout, new_layout) }
}

#[inline]
unsafe fn shrink(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError> {
// SAFETY: the safety contract must be upheld by the caller
unsafe { (**self).shrink(ptr, old_layout, new_layout) }
}
}
52 changes: 52 additions & 0 deletions library/alloc/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4780,3 +4780,55 @@ unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for UniqueArc<T, A> {
unsafe { ptr::drop_in_place(&mut (*self.ptr.as_ptr()).data) };
}
}

#[unstable(feature = "allocator_api", issue = "32838")]
unsafe impl<T: ?Sized + Allocator, A: Allocator> Allocator for Arc<T, A> {
#[inline]
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
(**self).allocate(layout)
}

#[inline]
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
(**self).allocate_zeroed(layout)
}

#[inline]
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout) {
// SAFETY: the safety contract must be upheld by the caller
unsafe { (**self).deallocate(ptr, layout) }
}

#[inline]
unsafe fn grow(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError> {
// SAFETY: the safety contract must be upheld by the caller
unsafe { (**self).grow(ptr, old_layout, new_layout) }
}

#[inline]
unsafe fn grow_zeroed(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError> {
// SAFETY: the safety contract must be upheld by the caller
unsafe { (**self).grow_zeroed(ptr, old_layout, new_layout) }
}

#[inline]
unsafe fn shrink(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError> {
// SAFETY: the safety contract must be upheld by the caller
unsafe { (**self).shrink(ptr, old_layout, new_layout) }
}
}
Loading