Fix nightly CI
Currently we're getting lots of errors about duplicate lang items so deal with this by `#[cfg_attr]`'ing off the lang item attribute in tests.
This commit is contained in:
parent
200c94eebf
commit
a6f7dfd2fd
|
@ -79,44 +79,46 @@ trait Subo: AddSub
|
||||||
impl Subo for i128 {}
|
impl Subo for i128 {}
|
||||||
impl Subo for u128 {}
|
impl Subo for u128 {}
|
||||||
|
|
||||||
#[cfg_attr(not(stage0), lang = "i128_add")]
|
u128_lang_items! {
|
||||||
pub fn rust_i128_add(a: i128, b: i128) -> i128 {
|
#[lang = "i128_add"]
|
||||||
|
pub fn rust_i128_add(a: i128, b: i128) -> i128 {
|
||||||
rust_u128_add(a as _, b as _) as _
|
rust_u128_add(a as _, b as _) as _
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(stage0), lang = "i128_addo")]
|
#[lang = "i128_addo"]
|
||||||
pub fn rust_i128_addo(a: i128, b: i128) -> (i128, bool) {
|
pub fn rust_i128_addo(a: i128, b: i128) -> (i128, bool) {
|
||||||
let mut oflow = 0;
|
let mut oflow = 0;
|
||||||
let r = a.addo(b, &mut oflow);
|
let r = a.addo(b, &mut oflow);
|
||||||
(r, oflow != 0)
|
(r, oflow != 0)
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(stage0), lang = "u128_add")]
|
#[lang = "u128_add"]
|
||||||
pub fn rust_u128_add(a: u128, b: u128) -> u128 {
|
pub fn rust_u128_add(a: u128, b: u128) -> u128 {
|
||||||
a.add(b)
|
a.add(b)
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(stage0), lang = "u128_addo")]
|
#[lang = "u128_addo"]
|
||||||
pub fn rust_u128_addo(a: u128, b: u128) -> (u128, bool) {
|
pub fn rust_u128_addo(a: u128, b: u128) -> (u128, bool) {
|
||||||
let mut oflow = 0;
|
let mut oflow = 0;
|
||||||
let r = a.addo(b, &mut oflow);
|
let r = a.addo(b, &mut oflow);
|
||||||
(r, oflow != 0)
|
(r, oflow != 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(stage0), lang = "i128_sub")]
|
#[lang = "i128_sub"]
|
||||||
pub fn rust_i128_sub(a: i128, b: i128) -> i128 {
|
pub fn rust_i128_sub(a: i128, b: i128) -> i128 {
|
||||||
rust_u128_sub(a as _, b as _) as _
|
rust_u128_sub(a as _, b as _) as _
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(stage0), lang = "i128_subo")]
|
#[lang = "i128_subo"]
|
||||||
pub fn rust_i128_subo(a: i128, b: i128) -> (i128, bool) {
|
pub fn rust_i128_subo(a: i128, b: i128) -> (i128, bool) {
|
||||||
let mut oflow = 0;
|
let mut oflow = 0;
|
||||||
let r = a.subo(b, &mut oflow);
|
let r = a.subo(b, &mut oflow);
|
||||||
(r, oflow != 0)
|
(r, oflow != 0)
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(stage0), lang = "u128_sub")]
|
#[lang = "u128_sub"]
|
||||||
pub fn rust_u128_sub(a: u128, b: u128) -> u128 {
|
pub fn rust_u128_sub(a: u128, b: u128) -> u128 {
|
||||||
a.sub(b)
|
a.sub(b)
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(stage0), lang = "u128_subo")]
|
#[lang = "u128_subo"]
|
||||||
pub fn rust_u128_subo(a: u128, b: u128) -> (u128, bool) {
|
pub fn rust_u128_subo(a: u128, b: u128) -> (u128, bool) {
|
||||||
let mut oflow = 0;
|
let mut oflow = 0;
|
||||||
let r = a.subo(b, &mut oflow);
|
let r = a.subo(b, &mut oflow);
|
||||||
(r, oflow != 0)
|
(r, oflow != 0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,23 +108,25 @@ intrinsics! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(stage0), lang = "i128_mul")]
|
u128_lang_items! {
|
||||||
pub fn rust_i128_mul(a: i128, b: i128) -> i128 {
|
#[lang = "i128_mul"]
|
||||||
|
pub fn rust_i128_mul(a: i128, b: i128) -> i128 {
|
||||||
__multi3(a, b)
|
__multi3(a, b)
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(stage0), lang = "i128_mulo")]
|
#[lang = "i128_mulo"]
|
||||||
pub fn rust_i128_mulo(a: i128, b: i128) -> (i128, bool) {
|
pub fn rust_i128_mulo(a: i128, b: i128) -> (i128, bool) {
|
||||||
let mut oflow = 0;
|
let mut oflow = 0;
|
||||||
let r = __muloti4(a, b, &mut oflow);
|
let r = __muloti4(a, b, &mut oflow);
|
||||||
(r, oflow != 0)
|
(r, oflow != 0)
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(stage0), lang = "u128_mul")]
|
#[lang = "u128_mul"]
|
||||||
pub fn rust_u128_mul(a: u128, b: u128) -> u128 {
|
pub fn rust_u128_mul(a: u128, b: u128) -> u128 {
|
||||||
__multi3(a as _, b as _) as _
|
__multi3(a as _, b as _) as _
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(stage0), lang = "u128_mulo")]
|
#[lang = "u128_mulo"]
|
||||||
pub fn rust_u128_mulo(a: u128, b: u128) -> (u128, bool) {
|
pub fn rust_u128_mulo(a: u128, b: u128) -> (u128, bool) {
|
||||||
let mut oflow = 0;
|
let mut oflow = 0;
|
||||||
let r = a.mulo(b, &mut oflow);
|
let r = a.mulo(b, &mut oflow);
|
||||||
(r, oflow != 0)
|
(r, oflow != 0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,11 +98,13 @@ intrinsics! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(stage0), lang = "i128_div")]
|
u128_lang_items! {
|
||||||
pub fn rust_i128_div(a: i128, b: i128) -> i128 {
|
#[lang = "i128_div"]
|
||||||
|
pub fn rust_i128_div(a: i128, b: i128) -> i128 {
|
||||||
__divti3(a, b)
|
__divti3(a, b)
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(stage0), lang = "i128_rem")]
|
#[lang = "i128_rem"]
|
||||||
pub fn rust_i128_rem(a: i128, b: i128) -> i128 {
|
pub fn rust_i128_rem(a: i128, b: i128) -> i128 {
|
||||||
__modti3(a, b)
|
__modti3(a, b)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,36 +96,38 @@ intrinsics! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(stage0), lang = "i128_shl")]
|
u128_lang_items! {
|
||||||
pub fn rust_i128_shl(a: i128, b: u32) -> i128 {
|
#[lang = "i128_shl"]
|
||||||
|
pub fn rust_i128_shl(a: i128, b: u32) -> i128 {
|
||||||
__ashlti3(a as _, b) as _
|
__ashlti3(a as _, b) as _
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(stage0), lang = "i128_shlo")]
|
#[lang = "i128_shlo"]
|
||||||
pub fn rust_i128_shlo(a: i128, b: u128) -> (i128, bool) {
|
pub fn rust_i128_shlo(a: i128, b: u128) -> (i128, bool) {
|
||||||
(rust_i128_shl(a, b as _), b >= 128)
|
(rust_i128_shl(a, b as _), b >= 128)
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(stage0), lang = "u128_shl")]
|
#[lang = "u128_shl"]
|
||||||
pub fn rust_u128_shl(a: u128, b: u32) -> u128 {
|
pub fn rust_u128_shl(a: u128, b: u32) -> u128 {
|
||||||
__ashlti3(a, b)
|
__ashlti3(a, b)
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(stage0), lang = "u128_shlo")]
|
#[lang = "u128_shlo"]
|
||||||
pub fn rust_u128_shlo(a: u128, b: u128) -> (u128, bool) {
|
pub fn rust_u128_shlo(a: u128, b: u128) -> (u128, bool) {
|
||||||
(rust_u128_shl(a, b as _), b >= 128)
|
(rust_u128_shl(a, b as _), b >= 128)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(stage0), lang = "i128_shr")]
|
#[lang = "i128_shr"]
|
||||||
pub fn rust_i128_shr(a: i128, b: u32) -> i128 {
|
pub fn rust_i128_shr(a: i128, b: u32) -> i128 {
|
||||||
__ashrti3(a, b)
|
__ashrti3(a, b)
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(stage0), lang = "i128_shro")]
|
#[lang = "i128_shro"]
|
||||||
pub fn rust_i128_shro(a: i128, b: u128) -> (i128, bool) {
|
pub fn rust_i128_shro(a: i128, b: u128) -> (i128, bool) {
|
||||||
(rust_i128_shr(a, b as _), b >= 128)
|
(rust_i128_shr(a, b as _), b >= 128)
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(stage0), lang = "u128_shr")]
|
#[lang = "u128_shr"]
|
||||||
pub fn rust_u128_shr(a: u128, b: u32) -> u128 {
|
pub fn rust_u128_shr(a: u128, b: u32) -> u128 {
|
||||||
__lshrti3(a, b)
|
__lshrti3(a, b)
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(stage0), lang = "u128_shro")]
|
#[lang = "u128_shro"]
|
||||||
pub fn rust_u128_shro(a: u128, b: u128) -> (u128, bool) {
|
pub fn rust_u128_shro(a: u128, b: u128) -> (u128, bool) {
|
||||||
(rust_u128_shr(a, b as _), b >= 128)
|
(rust_u128_shr(a, b as _), b >= 128)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,11 +270,13 @@ intrinsics! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(stage0), lang = "u128_div")]
|
u128_lang_items! {
|
||||||
pub fn rust_u128_div(a: u128, b: u128) -> u128 {
|
#[lang = "u128_div"]
|
||||||
|
pub fn rust_u128_div(a: u128, b: u128) -> u128 {
|
||||||
__udivti3(a, b)
|
__udivti3(a, b)
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(stage0), lang = "u128_rem")]
|
#[lang = "u128_rem"]
|
||||||
pub fn rust_u128_rem(a: u128, b: u128) -> u128 {
|
pub fn rust_u128_rem(a: u128, b: u128) -> u128 {
|
||||||
__umodti3(a, b)
|
__umodti3(a, b)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,3 +280,17 @@ pub mod win64_128bit_abi_hack {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macro_rules! u128_lang_items {
|
||||||
|
($(
|
||||||
|
#[lang = $lang:tt]
|
||||||
|
pub fn $name:ident( $($argname:ident: $ty:ty),* ) -> $ret:ty {
|
||||||
|
$($body:tt)*
|
||||||
|
}
|
||||||
|
)*) => ($(
|
||||||
|
#[cfg_attr(not(any(stage0, feature = "gen-tests")), lang = $lang)]
|
||||||
|
pub fn $name( $($argname: $ty),* ) -> $ret {
|
||||||
|
$($body)*
|
||||||
|
}
|
||||||
|
)*)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue