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- #[ doc( primitive = "bool" ) ]
4+ #[ cfg_attr( bootstrap, doc( primitive = "bool" ) ) ]
5+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "bool" ) ]
56#[ doc( alias = "true" ) ]
67#[ doc( alias = "false" ) ]
78/// The boolean type.
6364#[ stable( feature = "rust1" , since = "1.0.0" ) ]
6465mod prim_bool { }
6566
66- #[ doc( primitive = "never" ) ]
67+ #[ cfg_attr( bootstrap, doc( primitive = "never" ) ) ]
68+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "never" ) ]
6769#[ doc( alias = "!" ) ]
6870//
6971/// The `!` type, also called "never".
@@ -274,7 +276,8 @@ mod prim_bool {}
274276#[ unstable( feature = "never_type" , issue = "35121" ) ]
275277mod prim_never { }
276278
277- #[ doc( primitive = "char" ) ]
279+ #[ cfg_attr( bootstrap, doc( primitive = "char" ) ) ]
280+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "char" ) ]
278281#[ allow( rustdoc:: invalid_rust_codeblocks) ]
279282/// A character type.
280283///
@@ -398,7 +401,8 @@ mod prim_never {}
398401#[ stable( feature = "rust1" , since = "1.0.0" ) ]
399402mod prim_char { }
400403
401- #[ doc( primitive = "unit" ) ]
404+ #[ cfg_attr( bootstrap, doc( primitive = "unit" ) ) ]
405+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "unit" ) ]
402406#[ doc( alias = "(" ) ]
403407#[ doc( alias = ")" ) ]
404408#[ doc( alias = "()" ) ]
@@ -460,7 +464,8 @@ impl Copy for () {
460464 // empty
461465}
462466
463- #[ doc( primitive = "pointer" ) ]
467+ #[ cfg_attr( bootstrap, doc( primitive = "pointer" ) ) ]
468+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "pointer" ) ]
464469#[ doc( alias = "ptr" ) ]
465470#[ doc( alias = "*" ) ]
466471#[ doc( alias = "*const" ) ]
@@ -577,7 +582,8 @@ impl Copy for () {
577582#[ stable( feature = "rust1" , since = "1.0.0" ) ]
578583mod prim_pointer { }
579584
580- #[ doc( primitive = "array" ) ]
585+ #[ cfg_attr( bootstrap, doc( primitive = "array" ) ) ]
586+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "array" ) ]
581587#[ doc( alias = "[]" ) ]
582588#[ doc( alias = "[T;N]" ) ] // unfortunately, rustdoc doesn't have fuzzy search for aliases
583589#[ doc( alias = "[T; N]" ) ]
@@ -778,7 +784,8 @@ mod prim_pointer {}
778784#[ stable( feature = "rust1" , since = "1.0.0" ) ]
779785mod prim_array { }
780786
781- #[ doc( primitive = "slice" ) ]
787+ #[ cfg_attr( bootstrap, doc( primitive = "slice" ) ) ]
788+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "slice" ) ]
782789#[ doc( alias = "[" ) ]
783790#[ doc( alias = "]" ) ]
784791#[ doc( alias = "[]" ) ]
@@ -870,7 +877,8 @@ mod prim_array {}
870877#[ stable( feature = "rust1" , since = "1.0.0" ) ]
871878mod prim_slice { }
872879
873- #[ doc( primitive = "str" ) ]
880+ #[ cfg_attr( bootstrap, doc( primitive = "str" ) ) ]
881+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "str" ) ]
874882/// String slices.
875883///
876884/// *[See also the `std::str` module](crate::str).*
@@ -937,7 +945,8 @@ mod prim_slice {}
937945#[ stable( feature = "rust1" , since = "1.0.0" ) ]
938946mod prim_str { }
939947
940- #[ doc( primitive = "tuple" ) ]
948+ #[ cfg_attr( bootstrap, doc( primitive = "tuple" ) ) ]
949+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "tuple" ) ]
941950#[ doc( alias = "(" ) ]
942951#[ doc( alias = ")" ) ]
943952#[ doc( alias = "()" ) ]
@@ -1081,7 +1090,8 @@ impl<T: Copy> Copy for (T,) {
10811090 // empty
10821091}
10831092
1084- #[ doc( primitive = "f32" ) ]
1093+ #[ cfg_attr( bootstrap, doc( primitive = "f32" ) ) ]
1094+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "f32" ) ]
10851095/// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008).
10861096///
10871097/// This type can represent a wide range of decimal numbers, like `3.5`, `27`,
@@ -1147,7 +1157,8 @@ impl<T: Copy> Copy for (T,) {
11471157#[ stable( feature = "rust1" , since = "1.0.0" ) ]
11481158mod prim_f32 { }
11491159
1150- #[ doc( primitive = "f64" ) ]
1160+ #[ cfg_attr( bootstrap, doc( primitive = "f64" ) ) ]
1161+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "f64" ) ]
11511162/// A 64-bit floating point type (specifically, the "binary64" type defined in IEEE 754-2008).
11521163///
11531164/// This type is very similar to [`f32`], but has increased
@@ -1162,67 +1173,78 @@ mod prim_f32 {}
11621173#[ stable( feature = "rust1" , since = "1.0.0" ) ]
11631174mod prim_f64 { }
11641175
1165- #[ doc( primitive = "i8" ) ]
1176+ #[ cfg_attr( bootstrap, doc( primitive = "i8" ) ) ]
1177+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "i8" ) ]
11661178//
11671179/// The 8-bit signed integer type.
11681180#[ stable( feature = "rust1" , since = "1.0.0" ) ]
11691181mod prim_i8 { }
11701182
1171- #[ doc( primitive = "i16" ) ]
1183+ #[ cfg_attr( bootstrap, doc( primitive = "i16" ) ) ]
1184+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "i16" ) ]
11721185//
11731186/// The 16-bit signed integer type.
11741187#[ stable( feature = "rust1" , since = "1.0.0" ) ]
11751188mod prim_i16 { }
11761189
1177- #[ doc( primitive = "i32" ) ]
1190+ #[ cfg_attr( bootstrap, doc( primitive = "i32" ) ) ]
1191+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "i32" ) ]
11781192//
11791193/// The 32-bit signed integer type.
11801194#[ stable( feature = "rust1" , since = "1.0.0" ) ]
11811195mod prim_i32 { }
11821196
1183- #[ doc( primitive = "i64" ) ]
1197+ #[ cfg_attr( bootstrap, doc( primitive = "i64" ) ) ]
1198+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "i64" ) ]
11841199//
11851200/// The 64-bit signed integer type.
11861201#[ stable( feature = "rust1" , since = "1.0.0" ) ]
11871202mod prim_i64 { }
11881203
1189- #[ doc( primitive = "i128" ) ]
1204+ #[ cfg_attr( bootstrap, doc( primitive = "i128" ) ) ]
1205+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "i128" ) ]
11901206//
11911207/// The 128-bit signed integer type.
11921208#[ stable( feature = "i128" , since = "1.26.0" ) ]
11931209mod prim_i128 { }
11941210
1195- #[ doc( primitive = "u8" ) ]
1211+ #[ cfg_attr( bootstrap, doc( primitive = "u8" ) ) ]
1212+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "u8" ) ]
11961213//
11971214/// The 8-bit unsigned integer type.
11981215#[ stable( feature = "rust1" , since = "1.0.0" ) ]
11991216mod prim_u8 { }
12001217
1201- #[ doc( primitive = "u16" ) ]
1218+ #[ cfg_attr( bootstrap, doc( primitive = "u16" ) ) ]
1219+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "u16" ) ]
12021220//
12031221/// The 16-bit unsigned integer type.
12041222#[ stable( feature = "rust1" , since = "1.0.0" ) ]
12051223mod prim_u16 { }
12061224
1207- #[ doc( primitive = "u32" ) ]
1225+ #[ cfg_attr( bootstrap, doc( primitive = "u32" ) ) ]
1226+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "u32" ) ]
12081227//
12091228/// The 32-bit unsigned integer type.
12101229#[ stable( feature = "rust1" , since = "1.0.0" ) ]
12111230mod prim_u32 { }
12121231
1213- #[ doc( primitive = "u64" ) ]
1232+ #[ cfg_attr( bootstrap, doc( primitive = "u64" ) ) ]
1233+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "u64" ) ]
12141234//
12151235/// The 64-bit unsigned integer type.
12161236#[ stable( feature = "rust1" , since = "1.0.0" ) ]
12171237mod prim_u64 { }
12181238
1219- #[ doc( primitive = "u128" ) ]
1239+ #[ cfg_attr( bootstrap, doc( primitive = "u128" ) ) ]
1240+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "u128" ) ]
12201241//
12211242/// The 128-bit unsigned integer type.
12221243#[ stable( feature = "i128" , since = "1.26.0" ) ]
12231244mod prim_u128 { }
12241245
1225- #[ doc( primitive = "isize" ) ]
1246+ #[ cfg_attr( bootstrap, doc( primitive = "isize" ) ) ]
1247+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "isize" ) ]
12261248//
12271249/// The pointer-sized signed integer type.
12281250///
@@ -1232,7 +1254,8 @@ mod prim_u128 {}
12321254#[ stable( feature = "rust1" , since = "1.0.0" ) ]
12331255mod prim_isize { }
12341256
1235- #[ doc( primitive = "usize" ) ]
1257+ #[ cfg_attr( bootstrap, doc( primitive = "usize" ) ) ]
1258+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "usize" ) ]
12361259//
12371260/// The pointer-sized unsigned integer type.
12381261///
@@ -1242,7 +1265,8 @@ mod prim_isize {}
12421265#[ stable( feature = "rust1" , since = "1.0.0" ) ]
12431266mod prim_usize { }
12441267
1245- #[ doc( primitive = "reference" ) ]
1268+ #[ cfg_attr( bootstrap, doc( primitive = "reference" ) ) ]
1269+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "reference" ) ]
12461270#[ doc( alias = "&" ) ]
12471271#[ doc( alias = "&mut" ) ]
12481272//
@@ -1373,7 +1397,8 @@ mod prim_usize {}
13731397#[ stable( feature = "rust1" , since = "1.0.0" ) ]
13741398mod prim_ref { }
13751399
1376- #[ doc( primitive = "fn" ) ]
1400+ #[ cfg_attr( bootstrap, doc( primitive = "fn" ) ) ]
1401+ #[ cfg_attr( not( bootstrap) , rustc_doc_primitive = "fn" ) ]
13771402//
13781403/// Function pointers, like `fn(usize) -> bool`.
13791404///
0 commit comments