Skip to content

Commit a7bb8c7

Browse files
pietroalbinicuviper
authored andcommitted
handle cfg(bootstrap)
1 parent d64f46a commit a7bb8c7

22 files changed

+101
-515
lines changed

library/core/src/fmt/mod.rs

-11
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ impl<'a> Arguments<'a> {
303303

304304
/// When using the format_args!() macro, this function is used to generate the
305305
/// Arguments structure.
306-
#[cfg(not(bootstrap))]
307306
#[inline]
308307
pub fn new_v1(pieces: &'a [&'static str], args: &'a [rt::Argument<'a>]) -> Arguments<'a> {
309308
if pieces.len() < args.len() || pieces.len() > args.len() + 1 {
@@ -312,16 +311,6 @@ impl<'a> Arguments<'a> {
312311
Arguments { pieces, fmt: None, args }
313312
}
314313

315-
#[cfg(bootstrap)]
316-
#[inline]
317-
#[rustc_const_unstable(feature = "const_fmt_arguments_new", issue = "none")]
318-
pub const fn new_v1(pieces: &'a [&'static str], args: &'a [rt::Argument<'a>]) -> Arguments<'a> {
319-
if pieces.len() < args.len() || pieces.len() > args.len() + 1 {
320-
panic!("invalid args");
321-
}
322-
Arguments { pieces, fmt: None, args }
323-
}
324-
325314
/// This function is used to specify nonstandard formatting parameters.
326315
///
327316
/// An `rt::UnsafeArg` is required because the following invariants must be held

