diff options
| author | gavincrawford <94875769+gavincrawford@users.noreply.github.com> | 2024-11-05 10:05:56 -0700 |
|---|---|---|
| committer | gavincrawford <94875769+gavincrawford@users.noreply.github.com> | 2024-11-11 13:36:42 -0700 |
| commit | fdef65bf6e36fcecd3df71d3a630c306f7acc784 (patch) | |
| tree | e1d674f187537353440adb70eefa78e05dbef3a7 /library/alloc/src | |
| parent | 37c30aeb45d33b14dadb6c06c3f71b8e047bd2fe (diff) | |
| download | rust-fdef65bf6e36fcecd3df71d3a630c306f7acc784.tar.gz rust-fdef65bf6e36fcecd3df71d3a630c306f7acc784.zip | |
Tag relevant functions with #[rustc_as_ptr] attribute
Diffstat (limited to 'library/alloc/src')
| -rw-r--r-- | library/alloc/src/boxed.rs | 2 | ||||
| -rw-r--r-- | library/alloc/src/vec/mod.rs | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs index e4956c7c53c..425d5f2ecfb 100644 --- a/library/alloc/src/boxed.rs +++ b/library/alloc/src/boxed.rs @@ -1499,6 +1499,7 @@ impl<T: ?Sized, A: Allocator> Box<T, A> { /// [`as_ptr`]: Self::as_ptr #[unstable(feature = "box_as_ptr", issue = "129090")] #[rustc_never_returns_null_ptr] + #[cfg_attr(not(bootstrap), rustc_as_ptr)] #[inline] pub fn as_mut_ptr(b: &mut Self) -> *mut T { // This is a primitive deref, not going through `DerefMut`, and therefore not materializing @@ -1547,6 +1548,7 @@ impl<T: ?Sized, A: Allocator> Box<T, A> { /// [`as_ptr`]: Self::as_ptr #[unstable(feature = "box_as_ptr", issue = "129090")] #[rustc_never_returns_null_ptr] + #[cfg_attr(not(bootstrap), rustc_as_ptr)] #[inline] pub fn as_ptr(b: &Self) -> *const T { // This is a primitive deref, not going through `DerefMut`, and therefore not materializing diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 07a1bd49321..990b7e8f761 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -1662,6 +1662,7 @@ impl<T, A: Allocator> Vec<T, A> { #[stable(feature = "vec_as_ptr", since = "1.37.0")] #[rustc_const_unstable(feature = "const_vec_string_slice", issue = "129041")] #[rustc_never_returns_null_ptr] + #[cfg_attr(not(bootstrap), rustc_as_ptr)] #[inline] pub const fn as_ptr(&self) -> *const T { // We shadow the slice method of the same name to avoid going through @@ -1724,6 +1725,7 @@ impl<T, A: Allocator> Vec<T, A> { #[stable(feature = "vec_as_ptr", since = "1.37.0")] #[rustc_const_unstable(feature = "const_vec_string_slice", issue = "129041")] #[rustc_never_returns_null_ptr] + #[cfg_attr(not(bootstrap), rustc_as_ptr)] #[inline] pub const fn as_mut_ptr(&mut self) -> *mut T { // We shadow the slice method of the same name to avoid going through |
