Skip to content

Commit 892ef6f

Browse files
committed
rustbuild: work around the stdarch cfg(bootstrap) bug.
1 parent 0f1da63 commit 892ef6f

File tree

3 files changed

+25
-20
lines changed

3 files changed

+25
-20
lines changed

src/bootstrap/bin/rustc.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,13 @@ fn main() {
102102
// FIXME: the fact that core here is excluded is due to core_arch from our stdarch submodule
103103
// being broken on the beta compiler with bootstrap passed, so this is a temporary workaround
104104
// (we've just snapped, so there are no cfg(bootstrap) related annotations in core).
105-
if stage == "0" && crate_name != Some("core") {
106-
cmd.arg("--cfg").arg("bootstrap");
105+
if stage == "0" {
106+
if crate_name != Some("core") {
107+
cmd.arg("--cfg").arg("bootstrap");
108+
} else {
109+
// NOTE(eddyb) see FIXME above, except now we need annotations again in core.
110+
cmd.arg("--cfg").arg("boostrap_stdarch_ignore_this");
111+
}
107112
}
108113

109114
// Print backtrace in case of ICE

src/libcore/intrinsics.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1293,38 +1293,38 @@ extern "rust-intrinsic" {
12931293
/// The stabilized versions of this intrinsic are available on the integer
12941294
/// primitives via the `wrapping_add` method. For example,
12951295
/// [`std::u32::wrapping_add`](../../std/primitive.u32.html#method.wrapping_add)
1296-
#[cfg(bootstrap)]
1296+
#[cfg(boostrap_stdarch_ignore_this)]
12971297
pub fn overflowing_add<T>(a: T, b: T) -> T;
12981298
/// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
12991299
/// The stabilized versions of this intrinsic are available on the integer
13001300
/// primitives via the `wrapping_sub` method. For example,
13011301
/// [`std::u32::wrapping_sub`](../../std/primitive.u32.html#method.wrapping_sub)
1302-
#[cfg(bootstrap)]
1302+
#[cfg(boostrap_stdarch_ignore_this)]
13031303
pub fn overflowing_sub<T>(a: T, b: T) -> T;
13041304
/// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
13051305
/// The stabilized versions of this intrinsic are available on the integer
13061306
/// primitives via the `wrapping_mul` method. For example,
13071307
/// [`std::u32::wrapping_mul`](../../std/primitive.u32.html#method.wrapping_mul)
1308-
#[cfg(bootstrap)]
1308+
#[cfg(boostrap_stdarch_ignore_this)]
13091309
pub fn overflowing_mul<T>(a: T, b: T) -> T;
13101310

13111311
/// Returns (a + b) mod 2<sup>N</sup>, where N is the width of T in bits.
13121312
/// The stabilized versions of this intrinsic are available on the integer
13131313
/// primitives via the `wrapping_add` method. For example,
13141314
/// [`std::u32::wrapping_add`](../../std/primitive.u32.html#method.wrapping_add)
1315-
#[cfg(not(bootstrap))]
1315+
#[cfg(not(boostrap_stdarch_ignore_this))]
13161316
pub fn wrapping_add<T>(a: T, b: T) -> T;
13171317
/// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
13181318
/// The stabilized versions of this intrinsic are available on the integer
13191319
/// primitives via the `wrapping_sub` method. For example,
13201320
/// [`std::u32::wrapping_sub`](../../std/primitive.u32.html#method.wrapping_sub)
1321-
#[cfg(not(bootstrap))]
1321+
#[cfg(not(boostrap_stdarch_ignore_this))]
13221322
pub fn wrapping_sub<T>(a: T, b: T) -> T;
13231323
/// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
13241324
/// The stabilized versions of this intrinsic are available on the integer
13251325
/// primitives via the `wrapping_mul` method. For example,
13261326
/// [`std::u32::wrapping_mul`](../../std/primitive.u32.html#method.wrapping_mul)
1327-
#[cfg(not(bootstrap))]
1327+
#[cfg(not(boostrap_stdarch_ignore_this))]
13281328
pub fn wrapping_mul<T>(a: T, b: T) -> T;
13291329

13301330
/// Computes `a + b`, while saturating at numeric bounds.

src/libcore/num/mod.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -1112,11 +1112,11 @@ $EndFeature, "
11121112
without modifying the original"]
11131113
#[inline]
11141114
pub const fn wrapping_add(self, rhs: Self) -> Self {
1115-
#[cfg(bootstrap)] {
1115+
#[cfg(boostrap_stdarch_ignore_this)] {
11161116
intrinsics::overflowing_add(self, rhs)
11171117
}
11181118

1119-
#[cfg(not(bootstrap))] {
1119+
#[cfg(not(boostrap_stdarch_ignore_this))] {
11201120
intrinsics::wrapping_add(self, rhs)
11211121
}
11221122
}
@@ -1141,11 +1141,11 @@ $EndFeature, "
11411141
without modifying the original"]
11421142
#[inline]
11431143
pub const fn wrapping_sub(self, rhs: Self) -> Self {
1144-
#[cfg(bootstrap)] {
1144+
#[cfg(boostrap_stdarch_ignore_this)] {
11451145
intrinsics::overflowing_sub(self, rhs)
11461146
}
11471147

1148-
#[cfg(not(bootstrap))] {
1148+
#[cfg(not(boostrap_stdarch_ignore_this))] {
11491149
intrinsics::wrapping_sub(self, rhs)
11501150
}
11511151
}
@@ -1169,11 +1169,11 @@ $EndFeature, "
11691169
without modifying the original"]
11701170
#[inline]
11711171
pub const fn wrapping_mul(self, rhs: Self) -> Self {
1172-
#[cfg(bootstrap)] {
1172+
#[cfg(boostrap_stdarch_ignore_this)] {
11731173
intrinsics::overflowing_mul(self, rhs)
11741174
}
11751175