library/core/src/future/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ pub unsafe fn get_context<'a, 'b>(cx: ResumeTy) -> &'a mut Context<'b> {
7070
#[doc(hidden)]
7171
#[unstable(feature = "gen_future", issue = "50547")]
7272
#[inline]
73-
#[cfg_attr(bootstrap, lang = "identity_future")]
7473
pub const fn identity_future<O, Fut: Future<Output = O>>(f: Fut) -> Fut {
7574
f
7675
}

library/core/src/intrinsics.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1823,14 +1823,12 @@ extern "rust-intrinsic" {
18231823
/// with an even least significant digit.
18241824
///
18251825
/// This intrinsic does not have a stable counterpart.
1826-
#[cfg(not(bootstrap))]
18271826
#[rustc_nounwind]
18281827
pub fn roundevenf32(x: f32) -> f32;
18291828
/// Returns the nearest integer to an `f64`. Rounds half-way cases to the number
18301829
/// with an even least significant digit.
18311830
///
18321831
/// This intrinsic does not have a stable counterpart.
1833-
#[cfg(not(bootstrap))]
18341832
#[rustc_nounwind]
18351833
pub fn roundevenf64(x: f64) -> f64;
18361834

@@ -2262,7 +2260,6 @@ extern "rust-intrinsic" {
22622260
/// This intrinsic can *only* be called where the argument is a local without
22632261
/// projections (`read_via_copy(p)`, not `read_via_copy(*p)`) so that it
22642262
/// trivially obeys runtime-MIR rules about derefs in operands.
2265-
#[cfg(not(bootstrap))]
22662263
#[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")]
22672264
#[rustc_nounwind]
22682265
pub fn read_via_copy<T>(p: *const T) -> T;
@@ -2470,7 +2467,6 @@ extern "rust-intrinsic" {
24702467
/// This method creates a pointer to any `Some` value. If the argument is
24712468
/// `None`, an invalid within-bounds pointer (that is still acceptable for
24722469
/// constructing an empty slice) is returned.
2473-
#[cfg(not(bootstrap))]
24742470
#[rustc_nounwind]
24752471
pub fn option_payload_ptr<T>(arg: *const Option<T>) -> *const T;
24762472
}

library/core/src/marker.rs

-1
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,6 @@ mod copy_impls {
929929
reason = "internal trait for implementing various traits for all function pointers"
930930
)]
931931
#[lang = "fn_ptr_trait"]
932-
#[cfg(not(bootstrap))]
933932
#[rustc_deny_explicit_impl]
934933
pub trait FnPtr: Copy + Clone {
935934
/// Returns the address of the function pointer.

library/core/src/option.rs

+1-15
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ use crate::{
558558
/// The `Option` type. See [the module level documentation](self) for more.
559559
#[derive(Copy, PartialOrd, Eq, Ord, Debug, Hash)]
560560
#[rustc_diagnostic_item = "Option"]
561-
#[cfg_attr(not(bootstrap), lang = "Option")]
561+
#[lang = "Option"]
562562
#[stable(feature = "rust1", since = "1.0.0")]
563563
pub enum Option<T> {
564564
/// No value.
@@ -765,13 +765,6 @@ impl<T> Option<T> {
765765
#[must_use]
766766
#[unstable(feature = "option_as_slice", issue = "108545")]
767767
pub fn as_slice(&self) -> &[T] {
768-
#[cfg(bootstrap)]
769-
match self {
770-
Some(value) => slice::from_ref(value),
771-
None => &[],
772-
}
773-
774-
#[cfg(not(bootstrap))]
775768
// SAFETY: When the `Option` is `Some`, we're using the actual pointer
776769
// to the payload, with a length of 1, so this is equivalent to
777770
// `slice::from_ref`, and thus is safe.
@@ -832,13 +825,6 @@ impl<T> Option<T> {
832825
#[must_use]
833826
#[unstable(feature = "option_as_slice", issue = "108545")]
834827
pub fn as_mut_slice(&mut self) -> &mut [T] {
835-
#[cfg(bootstrap)]
836-
match self {
837-
Some(value) => slice::from_mut(value),
838-
None => &mut [],
839-
}
840-
841-
#[cfg(not(bootstrap))]
842828
// SAFETY: When the `Option` is `Some`, we're using the actual pointer
843829
// to the payload, with a length of 1, so this is equivalent to
844830
// `slice::from_mut`, and thus is safe.

library/core/src/panicking.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ fn panic_bounds_check(index: usize, len: usize) -> ! {
165165
#[cold]
166166
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))]
167167
#[track_caller]
168-
#[cfg_attr(not(bootstrap), lang = "panic_misaligned_pointer_dereference")] // needed by codegen for panic on misaligned pointer deref
168+
#[lang = "panic_misaligned_pointer_dereference"] // needed by codegen for panic on misaligned pointer deref
169169
fn panic_misaligned_pointer_dereference(required: usize, found: usize) -> ! {
170170
if cfg!(feature = "panic_immediate_abort") {
171171
super::intrinsics::abort()

library/core/src/primitive_docs.rs

+25-50
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// `library/{std,core}/src/primitive_docs.rs` should have the same contents.
22
// These are different files so that relative links work properly without
33
// having to have `CARGO_PKG_NAME` set, but conceptually they should always be the same.
4-
#[cfg_attr(bootstrap, doc(primitive = "bool"))]
5-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "bool")]
4+
#[rustc_doc_primitive = "bool"]
65
#[doc(alias = "true")]
76
#[doc(alias = "false")]
87
/// The boolean type.
@@ -64,8 +63,7 @@
6463
#[stable(feature = "rust1", since = "1.0.0")]
6564
mod prim_bool {}
6665

67-
#[cfg_attr(bootstrap, doc(primitive = "never"))]
68-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "never")]
66+
#[rustc_doc_primitive = "never"]
6967
#[doc(alias = "!")]
7068
//
7169
/// The `!` type, also called "never".
@@ -276,8 +274,7 @@ mod prim_bool {}
276274
#[unstable(feature = "never_type", issue = "35121")]
277275
mod prim_never {}
278276

279-
#[cfg_attr(bootstrap, doc(primitive = "char"))]
280-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "char")]
277+
#[rustc_doc_primitive = "char"]
281278
#[allow(rustdoc::invalid_rust_codeblocks)]
282279
/// A character type.
283280
///
@@ -401,8 +398,7 @@ mod prim_never {}
401398
#[stable(feature = "rust1", since = "1.0.0")]
402399
mod prim_char {}
403400

404-
#[cfg_attr(bootstrap, doc(primitive = "unit"))]
405-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "unit")]
401+
#[rustc_doc_primitive = "unit"]
406402
#[doc(alias = "(")]
407403
#[doc(alias = ")")]
408404
#[doc(alias = "()")]
@@ -464,8 +460,7 @@ impl Copy for () {
464460
// empty
465461
}
466462

467-
#[cfg_attr(bootstrap, doc(primitive = "pointer"))]
468-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "pointer")]
463+
#[rustc_doc_primitive = "pointer"]
469464
#[doc(alias = "ptr")]
470465
#[doc(alias = "*")]
471466
#[doc(alias = "*const")]
@@ -581,8 +576,7 @@ impl Copy for () {
581576
#[stable(feature = "rust1", since = "1.0.0")]
582577
mod prim_pointer {}
583578

584-
#[cfg_attr(bootstrap, doc(primitive = "array"))]
585-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "array")]
579+
#[rustc_doc_primitive = "array"]
586580
#[doc(alias = "[]")]
587581
#[doc(alias = "[T;N]")] // unfortunately, rustdoc doesn't have fuzzy search for aliases
588582
#[doc(alias = "[T; N]")]
@@ -783,8 +777,7 @@ mod prim_pointer {}
783777
#[stable(feature = "rust1", since = "1.0.0")]
784778
mod prim_array {}
785779

