1
Fork 0

Update bootstrap cfg

This commit is contained in:
Pietro Albini 2022-12-15 09:52:32 +01:00 committed by Mark Rousskov
parent 060a6ead83
commit 11191279b7
24 changed files with 38 additions and 663 deletions

View file

@ -1350,26 +1350,6 @@ impl<T: ?Sized> *const T {
panic!("align_offset: align is not a power-of-two");
}
#[cfg(bootstrap)]
{
fn rt_impl<T>(p: *const T, align: usize) -> usize {
// SAFETY: `align` has been checked to be a power of 2 above
unsafe { align_offset(p, align) }
}
const fn ctfe_impl<T>(_: *const T, _: usize) -> usize {
usize::MAX
}
// SAFETY:
// It is permissible for `align_offset` to always return `usize::MAX`,
// algorithm correctness can not depend on `align_offset` returning non-max values.
//
// As such the behaviour can't change after replacing `align_offset` with `usize::MAX`, only performance can.
unsafe { intrinsics::const_eval_select((self, align), ctfe_impl, rt_impl) }
}
#[cfg(not(bootstrap))]
{
// SAFETY: `align` has been checked to be a power of 2 above
unsafe { align_offset(self, align) }
@ -1406,8 +1386,7 @@ impl<T: ?Sized> *const T {
/// is never aligned if cast to a type with a stricter alignment than the reference's
/// underlying allocation.
///
#[cfg_attr(bootstrap, doc = "```ignore")]
#[cfg_attr(not(bootstrap), doc = "```")]
/// ```
/// #![feature(pointer_is_aligned)]
/// #![feature(const_pointer_is_aligned)]
///
@ -1433,8 +1412,7 @@ impl<T: ?Sized> *const T {
/// Due to this behavior, it is possible that a runtime pointer derived from a compiletime
/// pointer is aligned, even if the compiletime pointer wasn't aligned.
///
#[cfg_attr(bootstrap, doc = "```ignore")]
#[cfg_attr(not(bootstrap), doc = "```")]
/// ```
/// #![feature(pointer_is_aligned)]
/// #![feature(const_pointer_is_aligned)]
///
@ -1460,8 +1438,7 @@ impl<T: ?Sized> *const T {
/// If a pointer is created from a fixed address, this function behaves the same during
/// runtime and compiletime.
///
#[cfg_attr(bootstrap, doc = "```ignore")]
#[cfg_attr(not(bootstrap), doc = "```")]
/// ```
/// #![feature(pointer_is_aligned)]
/// #![feature(const_pointer_is_aligned)]
///
@ -1537,8 +1514,7 @@ impl<T: ?Sized> *const T {
/// return `true` if the pointer is guaranteed to be aligned. This means that the pointer
/// cannot be stricter aligned than the reference's underlying allocation.
///
#[cfg_attr(bootstrap, doc = "```ignore")]
#[cfg_attr(not(bootstrap), doc = "```")]
/// ```
/// #![feature(pointer_is_aligned)]
/// #![feature(const_pointer_is_aligned)]
///
@ -1563,8 +1539,7 @@ impl<T: ?Sized> *const T {
/// Due to this behavior, it is possible that a runtime pointer derived from a compiletime
/// pointer is aligned, even if the compiletime pointer wasn't aligned.
///
#[cfg_attr(bootstrap, doc = "```ignore")]
#[cfg_attr(not(bootstrap), doc = "```")]
/// ```
/// #![feature(pointer_is_aligned)]
/// #![feature(const_pointer_is_aligned)]
///
@ -1588,8 +1563,7 @@ impl<T: ?Sized> *const T {
/// If a pointer is created from a fixed address, this function behaves the same during
/// runtime and compiletime.
///
#[cfg_attr(bootstrap, doc = "```ignore")]
#[cfg_attr(not(bootstrap), doc = "```")]
/// ```
/// #![feature(pointer_is_aligned)]
/// #![feature(const_pointer_is_aligned)]
///