Skip to content

Commit f213ec5

Browse files
Rollup merge of rust-lang#153261 - GrigorenkoPV:stabilize/alignment, r=clarfonthey
Partially stabilize `ptr_alignment_type` as `alignment_type` Tracking issue: rust-lang#102070 ## Stabilized API All used to be gated under `ptr_alignment_type`, now stabilized under `alignment_type`: ```rust // in `core::mem` #[derive(Copy, Clone, PartialEq, Eq)] pub struct Alignment { ... } impl Alignment { pub const MIN: Self; pub const fn of<T>() -> Self; pub const fn of_val<T: ?Sized>(val: &T) -> Self; pub const fn of_val_raw<T: ?Sized>(val: *const T) -> Self; pub const fn new(align: usize) -> Option<Self>; pub const unsafe fn new_unchecked(align: usize) -> Self; pub const fn as_usize(self) -> usize; pub const fn as_nonzero_usize(self) -> NonZero<usize>; } impl Debug for Alignment; impl TryFrom<NonZero<usize>> for Alignment; impl TryFrom<usize> for Alignment; impl From<Alignment> for NonZero<usize>; impl From<Alignment> for usize; impl Ord for Alignment; impl PartialOrd for Alignment; impl Hash for Alignment; impl Default for Alignment; ``` ## Things *not* getting stabilized Remains under `ptr_alignment_type` (but with a new tracking issue: rust-lang#165719): ```rust // in `core::mem` impl Alignment { pub const fn log2(self) -> u32; pub const fn mask(self) -> usize; } // in `core::layout` impl Layout { // `pub const fn from_size_align(size: usize, align: usize) -> Result<Self, LayoutError>`'s sibling pub const fn from_size_alignment(size: usize, alignment: Alignment) -> Result<Self, LayoutError>; // `pub const unsafe fn from_size_align_unchecked(size: usize, align: usize) -> Self`'s sibling pub const unsafe fn from_size_alignment_unchecked(size: usize, alignment: Alignment) -> Self; // `pub const fn align(&self) -> usize`'s sibling pub const fn alignment(&self) -> Alignment; // `pub const fn align_to(&self, align: usize) -> Result<Self, LayoutError>`'s sibling pub const fn adjust_alignment_to(&self, alignment: Alignment) -> Result<Self, LayoutError>; // no `align: usize` sibling pub const fn padding_needed_for(&self, alignment: Alignment) -> usize; } ``` Removed: ```rust // in core::ptr #[deprecated(note = "moved from `ptr` to `mem`")] pub type Alignment = mem::Alignment; // in `core::mem` impl Alignment { #[deprecated(note = "renamed to `as_nonzero_usize`", suggestion = "as_nonzero_usize" )] pub const fn as_nonzero(self) -> NonZero<usize> { self.as_nonzero_usize() } } ``` ### const trait impls These *are* stabilized as non-const (see "Stabilized APIs"), but `const` counterparts remain unstable under the same feature gates: #### under `const_convert` (rust-lang#143773) ```rust impl const TryFrom<NonZero<usize>> for Alignment; impl const TryFrom<usize> for Alignment; impl const From<Alignment> for NonZero<usize>; impl const From<Alignment> for usize; ``` #### under `const_default` (rust-lang#143894). ```rust impl const Default for Alignment; ``` #### under `const_cmp` (rust-lang#143800). ```rust impl const PartialOrd for Alignment; impl const Ord for Alignment; impl const PartialEq for Alignment; impl const Eq for Alignment; ``` #### under `const_clone` (rust-lang#142757). ```rust impl const Clone for Alignment; ```
2 parents 5b79d33 + 6e05a38 commit f213ec5

20 files changed

Lines changed: 52 additions & 77 deletions

File tree