786-
#[cfg_attr(bootstrap, doc(primitive = "slice"))]
787-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "slice")]
780+
#[rustc_doc_primitive = "slice"]
788781
#[doc(alias = "[")]
789782
#[doc(alias = "]")]
790783
#[doc(alias = "[]")]
@@ -876,8 +869,7 @@ mod prim_array {}
876869
#[stable(feature = "rust1", since = "1.0.0")]
877870
mod prim_slice {}
878871

879-
#[cfg_attr(bootstrap, doc(primitive = "str"))]
880-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "str")]
872+
#[rustc_doc_primitive = "str"]
881873
/// String slices.
882874
///
883875
/// *[See also the `std::str` module](crate::str).*
@@ -944,8 +936,7 @@ mod prim_slice {}
944936
#[stable(feature = "rust1", since = "1.0.0")]
945937
mod prim_str {}
946938

947-
#[cfg_attr(bootstrap, doc(primitive = "tuple"))]
948-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "tuple")]
939+
#[rustc_doc_primitive = "tuple"]
949940
#[doc(alias = "(")]
950941
#[doc(alias = ")")]
951942
#[doc(alias = "()")]
@@ -1088,8 +1079,7 @@ impl<T: Copy> Copy for (T,) {
10881079
// empty
10891080
}
10901081

1091-
#[cfg_attr(bootstrap, doc(primitive = "f32"))]
1092-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "f32")]
1082+
#[rustc_doc_primitive = "f32"]
10931083
/// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008).
10941084
///
10951085
/// This type can represent a wide range of decimal numbers, like `3.5`, `27`,
@@ -1155,8 +1145,7 @@ impl<T: Copy> Copy for (T,) {
11551145
#[stable(feature = "rust1", since = "1.0.0")]
11561146
mod prim_f32 {}
11571147

1158-
#[cfg_attr(bootstrap, doc(primitive = "f64"))]
1159-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "f64")]
1148+
#[rustc_doc_primitive = "f64"]
11601149
/// A 64-bit floating point type (specifically, the "binary64" type defined in IEEE 754-2008).
11611150
///
11621151
/// This type is very similar to [`f32`], but has increased
@@ -1171,78 +1160,67 @@ mod prim_f32 {}
11711160
#[stable(feature = "rust1", since = "1.0.0")]
11721161
mod prim_f64 {}
11731162

1174-
#[cfg_attr(bootstrap, doc(primitive = "i8"))]
1175-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i8")]
1163+
#[rustc_doc_primitive = "i8"]
11761164
//
11771165
/// The 8-bit signed integer type.
11781166
#[stable(feature = "rust1", since = "1.0.0")]
11791167
mod prim_i8 {}
11801168

1181-
#[cfg_attr(bootstrap, doc(primitive = "i16"))]
1182-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i16")]
1169+
#[rustc_doc_primitive = "i16"]
11831170
//
11841171
/// The 16-bit signed integer type.
11851172
#[stable(feature = "rust1", since = "1.0.0")]
11861173
mod prim_i16 {}
11871174

1188-
#[cfg_attr(bootstrap, doc(primitive = "i32"))]
1189-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i32")]
1175+
#[rustc_doc_primitive = "i32"]
11901176
//
11911177
/// The 32-bit signed integer type.
11921178
#[stable(feature = "rust1", since = "1.0.0")]
11931179
mod prim_i32 {}
11941180