1176-
#[cfg(not(bootstrap))] {
1176+
#[cfg(not(boostrap_stdarch_ignore_this))] {
11771177
intrinsics::wrapping_mul(self, rhs)
11781178
}
11791179
}
@@ -3049,11 +3049,11 @@ $EndFeature, "
30493049
without modifying the original"]
30503050
#[inline]
30513051
pub const fn wrapping_add(self, rhs: Self) -> Self {
3052-
#[cfg(bootstrap)] {
3052+
#[cfg(boostrap_stdarch_ignore_this)] {
30533053
intrinsics::overflowing_add(self, rhs)
30543054
}
30553055

3056-
#[cfg(not(bootstrap))] {
3056+
#[cfg(not(boostrap_stdarch_ignore_this))] {
30573057
intrinsics::wrapping_add(self, rhs)
30583058
}
30593059
}
@@ -3077,11 +3077,11 @@ $EndFeature, "
30773077
without modifying the original"]
30783078
#[inline]
30793079
pub const fn wrapping_sub(self, rhs: Self) -> Self {
3080-
#[cfg(bootstrap)] {
3080+
#[cfg(boostrap_stdarch_ignore_this)] {
30813081
intrinsics::overflowing_sub(self, rhs)
30823082
}
30833083

3084-
#[cfg(not(bootstrap))] {
3084+
#[cfg(not(boostrap_stdarch_ignore_this))] {
30853085
intrinsics::wrapping_sub(self, rhs)
30863086
}
30873087
}
@@ -3106,11 +3106,11 @@ $EndFeature, "
31063106
without modifying the original"]
31073107
#[inline]
31083108
pub const fn wrapping_mul(self, rhs: Self) -> Self {
3109-
#[cfg(bootstrap)] {
3109+
#[cfg(boostrap_stdarch_ignore_this)] {
31103110
intrinsics::overflowing_mul(self, rhs)
31113111
}
31123112

3113-
#[cfg(not(bootstrap))] {
3113+
#[cfg(not(boostrap_stdarch_ignore_this))] {
31143114
intrinsics::wrapping_mul(self, rhs)
31153115
}
31163116
}

0 commit comments

Comments
 (0)