This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +11
-29
lines changed Expand file tree Collapse file tree 4 files changed +11
-29
lines changed Original file line number Diff line number Diff line change 1
1
//@ known-bug: rust-lang/rust#125476
2
2
//@ only-x86_64
3
- pub struct Data ( [ u8 ; usize:: MAX >> 16 ] ) ;
3
+ pub struct Data ( [ u8 ; usize:: MAX >> 2 ] ) ;
4
4
const _: & ' static [ Data ] = & [ ] ;
Original file line number Diff line number Diff line change @@ -4,31 +4,13 @@ struct ReallyBig {
4
4
}
5
5
6
6
// 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()
9
9
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
32
14
}
33
15
}
34
16
Original file line number Diff line number Diff line change 1
1
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
3
3
|
4
4
LL | static BAZ: [u8; max_size()];
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6
6
7
7
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
9
9
|
10
10
LL | static UWU: [usize; usize::MAX];
11
11
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12
12
13
13
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
15
15
|
16
16
LL | static A: ReallyBig;
17
17
| ^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change 6
6
type BIG = Option < [ u32 ; ( 1 <<29 ) -1 ] > ;
7
7
8
8
#[ cfg( target_pointer_width = "64" ) ]
9
- type BIG = Option < [ u32 ; ( 1 <<45 ) -1 ] > ;
9
+ type BIG = Option < [ u32 ; ( 1 <<59 ) -1 ] > ;
10
10
11
11
fn main ( ) {
12
12
let big: BIG = None ;
You can’t perform that action at this time.
0 commit comments