1195-
#[cfg_attr(bootstrap, doc(primitive = "i64"))]
1196-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i64")]
1181+
#[rustc_doc_primitive = "i64"]
11971182
//
11981183
/// The 64-bit signed integer type.
11991184
#[stable(feature = "rust1", since = "1.0.0")]
12001185
mod prim_i64 {}
12011186

1202-
#[cfg_attr(bootstrap, doc(primitive = "i128"))]
1203-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i128")]
1187+
#[rustc_doc_primitive = "i128"]
12041188
//
12051189
/// The 128-bit signed integer type.
12061190
#[stable(feature = "i128", since = "1.26.0")]
12071191
mod prim_i128 {}
12081192

1209-
#[cfg_attr(bootstrap, doc(primitive = "u8"))]
1210-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u8")]
1193+
#[rustc_doc_primitive = "u8"]
12111194
//
12121195
/// The 8-bit unsigned integer type.
12131196
#[stable(feature = "rust1", since = "1.0.0")]
12141197
mod prim_u8 {}
12151198

1216-
#[cfg_attr(bootstrap, doc(primitive = "u16"))]
1217-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u16")]
1199+
#[rustc_doc_primitive = "u16"]
12181200
//
12191201
/// The 16-bit unsigned integer type.
12201202
#[stable(feature = "rust1", since = "1.0.0")]
12211203
mod prim_u16 {}
12221204

1223-
#[cfg_attr(bootstrap, doc(primitive = "u32"))]
1224-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u32")]
1205+
#[rustc_doc_primitive = "u32"]
12251206
//
12261207
/// The 32-bit unsigned integer type.
12271208
#[stable(feature = "rust1", since = "1.0.0")]
12281209
mod prim_u32 {}
12291210

1230-
#[cfg_attr(bootstrap, doc(primitive = "u64"))]
1231-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u64")]
1211+
#[rustc_doc_primitive = "u64"]
12321212
//
12331213
/// The 64-bit unsigned integer type.
12341214
#[stable(feature = "rust1", since = "1.0.0")]
12351215
mod prim_u64 {}
12361216

1237-
#[cfg_attr(bootstrap, doc(primitive = "u128"))]
1238-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u128")]
1217+
#[rustc_doc_primitive = "u128"]
12391218
//
12401219
/// The 128-bit unsigned integer type.
12411220
#[stable(feature = "i128", since = "1.26.0")]
12421221
mod prim_u128 {}
12431222

1244-
#[cfg_attr(bootstrap, doc(primitive = "isize"))]
1245-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "isize")]
1223+
#[rustc_doc_primitive = "isize"]
12461224
//
12471225
/// The pointer-sized signed integer type.
12481226
///
@@ -1252,8 +1230,7 @@ mod prim_u128 {}
12521230
#[stable(feature = "rust1", since = "1.0.0")]
12531231
mod prim_isize {}
12541232

1255-
#[cfg_attr(bootstrap, doc(primitive = "usize"))]
1256-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "usize")]
1233+
#[rustc_doc_primitive = "usize"]
12571234
//
12581235
/// The pointer-sized unsigned integer type.
12591236
///
@@ -1263,8 +1240,7 @@ mod prim_isize {}
12631240
#[stable(feature = "rust1", since = "1.0.0")]
12641241
mod prim_usize {}
12651242

1266-
#[cfg_attr(bootstrap, doc(primitive = "reference"))]
1267-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "reference")]
1243+
#[rustc_doc_primitive = "reference"]
12681244
#[doc(alias = "&")]
12691245
#[doc(alias = "&mut")]
12701246
//
@@ -1396,8 +1372,7 @@ mod prim_usize {}
13961372
#[stable(feature = "rust1", since = "1.0.0")]
13971373
mod prim_ref {}
13981374

1399-
#[cfg_attr(bootstrap, doc(primitive = "fn"))]
1400-
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "fn")]
1375+
#[rustc_doc_primitive = "fn"]
14011376
//
14021377
/// Function pointers, like `fn(usize) -> bool`.
14031378
///

0 commit comments

Comments
 (0)