update cfgs

This commit is contained in:
Boxy 2025-04-02 21:28:54 +01:00
parent 609eacbb22
commit c93005ee65
24 changed files with 29 additions and 140 deletions

View File

@ -315,7 +315,7 @@ mod helper {
use super::*;
pub(super) type ObligationTreeIdGenerator = impl Iterator<Item = ObligationTreeId>;
impl<O: ForestObligation> ObligationForest<O> {
#[cfg_attr(not(bootstrap), define_opaque(ObligationTreeIdGenerator))]
#[define_opaque(ObligationTreeIdGenerator)]
pub fn new() -> ObligationForest<O> {
ObligationForest {
nodes: vec![],

View File

@ -208,7 +208,7 @@ pub type LazyFallbackBundle = Arc<LazyLock<FluentBundle, impl FnOnce() -> Fluent
/// Return the default `FluentBundle` with standard "en-US" diagnostic messages.
#[instrument(level = "trace", skip(resources))]
#[cfg_attr(not(bootstrap), define_opaque(LazyFallbackBundle))]
#[define_opaque(LazyFallbackBundle)]
pub fn fallback_fluent_bundle(
resources: Vec<&'static str>,
with_directionality_markers: bool,

View File

@ -454,7 +454,7 @@ mod helper {
/// Like [`SwitchTargets::target_for_value`], but returning the same type as
/// [`Terminator::successors`].
#[inline]
#[cfg_attr(not(bootstrap), define_opaque(Successors))]
#[define_opaque(Successors)]
pub fn successors_for_value(&self, value: u128) -> Successors<'_> {
let target = self.target_for_value(value);
(&[]).into_iter().copied().chain(Some(target))
@ -463,7 +463,7 @@ mod helper {
impl<'tcx> TerminatorKind<'tcx> {
#[inline]
#[cfg_attr(not(bootstrap), define_opaque(Successors))]
#[define_opaque(Successors)]
pub fn successors(&self) -> Successors<'_> {
use self::TerminatorKind::*;
match *self {
@ -502,7 +502,7 @@ mod helper {
}
#[inline]
#[cfg_attr(not(bootstrap), define_opaque(SuccessorsMut))]
#[define_opaque(SuccessorsMut)]
pub fn successors_mut(&mut self) -> SuccessorsMut<'_> {
use self::TerminatorKind::*;
match *self {

View File

@ -25,7 +25,7 @@ pub trait EraseType: Copy {
pub type Erase<T: EraseType> = Erased<impl Copy>;
#[inline(always)]
#[cfg_attr(not(bootstrap), define_opaque(Erase))]
#[define_opaque(Erase)]
pub fn erase<T: EraseType>(src: T) -> Erase<T> {
// Ensure the sizes match
const {
@ -49,7 +49,7 @@ pub fn erase<T: EraseType>(src: T) -> Erase<T> {
/// Restores an erased value.
#[inline(always)]
#[cfg_attr(not(bootstrap), define_opaque(Erase))]
#[define_opaque(Erase)]
pub fn restore<T: EraseType>(value: Erase<T>) -> T {
let value: Erased<<T as EraseType>::Result> = value;
// See comment in `erase` for why we use `transmute_unchecked`.

View File

@ -6,7 +6,7 @@
// tidy-alphabetical-start
#![allow(rustc::usage_of_type_ir_inherent)]
#![cfg_attr(not(bootstrap), allow(rustc::usage_of_type_ir_traits))]
#![allow(rustc::usage_of_type_ir_traits)]
// tidy-alphabetical-end
pub mod canonicalizer;

View File

@ -1,12 +1,12 @@
// tidy-alphabetical-start
#![allow(rustc::usage_of_ty_tykind)]
#![allow(rustc::usage_of_type_ir_inherent)]
#![allow(rustc::usage_of_type_ir_traits)]
#![cfg_attr(
feature = "nightly",
feature(associated_type_defaults, never_type, rustc_attrs, negative_impls)
)]
#![cfg_attr(feature = "nightly", allow(internal_features))]
#![cfg_attr(not(bootstrap), allow(rustc::usage_of_type_ir_traits))]
// tidy-alphabetical-end
extern crate self as rustc_type_ir;

View File

@ -16,22 +16,22 @@ unsafe extern "Rust" {
// otherwise.
#[rustc_allocator]
#[rustc_nounwind]
#[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
#[rustc_std_internal_symbol]
fn __rust_alloc(size: usize, align: usize) -> *mut u8;
#[rustc_deallocator]
#[rustc_nounwind]
#[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
#[rustc_std_internal_symbol]
fn __rust_dealloc(ptr: *mut u8, size: usize, align: usize);
#[rustc_reallocator]
#[rustc_nounwind]
#[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
#[rustc_std_internal_symbol]
fn __rust_realloc(ptr: *mut u8, old_size: usize, align: usize, new_size: usize) -> *mut u8;
#[rustc_allocator_zeroed]
#[rustc_nounwind]
#[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
#[rustc_std_internal_symbol]
fn __rust_alloc_zeroed(size: usize, align: usize) -> *mut u8;
#[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
#[rustc_std_internal_symbol]
static __rust_no_alloc_shim_is_unstable: u8;
}
@ -360,7 +360,7 @@ unsafe extern "Rust" {
// This is the magic symbol to call the global alloc error handler. rustc generates
// it to call `__rg_oom` if there is a `#[alloc_error_handler]`, or to call the
// default implementations below (`__rdl_oom`) otherwise.
#[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
#[rustc_std_internal_symbol]
fn __rust_alloc_error_handler(size: usize, align: usize) -> !;
}
@ -427,7 +427,7 @@ pub mod __alloc_error_handler {
unsafe extern "Rust" {
// This symbol is emitted by rustc next to __rust_alloc_error_handler.
// Its value depends on the -Zoom={panic,abort} compiler option.
#[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
#[rustc_std_internal_symbol]
static __rust_alloc_error_handler_should_panic: u8;
}

View File

@ -32,8 +32,6 @@ check-cfg = [
'cfg(bootstrap)',
'cfg(no_fp_fmt_parse)',
'cfg(stdarch_intel_sde)',
# #[cfg(bootstrap)]
'cfg(target_feature, values("vector-enhancements-1"))',
# core use #[path] imports to portable-simd `core_simd` crate
# and to stdarch `core_arch` crate which messes-up with Cargo list
# of declared features, we therefor expect any feature cfg

View File

@ -216,7 +216,7 @@ pub macro Clone($item:item) {
/// Use closures allow captured values to be automatically used.
/// This is similar to have a closure that you would call `.use` over each captured value.
#[unstable(feature = "ergonomic_clones", issue = "132290")]
#[cfg_attr(not(bootstrap), lang = "use_cloned")]
#[lang = "use_cloned"]
pub trait UseCloned: Clone {
// Empty.
}

View File

@ -1515,19 +1515,6 @@ unsafe fn run(fmt: &mut Formatter<'_>, arg: &rt::Placeholder, args: &[rt::Argume
// which guarantees the indexes are always within bounds.
unsafe { (getcount(args, &arg.width), getcount(args, &arg.precision)) };
#[cfg(bootstrap)]
let options =
*FormattingOptions { flags: flags::ALWAYS_SET | arg.flags << 21, width: 0, precision: 0 }
.align(match arg.align {
rt::Alignment::Left => Some(Alignment::Left),
rt::Alignment::Right => Some(Alignment::Right),
rt::Alignment::Center => Some(Alignment::Center),
rt::Alignment::Unknown => None,
})
.fill(arg.fill)
.width(width)
.precision(precision);
#[cfg(not(bootstrap))]
let options = FormattingOptions { flags: arg.flags, width, precision };
// Extract the correct argument
@ -1544,21 +1531,6 @@ unsafe fn run(fmt: &mut Formatter<'_>, arg: &rt::Placeholder, args: &[rt::Argume
unsafe { value.fmt(fmt) }
}
#[cfg(bootstrap)]
unsafe fn getcount(args: &[rt::Argument<'_>], cnt: &rt::Count) -> Option<u16> {
match *cnt {
rt::Count::Is(n) => Some(n as u16),
rt::Count::Implied => None,
rt::Count::Param(i) => {
debug_assert!(i < args.len());
// SAFETY: cnt and args come from the same Arguments,
// which guarantees this index is always within bounds.
unsafe { args.get_unchecked(i).as_u16() }
}
}
}
#[cfg(not(bootstrap))]
unsafe fn getcount(args: &[rt::Argument<'_>], cnt: &rt::Count) -> u16 {
match *cnt {
rt::Count::Is(n) => n,

View File

@ -11,10 +11,6 @@ use crate::ptr::NonNull;
#[derive(Copy, Clone)]
pub struct Placeholder {
pub position: usize,
#[cfg(bootstrap)]
pub fill: char,
#[cfg(bootstrap)]
pub align: Alignment,
pub flags: u32,
pub precision: Count,
pub width: Count,
@ -23,38 +19,17 @@ pub struct Placeholder {
#[cfg(bootstrap)]
impl Placeholder {
#[inline]
pub const fn new(
position: usize,
fill: char,
align: Alignment,
flags: u32,
precision: Count,
width: Count,
) -> Self {
Self { position, fill, align, flags, precision, width }
pub const fn new(position: usize, flags: u32, precision: Count, width: Count) -> Self {
Self { position, flags, precision, width }
}
}
#[cfg(bootstrap)]
#[lang = "format_alignment"]
#[derive(Copy, Clone, PartialEq, Eq)]
pub enum Alignment {
Left,
Right,
Center,
Unknown,
}
/// Used by [width](https://doc.rust-lang.org/std/fmt/#width)
/// and [precision](https://doc.rust-lang.org/std/fmt/#precision) specifiers.
#[lang = "format_count"]
#[derive(Copy, Clone)]
pub enum Count {
/// Specified with a literal number, stores the value
#[cfg(bootstrap)]
Is(usize),
/// Specified with a literal number, stores the value
#[cfg(not(bootstrap))]
Is(u16),
/// Specified using `$` and `*` syntaxes, stores the index into `args`
Param(usize),

View File

@ -2304,20 +2304,8 @@ pub unsafe fn truncf128(x: f128) -> f128;
/// [`f16::round_ties_even`](../../std/primitive.f16.html#method.round_ties_even)
#[rustc_intrinsic]
#[rustc_nounwind]
#[cfg(not(bootstrap))]
pub fn round_ties_even_f16(x: f16) -> f16;
/// To be removed on next bootstrap bump.
#[cfg(bootstrap)]
pub fn round_ties_even_f16(x: f16) -> f16 {
#[rustc_intrinsic]
#[rustc_nounwind]
unsafe fn rintf16(x: f16) -> f16;
// SAFETY: this intrinsic isn't actually unsafe
unsafe { rintf16(x) }
}
/// Returns the nearest integer to an `f32`. Rounds half-way cases to the number with an even
/// least significant digit.
///
@ -2325,20 +2313,8 @@ pub fn round_ties_even_f16(x: f16) -> f16 {
/// [`f32::round_ties_even`](../../std/primitive.f32.html#method.round_ties_even)
#[rustc_intrinsic]
#[rustc_nounwind]
#[cfg(not(bootstrap))]
pub fn round_ties_even_f32(x: f32) -> f32;
/// To be removed on next bootstrap bump.
#[cfg(bootstrap)]
pub fn round_ties_even_f32(x: f32) -> f32 {
#[rustc_intrinsic]
#[rustc_nounwind]
unsafe fn rintf32(x: f32) -> f32;
// SAFETY: this intrinsic isn't actually unsafe
unsafe { rintf32(x) }
}
/// Provided for compatibility with stdarch. DO NOT USE.
#[inline(always)]
pub unsafe fn rintf32(x: f32) -> f32 {
@ -2352,20 +2328,8 @@ pub unsafe fn rintf32(x: f32) -> f32 {
/// [`f64::round_ties_even`](../../std/primitive.f64.html#method.round_ties_even)
#[rustc_intrinsic]
#[rustc_nounwind]
#[cfg(not(bootstrap))]
pub fn round_ties_even_f64(x: f64) -> f64;
/// To be removed on next bootstrap bump.
#[cfg(bootstrap)]
pub fn round_ties_even_f64(x: f64) -> f64 {
#[rustc_intrinsic]
#[rustc_nounwind]
unsafe fn rintf64(x: f64) -> f64;
// SAFETY: this intrinsic isn't actually unsafe
unsafe { rintf64(x) }
}
/// Provided for compatibility with stdarch. DO NOT USE.
#[inline(always)]
pub unsafe fn rintf64(x: f64) -> f64 {
@ -2379,20 +2343,8 @@ pub unsafe fn rintf64(x: f64) -> f64 {
/// [`f128::round_ties_even`](../../std/primitive.f128.html#method.round_ties_even)
#[rustc_intrinsic]
#[rustc_nounwind]
#[cfg(not(bootstrap))]
pub fn round_ties_even_f128(x: f128) -> f128;
/// To be removed on next bootstrap bump.
#[cfg(bootstrap)]
pub fn round_ties_even_f128(x: f128) -> f128 {
#[rustc_intrinsic]
#[rustc_nounwind]
unsafe fn rintf128(x: f128) -> f128;
// SAFETY: this intrinsic isn't actually unsafe
unsafe { rintf128(x) }
}
/// Returns the nearest integer to an `f16`. Rounds half-way cases away from zero.
///
/// The stabilized version of this intrinsic is

View File

@ -1753,7 +1753,6 @@ pub(crate) mod builtin {
reason = "`type_alias_impl_trait` has open design concerns"
)]
#[rustc_builtin_macro]
#[cfg(not(bootstrap))]
pub macro define_opaque($($tt:tt)*) {
/* compiler built-in */
}

View File

@ -25,15 +25,15 @@ macro_rules! pattern_type {
)]
pub trait RangePattern {
/// Trait version of the inherent `MIN` assoc const.
#[cfg_attr(not(bootstrap), lang = "RangeMin")]
#[lang = "RangeMin"]
const MIN: Self;
/// Trait version of the inherent `MIN` assoc const.
#[cfg_attr(not(bootstrap), lang = "RangeMax")]
#[lang = "RangeMax"]
const MAX: Self;
/// A compile-time helper to subtract 1 for exclusive ranges.
#[cfg_attr(not(bootstrap), lang = "RangeSub")]
#[lang = "RangeSub"]
#[track_caller]
fn sub_one(self) -> Self;
}

View File

@ -1943,7 +1943,7 @@ unsafe impl<T: ?Sized> PinCoerceUnsized for *mut T {}
#[stable(feature = "pin_macro", since = "1.68.0")]
#[rustc_macro_transparency = "semitransparent"]
#[allow_internal_unstable(unsafe_pin_internals)]
#[cfg_attr(not(bootstrap), rustc_macro_edition_2021)]
#[rustc_macro_edition_2021]
pub macro pin($value:expr $(,)?) {
// This is `Pin::new_unchecked(&mut { $value })`, so, for starters, let's
// review such a hypothetical macro (that any user-code could define):

View File

@ -117,5 +117,4 @@ pub use crate::macros::builtin::deref;
issue = "63063",
reason = "`type_alias_impl_trait` has open design concerns"
)]
#[cfg(not(bootstrap))]
pub use crate::macros::builtin::define_opaque;

View File

@ -38,7 +38,6 @@ fn rust_2024_expr() {
}
#[test]
#[cfg(not(bootstrap))]
fn temp_lifetime() {
// Check that temporary lifetimes work as in Rust 2021.
// Regression test for https://github.com/rust-lang/rust/issues/138596

View File

@ -79,11 +79,11 @@ cfg_if::cfg_if! {
unsafe extern "C" {
/// Handler in std called when a panic object is dropped outside of
/// `catch_unwind`.
#[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
#[rustc_std_internal_symbol]
fn __rust_drop_panic() -> !;
/// Handler in std called when a foreign exception is caught.
#[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
#[rustc_std_internal_symbol]
fn __rust_foreign_exception() -> !;
}

View File

@ -9,7 +9,6 @@
#![deny(unsafe_code)]
// proc_macros anyway don't work on wasm hosts so while both sides of this bridge can
// be built with different versions of rustc, the wasm ABI changes don't really matter.
#![cfg_attr(bootstrap, allow(unknown_lints))]
#![allow(wasm_c_abi)]
use std::hash::Hash;

View File

@ -348,7 +348,7 @@ fn default_alloc_error_hook(layout: Layout) {
unsafe extern "Rust" {
// This symbol is emitted by rustc next to __rust_alloc_error_handler.
// Its value depends on the -Zoom={panic,abort} compiler option.
#[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
#[rustc_std_internal_symbol]
static __rust_alloc_error_handler_should_panic: u8;
}

View File

@ -432,7 +432,7 @@ mod helper {
use super::*;
pub(super) type LazyResolve = impl (FnOnce() -> Capture) + Send + Sync + UnwindSafe;
#[cfg_attr(not(bootstrap), define_opaque(LazyResolve))]
#[define_opaque(LazyResolve)]
pub(super) fn lazy_resolve(mut capture: Capture) -> LazyResolve {
move || {
// Use the global backtrace lock to synchronize this as it's a

View File

@ -55,14 +55,14 @@ pub static EMPTY_PANIC: fn(&'static str) -> ! =
// hook up these functions, but it is not this day!
#[allow(improper_ctypes)]
unsafe extern "C" {
#[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
#[rustc_std_internal_symbol]
fn __rust_panic_cleanup(payload: *mut u8) -> *mut (dyn Any + Send + 'static);
}
unsafe extern "Rust" {
/// `PanicPayload` lazily performs allocation only when needed (this avoids
/// allocations when using the "abort" panic runtime).
#[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
#[rustc_std_internal_symbol]
fn __rust_start_panic(payload: &mut dyn PanicPayload) -> u32;
}

View File

@ -109,7 +109,6 @@ pub use core::prelude::v1::deref;
issue = "63063",
reason = "`type_alias_impl_trait` has open design concerns"
)]
#[cfg(not(bootstrap))]
pub use core::prelude::v1::define_opaque;
// The file so far is equivalent to core/src/prelude/v1.rs. It is duplicated

View File

@ -459,9 +459,6 @@ fn profiler_runtime() {
#[test]
fn asm_support() {
let asms = [
#[cfg(bootstrap)]
("avr-unknown-gnu-atmega328", false),
#[cfg(not(bootstrap))]
("avr-none", false),
("i686-unknown-netbsd", true),
("riscv32gc-unknown-linux-gnu", true),