From 42dbf29b48d3db2b56e9064480ad06888fe678f6 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Tue, 9 Jul 2024 18:09:56 -0700 Subject: [PATCH 1/8] Correct outdated object size limit The comment here about 48 bit addresses being enough was written in 2016 but was made incorrect in 2019 by 5-level paging, and then persisted for another 5 years before being noticed and corrected. --- compiler/rustc_abi/src/lib.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 5668d8992c8dc..5e0adc4522952 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -337,23 +337,21 @@ impl TargetDataLayout { Ok(dl) } - /// Returns exclusive upper bound on object size. + /// Returns **exclusive** upper bound on object size. /// /// The theoretical maximum object size is defined as the maximum positive `isize` value. /// This ensures that the `offset` semantics remain well-defined by allowing it to correctly /// index every address within an object along with one byte past the end, along with allowing /// `isize` to store the difference between any two pointers into an object. /// - /// The upper bound on 64-bit currently needs to be lower because LLVM uses a 64-bit integer - /// to represent object size in bits. It would need to be 1 << 61 to account for this, but is - /// currently conservatively bounded to 1 << 47 as that is enough to cover the current usable - /// address space on 64-bit ARMv8 and x86_64. + /// LLVM uses a 64-bit integer to represent object size in bits, but we care only for bytes, + /// so we adopt such a more-constrained address space due to its technical limitations. #[inline] pub fn obj_size_bound(&self) -> u64 { match self.pointer_size.bits() { 16 => 1 << 15, 32 => 1 << 31, - 64 => 1 << 47, + 64 => 1 << 61, bits => panic!("obj_size_bound: unknown pointer bit size {bits}"), } } From d6383b4605856394ef839b82c9dec5c4d0b67e3c Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Tue, 9 Jul 2024 19:08:30 -0700 Subject: [PATCH 2/8] bless issue-56762.rs as huge-static.rs --- src/tools/tidy/src/issues.txt | 1 - tests/ui/limits/{issue-56762.rs => huge-static.rs} | 7 +++++-- .../ui/limits/{issue-56762.stderr => huge-static.stderr} | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) rename tests/ui/limits/{issue-56762.rs => huge-static.rs} (65%) rename tests/ui/limits/{issue-56762.stderr => huge-static.stderr} (72%) diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index 8197a1bd85985..e568f11db59ad 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -2718,7 +2718,6 @@ ui/limits/issue-15919-32.rs ui/limits/issue-15919-64.rs ui/limits/issue-17913.rs ui/limits/issue-55878.rs -ui/limits/issue-56762.rs ui/limits/issue-69485-var-size-diffs-too-large.rs ui/limits/issue-75158-64.rs ui/linkage-attr/auxiliary/issue-12133-dylib.rs diff --git a/tests/ui/limits/issue-56762.rs b/tests/ui/limits/huge-static.rs similarity index 65% rename from tests/ui/limits/issue-56762.rs rename to tests/ui/limits/huge-static.rs index 17b3ad8b01e2d..4709b46e59d15 100644 --- a/tests/ui/limits/issue-56762.rs +++ b/tests/ui/limits/huge-static.rs @@ -1,6 +1,9 @@ -//@ only-x86_64 +//@ only-64bit -const HUGE_SIZE: usize = !0usize / 8; +// This test validates we gracefully fail computing a const or static of absurdly large size. +// The oddly-specific number is because of LLVM measuring object sizes in bits. + +const HUGE_SIZE: usize = 1 << 61; pub struct TooBigArray { diff --git a/tests/ui/limits/issue-56762.stderr b/tests/ui/limits/huge-static.stderr similarity index 72% rename from tests/ui/limits/issue-56762.stderr rename to tests/ui/limits/huge-static.stderr index 3a6c3559ac195..19ac65429af57 100644 --- a/tests/ui/limits/issue-56762.stderr +++ b/tests/ui/limits/huge-static.stderr @@ -1,14 +1,14 @@ error[E0080]: could not evaluate static initializer - --> $DIR/issue-56762.rs:16:1 + --> $DIR/huge-static.rs:19:1 | LL | static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; 2305843009213693951]` are too big for the current architecture + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; 2305843009213693952]` are too big for the current architecture error[E0080]: could not evaluate static initializer - --> $DIR/issue-56762.rs:19:1 + --> $DIR/huge-static.rs:22:1 | LL | static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; 2305843009213693951]` are too big for the current architecture + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; 2305843009213693952]` are too big for the current architecture error: aborting due to 2 previous errors From f4cb6ef8d86cdf62f8f0c8f0b62395ae2616da26 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Tue, 9 Jul 2024 19:25:28 -0700 Subject: [PATCH 3/8] 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. --- tests/crashes/125476.rs | 2 +- .../ui/extern/extern-static-size-overflow.rs | 30 ++++--------------- .../extern/extern-static-size-overflow.stderr | 6 ++-- tests/ui/limits/huge-enum.rs | 2 +- 4 files changed, 11 insertions(+), 29 deletions(-) diff --git a/tests/crashes/125476.rs b/tests/crashes/125476.rs index aa9a081388d91..ad739639b7221 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 a96ce0cf47e08..f33e482aa6653 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 1c926399591c2..5da580e34f428 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 cf6e637388c7f..031b342afb3ae 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; From 65f132fd25a15f678ebb9a6fcd7bee540e88f314 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Tue, 9 Jul 2024 19:34:30 -0700 Subject: [PATCH 4/8] Bless rustc_abi::obj_size_bound tests --- tests/ui/const-generics/issue-112505-overflow.stderr | 4 ++-- tests/ui/const-generics/transmute-fail.stderr | 4 ++-- tests/ui/limits/huge-struct.stderr | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/ui/const-generics/issue-112505-overflow.stderr b/tests/ui/const-generics/issue-112505-overflow.stderr index 0bd3f6eddd459..d370c3dfa6a50 100644 --- a/tests/ui/const-generics/issue-112505-overflow.stderr +++ b/tests/ui/const-generics/issue-112505-overflow.stderr @@ -4,8 +4,8 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- LL | unsafe { std::mem::transmute(v) } | ^^^^^^^^^^^^^^^^^^^ | - = note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type `[[u32; 8888888]; 9999999]` are too big for the current architecture) - = note: target type: `[[[u32; 9999999]; 777777777]; 239]` (values of the type `[[u32; 9999999]; 777777777]` are too big for the current architecture) + = note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type `[[[u32; 8888888]; 9999999]; 777777777]` are too big for the current architecture) + = note: target type: `[[[u32; 9999999]; 777777777]; 239]` (values of the type `[[[u32; 9999999]; 777777777]; 239]` are too big for the current architecture) error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/transmute-fail.stderr b/tests/ui/const-generics/transmute-fail.stderr index 4a20034910d10..b47c7d5098f54 100644 --- a/tests/ui/const-generics/transmute-fail.stderr +++ b/tests/ui/const-generics/transmute-fail.stderr @@ -34,8 +34,8 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- LL | std::mem::transmute(v) | ^^^^^^^^^^^^^^^^^^^ | - = note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type `[[u32; 8888888]; 9999999]` are too big for the current architecture) - = note: target type: `[[[u32; 9999999]; 777777777]; 8888888]` (values of the type `[[u32; 9999999]; 777777777]` are too big for the current architecture) + = note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type `[[[u32; 8888888]; 9999999]; 777777777]` are too big for the current architecture) + = note: target type: `[[[u32; 9999999]; 777777777]; 8888888]` (values of the type `[[[u32; 9999999]; 777777777]; 8888888]` are too big for the current architecture) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/transmute-fail.rs:36:9 diff --git a/tests/ui/limits/huge-struct.stderr b/tests/ui/limits/huge-struct.stderr index 782db20c7f345..6d18f1011e8af 100644 --- a/tests/ui/limits/huge-struct.stderr +++ b/tests/ui/limits/huge-struct.stderr @@ -1,4 +1,4 @@ -error: values of the type `SXX>>` are too big for the current architecture +error: values of the type `SXX>>>>` are too big for the current architecture --> $DIR/huge-struct.rs:46:9 | LL | let fat: Option>>> = None; From 28628f37435e8899d5d0730fc1fb5aa7345a5e31 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Thu, 19 Sep 2024 16:44:36 -0700 Subject: [PATCH 5/8] Normalize being an annoying little compile test The issue-112505-overflow test just extended a case of transmute-fail.rs so simply put them in the same file. Then we normalize away other cases of this. --- src/tools/tidy/src/issues.txt | 1 - .../const-generics/issue-112505-overflow.rs | 7 --- .../issue-112505-overflow.stderr | 12 ------ tests/ui/const-generics/transmute-fail.rs | 10 +++++ tests/ui/const-generics/transmute-fail.stderr | 43 +++++++++++-------- tests/ui/limits/huge-struct.rs | 4 +- tests/ui/limits/huge-struct.stderr | 4 +- 7 files changed, 41 insertions(+), 40 deletions(-) delete mode 100644 tests/ui/const-generics/issue-112505-overflow.rs delete mode 100644 tests/ui/const-generics/issue-112505-overflow.stderr diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index e568f11db59ad..cf29e7458dddd 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -552,7 +552,6 @@ ui/const-generics/infer/issue-77092.rs ui/const-generics/issue-102124.rs ui/const-generics/issue-105689.rs ui/const-generics/issue-106419-struct-with-multiple-const-params.rs -ui/const-generics/issue-112505-overflow.rs ui/const-generics/issue-46511.rs ui/const-generics/issue-66451.rs ui/const-generics/issue-70408.rs diff --git a/tests/ui/const-generics/issue-112505-overflow.rs b/tests/ui/const-generics/issue-112505-overflow.rs deleted file mode 100644 index 0dd7776d59544..0000000000000 --- a/tests/ui/const-generics/issue-112505-overflow.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![feature(transmute_generic_consts)] - -fn overflow(v: [[[u32; 8888888]; 9999999]; 777777777]) -> [[[u32; 9999999]; 777777777]; 239] { - unsafe { std::mem::transmute(v) } //~ ERROR cannot transmute between types of different sizes -} - -fn main() { } diff --git a/tests/ui/const-generics/issue-112505-overflow.stderr b/tests/ui/const-generics/issue-112505-overflow.stderr deleted file mode 100644 index d370c3dfa6a50..0000000000000 --- a/tests/ui/const-generics/issue-112505-overflow.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/issue-112505-overflow.rs:4:14 - | -LL | unsafe { std::mem::transmute(v) } - | ^^^^^^^^^^^^^^^^^^^ - | - = note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type `[[[u32; 8888888]; 9999999]; 777777777]` are too big for the current architecture) - = note: target type: `[[[u32; 9999999]; 777777777]; 239]` (values of the type `[[[u32; 9999999]; 777777777]; 239]` are too big for the current architecture) - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0512`. diff --git a/tests/ui/const-generics/transmute-fail.rs b/tests/ui/const-generics/transmute-fail.rs index 7faf670e46819..95c711605675f 100644 --- a/tests/ui/const-generics/transmute-fail.rs +++ b/tests/ui/const-generics/transmute-fail.rs @@ -1,3 +1,8 @@ +// ignore-tidy-linelength +//@ normalize-stderr-32bit: "values of the type `[^`]+` are too big" -> "values of the type $$REALLY_TOO_BIG are too big" +//@ normalize-stderr-64bit: "values of the type `[^`]+` are too big" -> "values of the type $$REALLY_TOO_BIG are too big" + + #![feature(transmute_generic_consts)] #![feature(generic_const_exprs)] #![allow(incomplete_features)] @@ -31,6 +36,11 @@ fn overflow(v: [[[u32; 8888888]; 9999999]; 777777777]) -> [[[u32; 9999999]; 7777 } } +fn overflow_more(v: [[[u32; 8888888]; 9999999]; 777777777]) -> [[[u32; 9999999]; 777777777]; 239] { + unsafe { std::mem::transmute(v) } //~ ERROR cannot transmute between types of different sizes +} + + fn transpose(v: [[u32; H]; W]) -> [[u32; W]; H] { unsafe { std::mem::transmute(v) diff --git a/tests/ui/const-generics/transmute-fail.stderr b/tests/ui/const-generics/transmute-fail.stderr index b47c7d5098f54..fc78526677a18 100644 --- a/tests/ui/const-generics/transmute-fail.stderr +++ b/tests/ui/const-generics/transmute-fail.stderr @@ -1,11 +1,11 @@ error: the constant `W` is not of type `usize` - --> $DIR/transmute-fail.rs:12:42 + --> $DIR/transmute-fail.rs:17:42 | LL | fn bar(v: [[u32; H]; W]) -> [[u32; W]; H] { | ^^^^^^^^^^^^^ expected `usize`, found `bool` error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:7:9 + --> $DIR/transmute-fail.rs:12:9 | LL | std::mem::transmute(v) | ^^^^^^^^^^^^^^^^^^^ @@ -14,13 +14,13 @@ LL | std::mem::transmute(v) = note: target type: `[[u32; W + 1]; H]` (size can vary because of [u32; W + 1]) error: the constant `W` is not of type `usize` - --> $DIR/transmute-fail.rs:15:9 + --> $DIR/transmute-fail.rs:20:9 | LL | std::mem::transmute(v) | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:22:9 + --> $DIR/transmute-fail.rs:27:9 | LL | std::mem::transmute(v) | ^^^^^^^^^^^^^^^^^^^ @@ -29,16 +29,25 @@ LL | std::mem::transmute(v) = note: target type: `[u32; W * H * H]` (this type does not have a fixed size) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:29:9 + --> $DIR/transmute-fail.rs:34:9 | LL | std::mem::transmute(v) | ^^^^^^^^^^^^^^^^^^^ | - = note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type `[[[u32; 8888888]; 9999999]; 777777777]` are too big for the current architecture) - = note: target type: `[[[u32; 9999999]; 777777777]; 8888888]` (values of the type `[[[u32; 9999999]; 777777777]; 8888888]` are too big for the current architecture) + = note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type $REALLY_TOO_BIG are too big for the current architecture) + = note: target type: `[[[u32; 9999999]; 777777777]; 8888888]` (values of the type $REALLY_TOO_BIG are too big for the current architecture) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:36:9 + --> $DIR/transmute-fail.rs:40:14 + | +LL | unsafe { std::mem::transmute(v) } + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type $REALLY_TOO_BIG are too big for the current architecture) + = note: target type: `[[[u32; 9999999]; 777777777]; 239]` (values of the type $REALLY_TOO_BIG are too big for the current architecture) + +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-fail.rs:46:9 | LL | std::mem::transmute(v) | ^^^^^^^^^^^^^^^^^^^ @@ -47,7 +56,7 @@ LL | std::mem::transmute(v) = note: target type: `[[u32; W]; H]` (size can vary because of [u32; W]) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:47:9 + --> $DIR/transmute-fail.rs:57:9 | LL | std::mem::transmute(v) | ^^^^^^^^^^^^^^^^^^^ @@ -56,7 +65,7 @@ LL | std::mem::transmute(v) = note: target type: `[u32; W * H]` (this type does not have a fixed size) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:54:9 + --> $DIR/transmute-fail.rs:64:9 | LL | std::mem::transmute(v) | ^^^^^^^^^^^^^^^^^^^ @@ -65,7 +74,7 @@ LL | std::mem::transmute(v) = note: target type: `[[u32; W]; H]` (size can vary because of [u32; W]) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:63:9 + --> $DIR/transmute-fail.rs:73:9 | LL | std::mem::transmute(v) | ^^^^^^^^^^^^^^^^^^^ @@ -74,7 +83,7 @@ LL | std::mem::transmute(v) = note: target type: `[u32; D * W * H]` (this type does not have a fixed size) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:72:9 + --> $DIR/transmute-fail.rs:82:9 | LL | std::mem::transmute(v) | ^^^^^^^^^^^^^^^^^^^ @@ -83,7 +92,7 @@ LL | std::mem::transmute(v) = note: target type: `[[u32; D * W]; H]` (size can vary because of [u32; D * W]) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:79:9 + --> $DIR/transmute-fail.rs:89:9 | LL | std::mem::transmute(v) | ^^^^^^^^^^^^^^^^^^^ @@ -92,7 +101,7 @@ LL | std::mem::transmute(v) = note: target type: `[u8; L * 2]` (this type does not have a fixed size) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:86:9 + --> $DIR/transmute-fail.rs:96:9 | LL | std::mem::transmute(v) | ^^^^^^^^^^^^^^^^^^^ @@ -101,7 +110,7 @@ LL | std::mem::transmute(v) = note: target type: `[u16; L]` (this type does not have a fixed size) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:93:9 + --> $DIR/transmute-fail.rs:103:9 | LL | std::mem::transmute(v) | ^^^^^^^^^^^^^^^^^^^ @@ -110,7 +119,7 @@ LL | std::mem::transmute(v) = note: target type: `[[u8; 1]; L]` (this type does not have a fixed size) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:102:9 + --> $DIR/transmute-fail.rs:112:9 | LL | std::mem::transmute(v) | ^^^^^^^^^^^^^^^^^^^ @@ -118,6 +127,6 @@ LL | std::mem::transmute(v) = note: source type: `[[u32; 2 * H]; W + W]` (size can vary because of [u32; 2 * H]) = note: target type: `[[u32; W + W]; 2 * H]` (size can vary because of [u32; W + W]) -error: aborting due to 14 previous errors +error: aborting due to 15 previous errors For more information about this error, try `rustc --explain E0512`. diff --git a/tests/ui/limits/huge-struct.rs b/tests/ui/limits/huge-struct.rs index b9e90b3e9d1ae..8d24abba0a281 100644 --- a/tests/ui/limits/huge-struct.rs +++ b/tests/ui/limits/huge-struct.rs @@ -1,7 +1,9 @@ +// ignore-tidy-linelength //@ build-fail //@ normalize-stderr-test: "S32" -> "SXX" //@ normalize-stderr-test: "S1M" -> "SXX" -//@ error-pattern: too big for the current +//@ normalize-stderr-32bit: "values of the type `[^`]+` are too big" -> "values of the type $$REALLY_TOO_BIG are too big" +//@ normalize-stderr-64bit: "values of the type `[^`]+` are too big" -> "values of the type $$REALLY_TOO_BIG are too big" struct S32 { v0: T, diff --git a/tests/ui/limits/huge-struct.stderr b/tests/ui/limits/huge-struct.stderr index 6d18f1011e8af..fdfa2cbdb676a 100644 --- a/tests/ui/limits/huge-struct.stderr +++ b/tests/ui/limits/huge-struct.stderr @@ -1,5 +1,5 @@ -error: values of the type `SXX>>>>` are too big for the current architecture - --> $DIR/huge-struct.rs:46:9 +error: values of the type $REALLY_TOO_BIG are too big for the current architecture + --> $DIR/huge-struct.rs:48:9 | LL | let fat: Option>>> = None; | ^^^ From 325af25c9441ecffd0fc2fb7d5f324fe6224fe7c Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Fri, 20 Sep 2024 00:39:10 -0700 Subject: [PATCH 6/8] TL note: current means target --- compiler/rustc_hir_analysis/messages.ftl | 2 +- compiler/rustc_hir_typeck/src/intrinsicck.rs | 2 +- compiler/rustc_middle/messages.ftl | 2 +- compiler/rustc_middle/src/ty/layout.rs | 2 +- .../src/error_reporting/traits/fulfillment_errors.rs | 4 ++-- tests/ui/const-generics/transmute-fail.stderr | 8 ++++---- .../debuginfo/debuginfo-type-name-layout-ice-94961-1.rs | 2 +- .../debuginfo-type-name-layout-ice-94961-1.stderr | 2 +- .../debuginfo/debuginfo-type-name-layout-ice-94961-2.rs | 2 +- .../debuginfo-type-name-layout-ice-94961-2.stderr | 2 +- tests/ui/extern/extern-static-size-overflow.stderr | 6 +++--- tests/ui/layout/size-of-val-raw-too-big.rs | 2 +- tests/ui/layout/size-of-val-raw-too-big.stderr | 2 +- tests/ui/layout/too-big-with-padding.rs | 2 +- tests/ui/layout/too-big-with-padding.stderr | 2 +- tests/ui/limits/huge-array-simple-32.rs | 2 +- tests/ui/limits/huge-array-simple-32.stderr | 2 +- tests/ui/limits/huge-array-simple-64.rs | 2 +- tests/ui/limits/huge-array-simple-64.stderr | 2 +- tests/ui/limits/huge-array.stderr | 2 +- tests/ui/limits/huge-enum.rs | 2 +- tests/ui/limits/huge-enum.stderr | 2 +- tests/ui/limits/huge-static.stderr | 4 ++-- tests/ui/limits/huge-struct.rs | 2 +- tests/ui/limits/huge-struct.stderr | 2 +- tests/ui/limits/issue-15919-32.stderr | 2 +- tests/ui/limits/issue-15919-64.stderr | 2 +- tests/ui/limits/issue-17913.rs | 2 +- tests/ui/limits/issue-17913.stderr | 2 +- tests/ui/limits/issue-55878.rs | 2 +- tests/ui/limits/issue-55878.stderr | 2 +- tests/ui/limits/issue-69485-var-size-diffs-too-large.rs | 2 +- .../ui/limits/issue-69485-var-size-diffs-too-large.stderr | 2 +- tests/ui/limits/issue-75158-64.stderr | 2 +- tests/ui/transmutability/arrays/huge-len.stderr | 4 ++-- 35 files changed, 43 insertions(+), 43 deletions(-) diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl index bde94be6f514e..99725ea4cad96 100644 --- a/compiler/rustc_hir_analysis/messages.ftl +++ b/compiler/rustc_hir_analysis/messages.ftl @@ -497,7 +497,7 @@ hir_analysis_tait_forward_compat2 = item does not constrain `{$opaque_type}`, bu hir_analysis_target_feature_on_main = `main` function is not allowed to have `#[target_feature]` -hir_analysis_too_large_static = extern static is too large for the current architecture +hir_analysis_too_large_static = extern static is too large for the target architecture hir_analysis_track_caller_on_main = `main` function is not allowed to be `#[track_caller]` .suggestion = remove this annotation diff --git a/compiler/rustc_hir_typeck/src/intrinsicck.rs b/compiler/rustc_hir_typeck/src/intrinsicck.rs index f39d83a2a6f79..81d940a3f9b47 100644 --- a/compiler/rustc_hir_typeck/src/intrinsicck.rs +++ b/compiler/rustc_hir_typeck/src/intrinsicck.rs @@ -95,7 +95,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { format!("{v} bits") } else { // `u128` should definitely be able to hold the size of different architectures - // larger sizes should be reported as error `are too big for the current architecture` + // larger sizes should be reported as error `are too big for the target architecture` // otherwise we have a bug somewhere bug!("{:?} overflow for u128", size) } diff --git a/compiler/rustc_middle/messages.ftl b/compiler/rustc_middle/messages.ftl index 2b9d9a07a98ef..39485a324f2e2 100644 --- a/compiler/rustc_middle/messages.ftl +++ b/compiler/rustc_middle/messages.ftl @@ -103,5 +103,5 @@ middle_unknown_layout = the type `{$ty}` has an unknown layout middle_values_too_big = - values of the type `{$ty}` are too big for the current architecture + values of the type `{$ty}` are too big for the target architecture middle_written_to_path = the full type name has been written to '{$path}' diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index 877c54c56491e..9ed5dc87be486 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -264,7 +264,7 @@ impl<'tcx> fmt::Display for LayoutError<'tcx> { match *self { LayoutError::Unknown(ty) => write!(f, "the type `{ty}` has an unknown layout"), LayoutError::SizeOverflow(ty) => { - write!(f, "values of the type `{ty}` are too big for the current architecture") + write!(f, "values of the type `{ty}` are too big for the target architecture") } LayoutError::NormalizationFailure(t, e) => write!( f, diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs index 2de6ee9cf9186..1f11ee3f93991 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs @@ -2269,12 +2269,12 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } rustc_transmute::Reason::SrcSizeOverflow => { format!( - "values of the type `{src}` are too big for the current architecture" + "values of the type `{src}` are too big for the target architecture" ) } rustc_transmute::Reason::DstSizeOverflow => { format!( - "values of the type `{dst}` are too big for the current architecture" + "values of the type `{dst}` are too big for the target architecture" ) } rustc_transmute::Reason::DstHasStricterAlignment { diff --git a/tests/ui/const-generics/transmute-fail.stderr b/tests/ui/const-generics/transmute-fail.stderr index fc78526677a18..638ce790345a3 100644 --- a/tests/ui/const-generics/transmute-fail.stderr +++ b/tests/ui/const-generics/transmute-fail.stderr @@ -34,8 +34,8 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- LL | std::mem::transmute(v) | ^^^^^^^^^^^^^^^^^^^ | - = note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type $REALLY_TOO_BIG are too big for the current architecture) - = note: target type: `[[[u32; 9999999]; 777777777]; 8888888]` (values of the type $REALLY_TOO_BIG are too big for the current architecture) + = note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type $REALLY_TOO_BIG are too big for the target architecture) + = note: target type: `[[[u32; 9999999]; 777777777]; 8888888]` (values of the type $REALLY_TOO_BIG are too big for the target architecture) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/transmute-fail.rs:40:14 @@ -43,8 +43,8 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- LL | unsafe { std::mem::transmute(v) } | ^^^^^^^^^^^^^^^^^^^ | - = note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type $REALLY_TOO_BIG are too big for the current architecture) - = note: target type: `[[[u32; 9999999]; 777777777]; 239]` (values of the type $REALLY_TOO_BIG are too big for the current architecture) + = note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type $REALLY_TOO_BIG are too big for the target architecture) + = note: target type: `[[[u32; 9999999]; 777777777]; 239]` (values of the type $REALLY_TOO_BIG are too big for the target architecture) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/transmute-fail.rs:46:9 diff --git a/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.rs b/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.rs index dc68f6cf71f11..a1922c98ef6d3 100644 --- a/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.rs +++ b/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.rs @@ -3,7 +3,7 @@ //@ compile-flags:-C debuginfo=2 //@ build-fail -//@ error-pattern: too big for the current architecture +//@ error-pattern: too big for the target architecture //@ normalize-stderr-64bit: "18446744073709551615" -> "SIZE" //@ normalize-stderr-32bit: "4294967295" -> "SIZE" diff --git a/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.stderr b/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.stderr index 06aad9616cb7a..a3772e509ed67 100644 --- a/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.stderr +++ b/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.stderr @@ -1,4 +1,4 @@ -error: values of the type `[u8; usize::MAX]` are too big for the current architecture +error: values of the type `[u8; usize::MAX]` are too big for the target architecture error: aborting due to 1 previous error diff --git a/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs b/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs index 2b6e85362b68c..3456cd55b7582 100644 --- a/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs +++ b/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs @@ -5,7 +5,7 @@ //@ compile-flags:-C debuginfo=2 //@ build-fail -//@ error-pattern: too big for the current architecture +//@ error-pattern: too big for the target architecture //@ normalize-stderr-64bit: "18446744073709551615" -> "SIZE" //@ normalize-stderr-32bit: "4294967295" -> "SIZE" diff --git a/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.stderr b/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.stderr index 06aad9616cb7a..a3772e509ed67 100644 --- a/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.stderr +++ b/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.stderr @@ -1,4 +1,4 @@ -error: values of the type `[u8; usize::MAX]` are too big for the current architecture +error: values of the type `[u8; usize::MAX]` are too big for the target architecture error: aborting due to 1 previous error diff --git a/tests/ui/extern/extern-static-size-overflow.stderr b/tests/ui/extern/extern-static-size-overflow.stderr index 5da580e34f428..c6490e96a8e6f 100644 --- a/tests/ui/extern/extern-static-size-overflow.stderr +++ b/tests/ui/extern/extern-static-size-overflow.stderr @@ -1,16 +1,16 @@ -error: extern static is too large for the current architecture +error: extern static is too large for the target architecture --> $DIR/extern-static-size-overflow.rs:20:5 | LL | static BAZ: [u8; max_size()]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: extern static is too large for the current architecture +error: extern static is too large for the target architecture --> $DIR/extern-static-size-overflow.rs:21:5 | LL | static UWU: [usize; usize::MAX]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: extern static is too large for the current architecture +error: extern static is too large for the target architecture --> $DIR/extern-static-size-overflow.rs:22:5 | LL | static A: ReallyBig; diff --git a/tests/ui/layout/size-of-val-raw-too-big.rs b/tests/ui/layout/size-of-val-raw-too-big.rs index 8d82c78d95397..dfca6d6eb764f 100644 --- a/tests/ui/layout/size-of-val-raw-too-big.rs +++ b/tests/ui/layout/size-of-val-raw-too-big.rs @@ -1,7 +1,7 @@ //@ build-fail //@ compile-flags: --crate-type lib //@ only-32bit Layout computation rejects this layout for different reasons on 64-bit. -//@ error-pattern: too big for the current architecture +//@ error-pattern: too big for the target architecture #![feature(core_intrinsics)] #![allow(internal_features)] diff --git a/tests/ui/layout/size-of-val-raw-too-big.stderr b/tests/ui/layout/size-of-val-raw-too-big.stderr index aa9abd644faaf..886bba9ec9d34 100644 --- a/tests/ui/layout/size-of-val-raw-too-big.stderr +++ b/tests/ui/layout/size-of-val-raw-too-big.stderr @@ -1,4 +1,4 @@ -error: values of the type `Example` are too big for the current architecture +error: values of the type `Example` are too big for the target architecture error: aborting due to 1 previous error diff --git a/tests/ui/layout/too-big-with-padding.rs b/tests/ui/layout/too-big-with-padding.rs index 76703100145ad..8423ad2e1d607 100644 --- a/tests/ui/layout/too-big-with-padding.rs +++ b/tests/ui/layout/too-big-with-padding.rs @@ -10,7 +10,7 @@ #[repr(C, align(2))] pub struct Example([u8; 0x7fffffff]); -pub fn lib(_x: Example) {} //~ERROR: too big for the current architecture +pub fn lib(_x: Example) {} //~ERROR: too big for the target architecture #[lang = "sized"] pub trait Sized {} diff --git a/tests/ui/layout/too-big-with-padding.stderr b/tests/ui/layout/too-big-with-padding.stderr index 71309788dac86..fc3b4db049ac3 100644 --- a/tests/ui/layout/too-big-with-padding.stderr +++ b/tests/ui/layout/too-big-with-padding.stderr @@ -1,4 +1,4 @@ -error: values of the type `Example` are too big for the current architecture +error: values of the type `Example` are too big for the target architecture --> $DIR/too-big-with-padding.rs:13:1 | LL | pub fn lib(_x: Example) {} diff --git a/tests/ui/limits/huge-array-simple-32.rs b/tests/ui/limits/huge-array-simple-32.rs index 6ff981cd160ab..db75cc57e9a22 100644 --- a/tests/ui/limits/huge-array-simple-32.rs +++ b/tests/ui/limits/huge-array-simple-32.rs @@ -4,6 +4,6 @@ #![allow(arithmetic_overflow)] fn main() { - let _fat: [u8; (1<<31)+(1<<15)] = //~ ERROR too big for the current architecture + let _fat: [u8; (1<<31)+(1<<15)] = //~ ERROR too big for the target architecture [0; (1u32<<31) as usize +(1u32<<15) as usize]; } diff --git a/tests/ui/limits/huge-array-simple-32.stderr b/tests/ui/limits/huge-array-simple-32.stderr index 1b86b02297f34..33979915feb23 100644 --- a/tests/ui/limits/huge-array-simple-32.stderr +++ b/tests/ui/limits/huge-array-simple-32.stderr @@ -1,4 +1,4 @@ -error: values of the type `[u8; 2147516416]` are too big for the current architecture +error: values of the type `[u8; 2147516416]` are too big for the target architecture --> $DIR/huge-array-simple-32.rs:7:9 | LL | let _fat: [u8; (1<<31)+(1<<15)] = diff --git a/tests/ui/limits/huge-array-simple-64.rs b/tests/ui/limits/huge-array-simple-64.rs index 13b284503bf52..d2838e0d41e70 100644 --- a/tests/ui/limits/huge-array-simple-64.rs +++ b/tests/ui/limits/huge-array-simple-64.rs @@ -4,6 +4,6 @@ #![allow(arithmetic_overflow)] fn main() { - let _fat: [u8; (1<<61)+(1<<31)] = //~ ERROR too big for the current architecture + let _fat: [u8; (1<<61)+(1<<31)] = //~ ERROR too big for the target architecture [0; (1u64<<61) as usize +(1u64<<31) as usize]; } diff --git a/tests/ui/limits/huge-array-simple-64.stderr b/tests/ui/limits/huge-array-simple-64.stderr index 8d395c3c6a959..46df288d4f78a 100644 --- a/tests/ui/limits/huge-array-simple-64.stderr +++ b/tests/ui/limits/huge-array-simple-64.stderr @@ -1,4 +1,4 @@ -error: values of the type `[u8; 2305843011361177600]` are too big for the current architecture +error: values of the type `[u8; 2305843011361177600]` are too big for the target architecture --> $DIR/huge-array-simple-64.rs:7:9 | LL | let _fat: [u8; (1<<61)+(1<<31)] = diff --git a/tests/ui/limits/huge-array.stderr b/tests/ui/limits/huge-array.stderr index 2ebaf17a138cd..ce0c0d650c2f8 100644 --- a/tests/ui/limits/huge-array.stderr +++ b/tests/ui/limits/huge-array.stderr @@ -1,4 +1,4 @@ -error: values of the type `[[u8; 1518599999]; 1518600000]` are too big for the current architecture +error: values of the type `[[u8; 1518599999]; 1518600000]` are too big for the target architecture --> $DIR/huge-array.rs:4:9 | LL | let s: [T; 1518600000] = [t; 1518600000]; diff --git a/tests/ui/limits/huge-enum.rs b/tests/ui/limits/huge-enum.rs index 031b342afb3ae..5664d0ba51667 100644 --- a/tests/ui/limits/huge-enum.rs +++ b/tests/ui/limits/huge-enum.rs @@ -10,5 +10,5 @@ type BIG = Option<[u32; (1<<59)-1]>; fn main() { let big: BIG = None; - //~^ ERROR are too big for the current architecture + //~^ ERROR are too big for the target architecture } diff --git a/tests/ui/limits/huge-enum.stderr b/tests/ui/limits/huge-enum.stderr index fcd40607af461..18168b3fa5cf7 100644 --- a/tests/ui/limits/huge-enum.stderr +++ b/tests/ui/limits/huge-enum.stderr @@ -1,4 +1,4 @@ -error: values of the type `Option` are too big for the current architecture +error: values of the type `Option` are too big for the target architecture --> $DIR/huge-enum.rs:12:9 | LL | let big: BIG = None; diff --git a/tests/ui/limits/huge-static.stderr b/tests/ui/limits/huge-static.stderr index 19ac65429af57..684efeeb4a3b7 100644 --- a/tests/ui/limits/huge-static.stderr +++ b/tests/ui/limits/huge-static.stderr @@ -2,13 +2,13 @@ error[E0080]: could not evaluate static initializer --> $DIR/huge-static.rs:19:1 | LL | static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; 2305843009213693952]` are too big for the current architecture + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; 2305843009213693952]` are too big for the target architecture error[E0080]: could not evaluate static initializer --> $DIR/huge-static.rs:22:1 | LL | static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; 2305843009213693952]` are too big for the current architecture + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; 2305843009213693952]` are too big for the target architecture error: aborting due to 2 previous errors diff --git a/tests/ui/limits/huge-struct.rs b/tests/ui/limits/huge-struct.rs index 8d24abba0a281..f7ce4f26db18d 100644 --- a/tests/ui/limits/huge-struct.rs +++ b/tests/ui/limits/huge-struct.rs @@ -46,6 +46,6 @@ struct S1M { val: S1k> } fn main() { let fat: Option>>> = None; - //~^ ERROR are too big for the current architecture + //~^ ERROR are too big for the target architecture } diff --git a/tests/ui/limits/huge-struct.stderr b/tests/ui/limits/huge-struct.stderr index fdfa2cbdb676a..b10455ffd2dca 100644 --- a/tests/ui/limits/huge-struct.stderr +++ b/tests/ui/limits/huge-struct.stderr @@ -1,4 +1,4 @@ -error: values of the type $REALLY_TOO_BIG are too big for the current architecture +error: values of the type $REALLY_TOO_BIG are too big for the target architecture --> $DIR/huge-struct.rs:48:9 | LL | let fat: Option>>> = None; diff --git a/tests/ui/limits/issue-15919-32.stderr b/tests/ui/limits/issue-15919-32.stderr index abd65ff3c9eb7..f162838d37d8b 100644 --- a/tests/ui/limits/issue-15919-32.stderr +++ b/tests/ui/limits/issue-15919-32.stderr @@ -1,4 +1,4 @@ -error: values of the type `[usize; usize::MAX]` are too big for the current architecture +error: values of the type `[usize; usize::MAX]` are too big for the target architecture --> $DIR/issue-15919-32.rs:5:9 | LL | let x = [0usize; 0xffff_ffff]; diff --git a/tests/ui/limits/issue-15919-64.stderr b/tests/ui/limits/issue-15919-64.stderr index d1f0cc39c1884..cd443f2065bbd 100644 --- a/tests/ui/limits/issue-15919-64.stderr +++ b/tests/ui/limits/issue-15919-64.stderr @@ -1,4 +1,4 @@ -error: values of the type `[usize; usize::MAX]` are too big for the current architecture +error: values of the type `[usize; usize::MAX]` are too big for the target architecture --> $DIR/issue-15919-64.rs:5:9 | LL | let x = [0usize; 0xffff_ffff_ffff_ffff]; diff --git a/tests/ui/limits/issue-17913.rs b/tests/ui/limits/issue-17913.rs index 325923f32f376..24fd3b542e6af 100644 --- a/tests/ui/limits/issue-17913.rs +++ b/tests/ui/limits/issue-17913.rs @@ -1,6 +1,6 @@ //@ build-fail //@ normalize-stderr-test: "\[&usize; \d+\]" -> "[&usize; usize::MAX]" -//@ error-pattern: too big for the current architecture +//@ error-pattern: too big for the target architecture #[cfg(target_pointer_width = "64")] fn main() { diff --git a/tests/ui/limits/issue-17913.stderr b/tests/ui/limits/issue-17913.stderr index 893730cbbd261..e9c3c14e18143 100644 --- a/tests/ui/limits/issue-17913.stderr +++ b/tests/ui/limits/issue-17913.stderr @@ -1,4 +1,4 @@ -error: values of the type `[&usize; usize::MAX]` are too big for the current architecture +error: values of the type `[&usize; usize::MAX]` are too big for the target architecture --> $SRC_DIR/alloc/src/boxed.rs:LL:COL error: aborting due to 1 previous error diff --git a/tests/ui/limits/issue-55878.rs b/tests/ui/limits/issue-55878.rs index 4d91a173240da..81696e226fd07 100644 --- a/tests/ui/limits/issue-55878.rs +++ b/tests/ui/limits/issue-55878.rs @@ -2,7 +2,7 @@ //@ normalize-stderr-64bit: "18446744073709551615" -> "SIZE" //@ normalize-stderr-32bit: "4294967295" -> "SIZE" -//@ error-pattern: are too big for the current architecture +//@ error-pattern: are too big for the target architecture fn main() { println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); } diff --git a/tests/ui/limits/issue-55878.stderr b/tests/ui/limits/issue-55878.stderr index 97ca0f4fb592c..0a5f17be80473 100644 --- a/tests/ui/limits/issue-55878.stderr +++ b/tests/ui/limits/issue-55878.stderr @@ -1,7 +1,7 @@ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | - = note: values of the type `[u8; usize::MAX]` are too big for the current architecture + = note: values of the type `[u8; usize::MAX]` are too big for the target architecture | note: inside `std::mem::size_of::<[u8; usize::MAX]>` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL diff --git a/tests/ui/limits/issue-69485-var-size-diffs-too-large.rs b/tests/ui/limits/issue-69485-var-size-diffs-too-large.rs index 9c150c119d069..6133183a55cf1 100644 --- a/tests/ui/limits/issue-69485-var-size-diffs-too-large.rs +++ b/tests/ui/limits/issue-69485-var-size-diffs-too-large.rs @@ -3,7 +3,7 @@ //@ compile-flags: -Zmir-opt-level=0 fn main() { - Bug::V([0; !0]); //~ ERROR are too big for the current + Bug::V([0; !0]); //~ ERROR are too big for the target } enum Bug { diff --git a/tests/ui/limits/issue-69485-var-size-diffs-too-large.stderr b/tests/ui/limits/issue-69485-var-size-diffs-too-large.stderr index 7b9b8f76d0c88..7fa0ab95981a7 100644 --- a/tests/ui/limits/issue-69485-var-size-diffs-too-large.stderr +++ b/tests/ui/limits/issue-69485-var-size-diffs-too-large.stderr @@ -1,4 +1,4 @@ -error: values of the type `[u8; usize::MAX]` are too big for the current architecture +error: values of the type `[u8; usize::MAX]` are too big for the target architecture --> $DIR/issue-69485-var-size-diffs-too-large.rs:6:5 | LL | Bug::V([0; !0]); diff --git a/tests/ui/limits/issue-75158-64.stderr b/tests/ui/limits/issue-75158-64.stderr index 06aad9616cb7a..a3772e509ed67 100644 --- a/tests/ui/limits/issue-75158-64.stderr +++ b/tests/ui/limits/issue-75158-64.stderr @@ -1,4 +1,4 @@ -error: values of the type `[u8; usize::MAX]` are too big for the current architecture +error: values of the type `[u8; usize::MAX]` are too big for the target architecture error: aborting due to 1 previous error diff --git a/tests/ui/transmutability/arrays/huge-len.stderr b/tests/ui/transmutability/arrays/huge-len.stderr index 1fa16c649d423..2f8a86df0a7e3 100644 --- a/tests/ui/transmutability/arrays/huge-len.stderr +++ b/tests/ui/transmutability/arrays/huge-len.stderr @@ -2,7 +2,7 @@ error[E0277]: `()` cannot be safely transmuted into `ExplicitlyPadded` --> $DIR/huge-len.rs:21:41 | LL | assert::is_maybe_transmutable::<(), ExplicitlyPadded>(); - | ^^^^^^^^^^^^^^^^ values of the type `ExplicitlyPadded` are too big for the current architecture + | ^^^^^^^^^^^^^^^^ values of the type `ExplicitlyPadded` are too big for the target architecture | note: required by a bound in `is_maybe_transmutable` --> $DIR/huge-len.rs:8:14 @@ -17,7 +17,7 @@ error[E0277]: `ExplicitlyPadded` cannot be safely transmuted into `()` --> $DIR/huge-len.rs:24:55 | LL | assert::is_maybe_transmutable::(); - | ^^ values of the type `ExplicitlyPadded` are too big for the current architecture + | ^^ values of the type `ExplicitlyPadded` are too big for the target architecture | note: required by a bound in `is_maybe_transmutable` --> $DIR/huge-len.rs:8:14 From d93d2f146d2209b826e3f4c125a2f53c09cd8475 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Fri, 20 Sep 2024 08:41:31 -0700 Subject: [PATCH 7/8] miri: An error message got changed --- src/tools/miri/tests/fail/type-too-large.stderr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/miri/tests/fail/type-too-large.stderr b/src/tools/miri/tests/fail/type-too-large.stderr index 15ad8f1764d0e..cd27b2463891b 100644 --- a/src/tools/miri/tests/fail/type-too-large.stderr +++ b/src/tools/miri/tests/fail/type-too-large.stderr @@ -1,8 +1,8 @@ -error: post-monomorphization error: values of the type `[u8; 2305843011361177600]` are too big for the current architecture +error: post-monomorphization error: values of the type `[u8; 2305843011361177600]` are too big for the target architecture --> tests/fail/type-too-large.rs:LL:CC | LL | _fat = [0; (1u64 << 61) as usize + (1u64 << 31) as usize]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; 2305843011361177600]` are too big for the current architecture + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; 2305843011361177600]` are too big for the target architecture | = note: BACKTRACE: = note: inside `main` at tests/fail/type-too-large.rs:LL:CC From cf78f26d5ed5ce32f49fb38cca969d3609599e27 Mon Sep 17 00:00:00 2001 From: Jubilee Date: Sat, 21 Sep 2024 07:54:54 -0700 Subject: [PATCH 8/8] compiler: Precisely name units of object size Co-authored-by: Ralf Jung --- compiler/rustc_abi/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 5e0adc4522952..3bd9444511634 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -337,15 +337,15 @@ impl TargetDataLayout { Ok(dl) } - /// Returns **exclusive** upper bound on object size. + /// Returns **exclusive** upper bound on object size in bytes. /// /// The theoretical maximum object size is defined as the maximum positive `isize` value. /// This ensures that the `offset` semantics remain well-defined by allowing it to correctly /// index every address within an object along with one byte past the end, along with allowing /// `isize` to store the difference between any two pointers into an object. /// - /// LLVM uses a 64-bit integer to represent object size in bits, but we care only for bytes, - /// so we adopt such a more-constrained address space due to its technical limitations. + /// LLVM uses a 64-bit integer to represent object size in *bits*, but we care only for bytes, + /// so we adopt such a more-constrained size bound due to its technical limitations. #[inline] pub fn obj_size_bound(&self) -> u64 { match self.pointer_size.bits() {