Keep object-size-dependent tests failing

These tests depend on the internal logic of rustc regarding handling
very large objects. Fix them to reflect rustc_abi::obj_size_bound diffs.
This commit is contained in:
Jubilee Young 2024-07-09 19:25:28 -07:00
parent d6383b4605
commit f4cb6ef8d8
4 changed files with 11 additions and 29 deletions

View file

@ -1,4 +1,4 @@
//@ known-bug: rust-lang/rust#125476 //@ known-bug: rust-lang/rust#125476
//@ only-x86_64 //@ only-x86_64
pub struct Data([u8; usize::MAX >> 16]); pub struct Data([u8; usize::MAX >> 2]);
const _: &'static [Data] = &[]; const _: &'static [Data] = &[];

View file

@ -4,31 +4,13 @@ struct ReallyBig {
} }
// The limit for "too big for the current architecture" is dependent on the target pointer size // The limit for "too big for the current architecture" is dependent on the target pointer size
// however it's artificially limited on 64 bits // but is artificially limited due to LLVM's internal architecture
// logic copied from rustc_target::abi::TargetDataLayout::obj_size_bound() // logic based on rustc_target::abi::TargetDataLayout::obj_size_bound()
const fn max_size() -> usize { const fn max_size() -> usize {
#[cfg(target_pointer_width = "16")] if usize::BITS < 61 {
{ 1 << (usize::BITS - 1)
1 << 15 } else {
} 1 << 61
#[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
} }
} }

View file

@ -1,17 +1,17 @@
error: extern static is too large for the current architecture 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()]; LL | static BAZ: [u8; max_size()];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: extern static is too large for the current architecture 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]; LL | static UWU: [usize; usize::MAX];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: extern static is too large for the current architecture 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; LL | static A: ReallyBig;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^

View file

@ -6,7 +6,7 @@
type BIG = Option<[u32; (1<<29)-1]>; type BIG = Option<[u32; (1<<29)-1]>;
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
type BIG = Option<[u32; (1<<45)-1]>; type BIG = Option<[u32; (1<<59)-1]>;
fn main() { fn main() {
let big: BIG = None; let big: BIG = None;