‎compiler/rustc_data_structures/src/lib.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#![allow(internal_features)]
1111
#![allow(rustc::default_hash_types)]
1212
#![allow(rustc::potential_query_instability)]
13+
#![cfg_attr(bootstrap, feature(ptr_alignment_type))]
1314
#![cfg_attr(bootstrap, feature(unwrap_infallible))]
1415
#![cfg_attr(test, feature(test))]
1516
#![deny(unsafe_op_in_unsafe_fn)]
@@ -28,7 +29,6 @@
2829
#![feature(nonzero_internals)]
2930
#![feature(pattern_type_macro)]
3031
#![feature(pattern_types)]
31-
#![feature(ptr_alignment_type)]
3232
#![feature(rustc_attrs)]
3333
#![feature(sized_hierarchy)]
3434
#![feature(thread_id_value)]

‎compiler/rustc_middle/src/lib.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#![allow(internal_features)]
2929
#![allow(rustc::direct_use_of_rustc_type_ir)]
3030
#![cfg_attr(bootstrap, feature(debug_closure_helpers))]
31+
#![cfg_attr(bootstrap, feature(ptr_alignment_type))]
3132
#![cfg_attr(doc, feature(intra_doc_pointers))]
3233
#![feature(allocator_ext)]
3334
#![feature(associated_type_defaults)]
@@ -45,7 +46,6 @@
4546
#![feature(min_specialization)]
4647
#![feature(negative_impls)]
4748
#![feature(option_into_flat_iter)]
48-
#![feature(ptr_alignment_type)]
4949
#![feature(range_bounds_is_empty)]
5050
#![feature(rustc_attrs)]
5151
#![feature(sized_hierarchy)]

