Skip to content

Commit

Permalink
rustbuild: work around the stdarch cfg(bootstrap) bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Aug 16, 2019
1 parent 0f1da63 commit 892ef6f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
9 changes: 7 additions & 2 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,13 @@ fn main() {
// FIXME: the fact that core here is excluded is due to core_arch from our stdarch submodule
// being broken on the beta compiler with bootstrap passed, so this is a temporary workaround
// (we've just snapped, so there are no cfg(bootstrap) related annotations in core).
if stage == "0" && crate_name != Some("core") {
cmd.arg("--cfg").arg("bootstrap");
if stage == "0" {
if crate_name != Some("core") {
cmd.arg("--cfg").arg("bootstrap");
} else {
// NOTE(eddyb) see FIXME above, except now we need annotations again in core.
cmd.arg("--cfg").arg("boostrap_stdarch_ignore_this");
}
}

// Print backtrace in case of ICE
Expand Down
12 changes: 6 additions & 6 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1293,38 +1293,38 @@ extern "rust-intrinsic" {
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `wrapping_add` method. For example,
/// [`std::u32::wrapping_add`](../../std/primitive.u32.html#method.wrapping_add)
#[cfg(bootstrap)]
#[cfg(boostrap_stdarch_ignore_this)]
pub fn overflowing_add<T>(a: T, b: T) -> T;
/// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `wrapping_sub` method. For example,
/// [`std::u32::wrapping_sub`](../../std/primitive.u32.html#method.wrapping_sub)
#[cfg(bootstrap)]
#[cfg(boostrap_stdarch_ignore_this)]
pub fn overflowing_sub<T>(a: T, b: T) -> T;
/// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `wrapping_mul` method. For example,
/// [`std::u32::wrapping_mul`](../../std/primitive.u32.html#method.wrapping_mul)
#[cfg(bootstrap)]
#[cfg(boostrap_stdarch_ignore_this)]
pub fn overflowing_mul<T>(a: T, b: T) -> T;

/// Returns (a + b) mod 2<sup>N</sup>, where N is the width of T in bits.
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `wrapping_add` method. For example,
/// [`std::u32::wrapping_add`](../../std/primitive.u32.html#method.wrapping_add)
#[cfg(not(bootstrap))]
#[cfg(not(boostrap_stdarch_ignore_this))]
pub fn wrapping_add<T>(a: T, b: T) -> T;
/// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `wrapping_sub` method. For example,
/// [`std::u32::wrapping_sub`](../../std/primitive.u32.html#method.wrapping_sub)
#[cfg(not(bootstrap))]
#[cfg(not(boostrap_stdarch_ignore_this))]
pub fn wrapping_sub<T>(a: T, b: T) -> T;
/// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `wrapping_mul` method. For example,
/// [`std::u32::wrapping_mul`](../../std/primitive.u32.html#method.wrapping_mul)
#[cfg(not(bootstrap))]
#[cfg(not(boostrap_stdarch_ignore_this))]
pub fn wrapping_mul<T>(a: T, b: T) -> T;

/// Computes `a + b`, while saturating at numeric bounds.
Expand Down
24 changes: 12 additions & 12 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1112,11 +1112,11 @@ $EndFeature, "
without modifying the original"]
#[inline]
pub const fn wrapping_add(self, rhs: Self) -> Self {
#[cfg(bootstrap)] {
#[cfg(boostrap_stdarch_ignore_this)] {
intrinsics::overflowing_add(self, rhs)
}

#[cfg(not(bootstrap))] {
#[cfg(not(boostrap_stdarch_ignore_this))] {
intrinsics::wrapping_add(self, rhs)
}
}
Expand All @@ -1141,11 +1141,11 @@ $EndFeature, "
without modifying the original"]
#[inline]
pub const fn wrapping_sub(self, rhs: Self) -> Self {
#[cfg(bootstrap)] {
#[cfg(boostrap_stdarch_ignore_this)] {
intrinsics::overflowing_sub(self, rhs)
}

#[cfg(not(bootstrap))] {
#[cfg(not(boostrap_stdarch_ignore_this))] {
intrinsics::wrapping_sub(self, rhs)
}
}
Expand All @@ -1169,11 +1169,11 @@ $EndFeature, "
without modifying the original"]
#[inline]
pub const fn wrapping_mul(self, rhs: Self) -> Self {
#[cfg(bootstrap)] {
#[cfg(boostrap_stdarch_ignore_this)] {
intrinsics::overflowing_mul(self, rhs)
}

#[cfg(not(bootstrap))] {
#[cfg(not(boostrap_stdarch_ignore_this))] {
intrinsics::wrapping_mul(self, rhs)
}
}
Expand Down Expand Up @@ -3049,11 +3049,11 @@ $EndFeature, "
without modifying the original"]
#[inline]
pub const fn wrapping_add(self, rhs: Self) -> Self {
#[cfg(bootstrap)] {
#[cfg(boostrap_stdarch_ignore_this)] {
intrinsics::overflowing_add(self, rhs)
}

#[cfg(not(bootstrap))] {
#[cfg(not(boostrap_stdarch_ignore_this))] {
intrinsics::wrapping_add(self, rhs)
}
}
Expand All @@ -3077,11 +3077,11 @@ $EndFeature, "
without modifying the original"]
#[inline]
pub const fn wrapping_sub(self, rhs: Self) -> Self {
#[cfg(bootstrap)] {
#[cfg(boostrap_stdarch_ignore_this)] {
intrinsics::overflowing_sub(self, rhs)
}

#[cfg(not(bootstrap))] {
#[cfg(not(boostrap_stdarch_ignore_this))] {
intrinsics::wrapping_sub(self, rhs)
}
}
Expand All @@ -3106,11 +3106,11 @@ $EndFeature, "
without modifying the original"]
#[inline]
pub const fn wrapping_mul(self, rhs: Self) -> Self {
#[cfg(bootstrap)] {
#[cfg(boostrap_stdarch_ignore_this)] {
intrinsics::overflowing_mul(self, rhs)
}

#[cfg(not(bootstrap))] {
#[cfg(not(boostrap_stdarch_ignore_this))] {
intrinsics::wrapping_mul(self, rhs)
}
}
Expand Down

0 comments on commit 892ef6f

Please sign in to comment.