Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit f4cb6ef

Browse files
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.
1 parent d6383b4 commit f4cb6ef

File tree

4 files changed

+11
-29
lines changed

4 files changed

+11
-29
lines changed

tests/crashes/125476.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
//@ known-bug: rust-lang/rust#125476
22
//@ only-x86_64
3-
pub struct Data([u8; usize::MAX >> 16]);
3+
pub struct Data([u8; usize::MAX >> 2]);
44
const _: &'static [Data] = &[];

tests/ui/extern/extern-static-size-overflow.rs

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,13 @@ struct ReallyBig {
44
}
55

66
// The limit for "too big for the current architecture" is dependent on the target pointer size
7-
// however it's artificially limited on 64 bits
8-
// logic copied from rustc_target::abi::TargetDataLayout::obj_size_bound()
7+
// but is artificially limited due to LLVM's internal architecture
8+
// logic based on rustc_target::abi::TargetDataLayout::obj_size_bound()
99
const fn max_size() -> usize {
10-
#[cfg(target_pointer_width = "16")]
11-
{
12-
1 << 15
13-
}
14-
15-
#[cfg(target_pointer_width = "32")]
16-
{
17-
1 << 31
18-
}
19-
20-
#[cfg(target_pointer_width = "64")]
21-
{
22-
1 << 47
23-
}
24-
25-
#[cfg(not(any(
26-
target_pointer_width = "16",
27-
target_pointer_width = "32",
28-
target_pointer_width = "64"
29-
)))]
30-
{
31-
isize::MAX as usize
10+
if usize::BITS < 61 {
11+
1 << (usize::BITS - 1)
12+
} else {
13+
1 << 61
3214
}
3315
}
3416

tests/ui/extern/extern-static-size-overflow.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error: extern static is too large for the current architecture
2-
--> $DIR/extern-static-size-overflow.rs:38:5
2+
--> $DIR/extern-static-size-overflow.rs:20:5
33
|
44
LL | static BAZ: [u8; max_size()];
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

77
error: extern static is too large for the current architecture
8-
--> $DIR/extern-static-size-overflow.rs:39:5
8+
--> $DIR/extern-static-size-overflow.rs:21:5
99
|
1010
LL | static UWU: [usize; usize::MAX];
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error: extern static is too large for the current architecture
14-
--> $DIR/extern-static-size-overflow.rs:40:5
14+
--> $DIR/extern-static-size-overflow.rs:22:5
1515
|
1616
LL | static A: ReallyBig;
1717
| ^^^^^^^^^^^^^^^^^^^

tests/ui/limits/huge-enum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
type BIG = Option<[u32; (1<<29)-1]>;
77

88
#[cfg(target_pointer_width = "64")]
9-
type BIG = Option<[u32; (1<<45)-1]>;
9+
type BIG = Option<[u32; (1<<59)-1]>;
1010

1111
fn main() {
1212
let big: BIG = None;

0 commit comments

Comments
 (0)