‎library/core/src/alloc/layout.rs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl Layout {
104104
/// * `size`, when rounded up to the nearest multiple of `alignment`,
105105
/// must not overflow `isize` (i.e., the rounded value must be
106106
/// less than or equal to `isize::MAX`).
107-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
107+
#[unstable(feature = "ptr_alignment_type", issue = "165719")]
108108
#[inline]
109109
pub const fn from_size_alignment(
110110
size: usize,
@@ -149,7 +149,7 @@ impl Layout {
149149
///
150150
/// This function is unsafe as it does not verify the preconditions from
151151
/// [`Layout::from_size_alignment`].
152-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
152+
#[unstable(feature = "ptr_alignment_type", issue = "165719")]
153153
#[must_use]
154154
#[inline]
155155
#[track_caller]
@@ -191,7 +191,7 @@ impl Layout {
191191
/// The minimum byte alignment for a memory block of this layout.
192192
///
193193
/// The returned alignment is guaranteed to be a power of two.
194-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
194+
#[unstable(feature = "ptr_alignment_type", issue = "165719")]
195195
#[must_use = "this returns the minimum alignment, without modifying the layout"]
196196
#[inline]
197197
pub const fn alignment(&self) -> Alignment {
@@ -316,7 +316,7 @@ impl Layout {
316316
///
317317
/// Returns an error if the combination of `self.size()` and the given
318318
/// `alignment` violates the conditions listed in [`Layout::from_size_alignment`].
319-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
319+
#[unstable(feature = "ptr_alignment_type", issue = "165719")]
320320
#[inline]
321321
pub const fn adjust_alignment_to(&self, alignment: Alignment) -> Result<Self, LayoutError> {
322322
Layout::from_size_alignment(self.size, Alignment::max(self.align, alignment))
@@ -335,7 +335,7 @@ impl Layout {
335335
/// to be less than or equal to the alignment of the starting
336336
/// address for the whole allocated block of memory. One way to
337337
/// satisfy this constraint is to ensure `alignment.as_usize() <= self.align()`.
338-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
338+
#[unstable(feature = "ptr_alignment_type", issue = "165719")]
339339
#[must_use = "this returns the padding needed, without modifying the `Layout`"]
340340
#[inline]
341341
pub const fn padding_needed_for(&self, alignment: Alignment) -> usize {

‎library/core/src/mem/alignment.rs‎

Lines changed: 32 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![allow(clippy::enum_clike_unportable_variant)]
22

3-
use crate::marker::MetaSized;
43
use crate::num::NonZero;
54
use crate::ub_checks::assert_unsafe_precondition;
65
use crate::{cmp, fmt, hash, mem, num};
@@ -10,7 +9,7 @@ use crate::{cmp, fmt, hash, mem, num};
109
///
1110
/// Note that particularly large alignments, while representable in this type,
1211
/// are likely not to be supported by actual allocators and linkers.
13-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
12+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
1413
#[derive(Copy)]
1514
#[derive_const(Clone, PartialEq, Eq)]
1615
#[repr(transparent)]
@@ -37,19 +36,19 @@ impl Alignment {
3736
/// # Examples
3837
///
3938
/// ```
40-
/// #![feature(ptr_alignment_type)]
4139
/// use std::mem::Alignment;
4240
///
4341
/// assert_eq!(Alignment::MIN.as_usize(), 1);
4442
/// ```
45-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
43+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
4644
pub const MIN: Self = Self::new(1).unwrap();
4745

4846
/// Returns the alignment for a type.
4947
///
5048
/// This provides the same numerical value as [`align_of`],
5149
/// but in an `Alignment` instead of a `usize`.
52-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
50+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
51+
#[rustc_const_stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
5352
#[inline]
5453
#[must_use]
5554
pub const fn of<T>() -> Self {
@@ -71,7 +70,6 @@ impl Alignment {
7170
/// # Examples
7271
///
7372
/// ```
74-
/// #![feature(ptr_alignment_type)]
7573
/// use std::mem::Alignment;
7674
///
7775
/// assert_eq!(Alignment::of_val(&5i32).as_usize(), 4);
@@ -84,7 +82,6 @@ impl Alignment {
8482
/// `Alignment::of_val()` can be used to learn those alignments:
8583
///
8684
/// ```
87-
/// #![feature(ptr_alignment_type)]
8885
/// use std::mem::Alignment;
8986
///
9087
/// let a: &dyn ToString = &1234u16;
@@ -97,8 +94,9 @@ impl Alignment {
9794
/// [type-layout]: ../../reference/type-layout.html#r-layout.primitive
9895
#[inline]
9996
#[must_use]
100-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
101-
pub const fn of_val<T: MetaSized>(val: &T) -> Self {
97+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
98+
#[rustc_const_stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
99+
pub const fn of_val<T: ?Sized>(val: &T) -> Self {
102100
let align = mem::align_of_val(val);
103101
// SAFETY: `align_of_val` returns valid alignment
104102
unsafe { Alignment::new_unchecked(align) }
@@ -141,7 +139,6 @@ impl Alignment {
141139
/// # Examples
142140
///
143141
/// ```
144-
/// #![feature(ptr_alignment_type)]
145142
/// use std::mem::Alignment;
146143
///
147144
/// assert_eq!(unsafe { Alignment::of_val_raw(&5i32) }.as_usize(), 4);
@@ -153,8 +150,9 @@ impl Alignment {
153150
/// [type-layout]: ../../reference/type-layout.html#r-layout.primitive
154151
#[inline]
155152
#[must_use]
156-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
157-
pub const unsafe fn of_val_raw<T: MetaSized>(val: *const T) -> Self {
153+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
154+
#[rustc_const_stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
155+
pub const unsafe fn of_val_raw<T: ?Sized>(val: *const T) -> Self {
158156
// SAFETY: precondition propagated to the caller
159157
let align = unsafe { mem::align_of_val_raw(val) };
160158
// SAFETY: `align_of_val_raw` returns valid alignment
@@ -165,7 +163,8 @@ impl Alignment {
165163
/// not a power of two.
166164
///
167165
/// Note that `0` is not a power of two, nor a valid alignment.
168-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
166+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
167+
#[rustc_const_stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
169168
#[inline]
170169
pub const fn new(align: usize) -> Option<Self> {
171170
if align.is_power_of_two() {
@@ -184,7 +183,8 @@ impl Alignment {
184183
///
185184
/// Equivalently, it must be `1 << exp` for some `exp` in `0..usize::BITS`.
186185
/// It must *not* be zero.
187-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
186+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
187+
#[rustc_const_stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
188188
#[inline]
189189
#[track_caller]
190190
pub const unsafe fn new_unchecked(align: usize) -> Self {
@@ -200,7 +200,8 @@ impl Alignment {
200200
}
201201

202202
/// Returns the alignment as a [`usize`].
203-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
203+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
204+
#[rustc_const_stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
204205
#[inline]
205206
pub const fn as_usize(self) -> usize {
206207
// Going through `as_nonzero_usize` helps this be more clearly the inverse of
@@ -210,19 +211,8 @@ impl Alignment {
210211
}
211212

212213
/// Returns the alignment as a <code>[NonZero]<[usize]></code>.
213-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
214-
#[deprecated(
215-
since = "1.96.0",
216-
note = "renamed to `as_nonzero_usize`",
217-
suggestion = "as_nonzero_usize"
218-
)]
219-
#[inline]
220-
pub const fn as_nonzero(self) -> NonZero<usize> {
221-
self.as_nonzero_usize()
222-
}
223-
224-
/// Returns the alignment as a <code>[NonZero]<[usize]></code>.
225-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
214+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
215+
#[rustc_const_stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
226216
#[inline]
227217
pub const fn as_nonzero_usize(self) -> NonZero<usize> {
228218
// This transmutes directly to avoid the UbCheck in `NonZero::new_unchecked`
@@ -242,12 +232,12 @@ impl Alignment {
242232
///
243233
/// ```
244234
/// #![feature(ptr_alignment_type)]
245-
/// use std::ptr::Alignment;
235+
/// use std::mem::Alignment;
246236
///
247237
/// assert_eq!(Alignment::of::<u8>().log2(), 0);
248238
/// assert_eq!(Alignment::new(1024).unwrap().log2(), 10);
249239
/// ```
250-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
240+
#[unstable(feature = "ptr_alignment_type", issue = "165719")]
251241
#[inline]
252242
pub const fn log2(self) -> u32 {
253243
self.as_nonzero_usize().trailing_zeros()
@@ -260,8 +250,7 @@ impl Alignment {
260250
/// # Examples
261251
///
262252
/// ```
263-
/// #![feature(ptr_mask)]
264-
/// #![feature(ptr_alignment_type)]
253+
/// #![feature(ptr_alignment_type, ptr_mask)]
265254
/// use std::mem::Alignment;
266255
/// use std::ptr::NonNull;
267256
///
@@ -277,7 +266,8 @@ impl Alignment {
277266
/// assert_eq!(four.mask(Alignment::of::<Align4>().mask()), four);
278267
/// assert_ne!(one.mask(Alignment::of::<Align4>().mask()), one);
279268
/// ```
280-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
269+
#[unstable(feature = "ptr_alignment_type", issue = "165719")]
270+
// Also #[unstable(feature = "ptr_mask", issue = "98290")]
281271
#[inline]
282272
pub const fn mask(self) -> usize {
283273
// SAFETY: The alignment is always nonzero, and therefore decrementing won't overflow.
@@ -290,14 +280,14 @@ impl Alignment {
290280
}
291281
}
292282

293-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
283+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
294284
impl fmt::Debug for Alignment {
295285
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
296286
write!(f, "{:?} (1 << {:?})", self.as_nonzero_usize(), self.log2())
297287
}
298288
}
299289

300-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
290+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
301291
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
302292
const impl TryFrom<NonZero<usize>> for Alignment {
303293
type Error = num::TryFromIntError;
@@ -308,7 +298,7 @@ const impl TryFrom<NonZero<usize>> for Alignment {
308298
}
309299
}
310300

311-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
301+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
312302
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
313303
const impl TryFrom<usize> for Alignment {
314304
type Error = num::TryFromIntError;
@@ -319,7 +309,7 @@ const impl TryFrom<usize> for Alignment {
319309
}
320310
}
321311

322-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
312+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
323313
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
324314
const impl From<Alignment> for NonZero<usize> {
325315
#[inline]
@@ -328,7 +318,7 @@ const impl From<Alignment> for NonZero<usize> {
328318
}
329319
}
330320

331-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
321+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
332322
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
333323
const impl From<Alignment> for usize {
334324
#[inline]
@@ -337,7 +327,7 @@ const impl From<Alignment> for usize {
337327
}
338328
}
339329

340-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
330+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
341331
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
342332
const impl cmp::Ord for Alignment {
343333
#[inline]
@@ -346,7 +336,7 @@ const impl cmp::Ord for Alignment {
346336
}
347337
}
348338

349-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
339+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
350340
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
351341
const impl cmp::PartialOrd for Alignment {
352342
#[inline]
@@ -355,7 +345,7 @@ const impl cmp::PartialOrd for Alignment {
355345
}
356346
}
357347

358-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
348+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
359349
impl hash::Hash for Alignment {
360350
#[inline]
361351
fn hash<H: hash::Hasher>(&self, state: &mut H) {
@@ -364,7 +354,7 @@ impl hash::Hash for Alignment {
364354
}
365355

366356
/// Returns [`Alignment::MIN`], which is valid for any type.
367-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
357+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
368358
#[rustc_const_unstable(feature = "const_default", issue = "143894")]
369359
const impl Default for Alignment {
370360
fn default() -> Alignment {

‎library/core/src/mem/mod.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use crate::ub_checks::assert_unsafe_precondition;
3939
use crate::{clone, cmp, fmt, hash, intrinsics, ptr};
4040

4141
mod alignment;
42-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
42+
#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")]
4343
pub use alignment::Alignment;
4444

4545
mod manually_drop;
@@ -1605,7 +1605,7 @@ pub trait SizedTypeProperties: Sized {
16051605
const ALIGN: usize = intrinsics::align_of::<Self>();
16061606

16071607
#[doc(hidden)]
1608-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
1608+
#[unstable(feature = "sized_type_properties", issue = "none")]
16091609
const ALIGNMENT: Alignment = {
16101610
// This can't panic since type alignment is always a power of two.
16111611
Alignment::new(Self::ALIGN).unwrap()

‎library/core/src/num/error.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ pub enum IntErrorKind {
119119
///
120120
/// [`Alignment`]: core::mem::Alignment "mem::Alignment"
121121
#[unstable(feature = "try_from_int_error_kind", issue = "153978")]
122-
// Also, #[unstable(feature = "ptr_alignment_type", issue = "102070")]
123122
NotAPowerOfTwo,
124123
}
125124

‎library/core/src/ptr/mod.rs‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -434,11 +434,6 @@ use crate::num::NonZero;
434434
use crate::ops::FnPtr;
435435
use crate::{fmt, hash, intrinsics, ub_checks};
436436

437-
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
438-
#[deprecated(since = "1.96.0", note = "moved from `ptr` to `mem`")]
439-
/// Deprecated re-export of [mem::Alignment].
440-
pub type Alignment = mem::Alignment;
441-
442437
mod metadata;
443438
#[unstable(feature = "ptr_metadata", issue = "81513")]
444439
pub use metadata::{DynMetadata, Pointee, Thin, from_raw_parts, from_raw_parts_mut, metadata};
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(rustc_attrs)]
2-
#![feature(ptr_alignment_type)]
32

43
extern "Rust" {
54
#[rustc_std_internal_symbol]
@@ -9,6 +8,6 @@ extern "Rust" {
98
fn main() {
109
let bytes = isize::MAX as usize + 1;
1110
unsafe {
12-
__rust_alloc(bytes, 1usize.try_into().unwrap()); //~ERROR: larger than half the address space
11+
__rust_alloc(bytes, core::mem::Alignment::MIN); //~ERROR: larger than half the address space
1312
}
1413
}

‎src/tools/miri/tests/fail/alloc/too_large.stderr‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: Undefined Behavior: creating an allocation larger than half the address space
22
--> tests/fail/alloc/too_large.rs:LL:CC
33
|
4-
LL | __rust_alloc(bytes, 1usize.try_into().unwrap());
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
4+
LL | __rust_alloc(bytes, core::mem::Alignment::MIN);
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

0 commit comments

Comments
 (0)