diff --git a/tests/crashes/125476.rs b/tests/crashes/125476.rs index aa9a081388d..ad739639b72 100644 --- a/tests/crashes/125476.rs +++ b/tests/crashes/125476.rs @@ -1,4 +1,4 @@ //@ known-bug: rust-lang/rust#125476 //@ only-x86_64 -pub struct Data([u8; usize::MAX >> 16]); +pub struct Data([u8; usize::MAX >> 2]); const _: &'static [Data] = &[]; diff --git a/tests/ui/extern/extern-static-size-overflow.rs b/tests/ui/extern/extern-static-size-overflow.rs index a96ce0cf47e..f33e482aa66 100644 --- a/tests/ui/extern/extern-static-size-overflow.rs +++ b/tests/ui/extern/extern-static-size-overflow.rs @@ -4,31 +4,13 @@ struct ReallyBig { } // The limit for "too big for the current architecture" is dependent on the target pointer size -// however it's artificially limited on 64 bits -// logic copied from rustc_target::abi::TargetDataLayout::obj_size_bound() +// but is artificially limited due to LLVM's internal architecture +// logic based on rustc_target::abi::TargetDataLayout::obj_size_bound() const fn max_size() -> usize { - #[cfg(target_pointer_width = "16")] - { - 1 << 15 - } - - #[cfg(target_pointer_width = "32")] - { - 1 << 31 - } - - #[cfg(target_pointer_width = "64")] - { - 1 << 47 - } - - #[cfg(not(any( - target_pointer_width = "16", - target_pointer_width = "32", - target_pointer_width = "64" - )))] - { - isize::MAX as usize + if usize::BITS < 61 { + 1 << (usize::BITS - 1) + } else { + 1 << 61 } } diff --git a/tests/ui/extern/extern-static-size-overflow.stderr b/tests/ui/extern/extern-static-size-overflow.stderr index 1c926399591..5da580e34f4 100644 --- a/tests/ui/extern/extern-static-size-overflow.stderr +++ b/tests/ui/extern/extern-static-size-overflow.stderr @@ -1,17 +1,17 @@ error: extern static is too large for the current architecture - --> $DIR/extern-static-size-overflow.rs:38:5 + --> $DIR/extern-static-size-overflow.rs:20:5 | LL | static BAZ: [u8; max_size()]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: extern static is too large for the current architecture - --> $DIR/extern-static-size-overflow.rs:39:5 + --> $DIR/extern-static-size-overflow.rs:21:5 | LL | static UWU: [usize; usize::MAX]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: extern static is too large for the current architecture - --> $DIR/extern-static-size-overflow.rs:40:5 + --> $DIR/extern-static-size-overflow.rs:22:5 | LL | static A: ReallyBig; | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/limits/huge-enum.rs b/tests/ui/limits/huge-enum.rs index cf6e637388c..031b342afb3 100644 --- a/tests/ui/limits/huge-enum.rs +++ b/tests/ui/limits/huge-enum.rs @@ -6,7 +6,7 @@ type BIG = Option<[u32; (1<<29)-1]>; #[cfg(target_pointer_width = "64")] -type BIG = Option<[u32; (1<<45)-1]>; +type BIG = Option<[u32; (1<<59)-1]>; fn main() { let big: BIG = None;