Skip to content

Commit 88584d5

Browse files
committed
change error for LayoutErr::SizeOverflow
1 parent dcc194c commit 88584d5

18 files changed

+32
-19
lines changed

compiler/rustc_middle/src/ty/layout.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ impl<'tcx> fmt::Display for LayoutError<'tcx> {
176176
match *self {
177177
LayoutError::Unknown(ty) => write!(f, "the type `{}` has an unknown layout", ty),
178178
LayoutError::SizeOverflow(ty) => {
179-
write!(f, "the type `{}` is too big for the current architecture", ty)
179+
write!(f, "values of the type `{}` are too big for the current architecture", ty)
180180
}
181181
}
182182
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// normalize-stderr-64bit "18446744073709551615" -> "SIZE"
22
// normalize-stderr-32bit "4294967295" -> "SIZE"
33

4-
// error-pattern: is too big for the current architecture
4+
// error-pattern: are too big for the current architecture
55
fn main() {
66
println!("Size: {}", std::mem::size_of::<[u8; std::u64::MAX as usize]>());
77
}

src/test/ui/huge-array-simple-32.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: the type `[u8; 2147516416]` is too big for the current architecture
1+
error: values of the type `[u8; 2147516416]` are too big for the current architecture
22
--> $DIR/huge-array-simple-32.rs:10:9
33
|
44
LL | let _fat: [u8; (1<<31)+(1<<15)] =

src/test/ui/huge-array-simple-64.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: the type `[u8; 2305843011361177600]` is too big for the current architecture
1+
error: values of the type `[u8; 2305843011361177600]` are too big for the current architecture
22
--> $DIR/huge-array-simple-64.rs:10:9
33
|
44
LL | let _fat: [u8; (1<<61)+(1<<31)] =

src/test/ui/huge-array.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
fn generic<T: Copy>(t: T) {
88
let s: [T; 1518600000] = [t; 1518600000];
9-
//~^ ERROR the type `[[u8; 1518599999]; 1518600000]` is too big for the current architecture
9+
//~^ ERROR values of the type `[[u8; 1518599999]; 1518600000]` are too big
1010
}
1111

1212
fn main() {

src/test/ui/huge-array.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: the type `[[u8; 1518599999]; 1518600000]` is too big for the current architecture
1+
error: values of the type `[[u8; 1518599999]; 1518600000]` are too big for the current architecture
22
--> $DIR/huge-array.rs:8:9
33
|
44
LL | let s: [T; 1518600000] = [t; 1518600000];

src/test/ui/huge-enum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ type BIG = Option<[u32; (1<<45)-1]>;
1414

1515
fn main() {
1616
let big: BIG = None;
17-
//~^ ERROR is too big for the current architecture
17+
//~^ ERROR are too big for the current architecture
1818
}

src/test/ui/huge-enum.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: the type `Option<TYPE>` is too big for the current architecture
1+
error: values of the type `Option<TYPE>` are too big for the current architecture
22
--> $DIR/huge-enum.rs:16:9
33
|
44
LL | let big: BIG = None;

src/test/ui/huge-struct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ struct S1M<T> { val: S1k<S1k<T>> }
4848

4949
fn main() {
5050
let fat: Option<S1M<S1M<S1M<u32>>>> = None;
51-
//~^ ERROR is too big for the current architecture
51+
//~^ ERROR are too big for the current architecture
5252

5353
}

src/test/ui/huge-struct.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: the type `SXX<SXX<SXX<u32>>>` is too big for the current architecture
1+
error: values of the type `SXX<SXX<SXX<u32>>>` are too big for the current architecture
22
--> $DIR/huge-struct.rs:50:9
33
|
44
LL | let fat: Option<SXX<SXX<SXX<u32>>>> = None;

src/test/ui/issues/issue-15919-32.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: the type `[usize; 4294967295]` is too big for the current architecture
1+
error: values of the type `[usize; 4294967295]` are too big for the current architecture
22
--> $DIR/issue-15919-32.rs:9:9
33
|
44
LL | let x = [0usize; 0xffff_ffff];

src/test/ui/issues/issue-15919-64.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: the type `[usize; 18446744073709551615]` is too big for the current architecture
1+
error: values of the type `[usize; 18446744073709551615]` are too big for the current architecture
22
--> $DIR/issue-15919-64.rs:9:9
33
|
44
LL | let x = [0usize; 0xffff_ffff_ffff_ffff];

src/test/ui/issues/issue-17913.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: the type `[&usize; N]` is too big for the current architecture
1+
error: values of the type `[&usize; N]` are too big for the current architecture
22

33
error: aborting due to previous error
44

src/test/ui/issues/issue-56762.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ impl TooBigArray {
1717
}
1818

1919
static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new();
20-
//~^ ERROR the type `[u8; 2305843009213693951]` is too big for the current architecture
20+
//~^ ERROR values of the type `[u8; 2305843009213693951]` are too big
2121
static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE];
22-
//~^ ERROR the type `[u8; 2305843009213693951]` is too big for the current architecture
22+
//~^ ERROR values of the type `[u8; 2305843009213693951]` are too big
2323

2424
fn main() { }

src/test/ui/issues/issue-56762.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0080]: the type `[u8; 2305843009213693951]` is too big for the current architecture
1+
error[E0080]: values of the type `[u8; 2305843009213693951]` are too big for the current architecture
22
--> $DIR/issue-56762.rs:19:1
33
|
44
LL | static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

7-
error[E0080]: the type `[u8; 2305843009213693951]` is too big for the current architecture
7+
error[E0080]: values of the type `[u8; 2305843009213693951]` are too big for the current architecture
88
--> $DIR/issue-56762.rs:21:1
99
|
1010
LL | static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE];

src/test/ui/layout/big-type-no-err.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Enormous types are allowed if they are never actually instantiated.
2+
// run-pass
3+
trait Foo {
4+
type Assoc;
5+
}
6+
7+
impl Foo for [u16; usize::MAX] {
8+
type Assoc = u32;
9+
}
10+
11+
fn main() {
12+
let _a: Option<<[u16; usize::MAX] as Foo>::Assoc> = None;
13+
}

src/test/ui/lint/issue-69485-var-size-diffs-too-large.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// compile-flags: -Zmir-opt-level=0
44

55
fn main() {
6-
Bug::V([0; !0]); //~ ERROR is too big for the current
6+
Bug::V([0; !0]); //~ ERROR are too big for the current
77
}
88

99
enum Bug {

src/test/ui/lint/issue-69485-var-size-diffs-too-large.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: the type `[u8; 18446744073709551615]` is too big for the current architecture
1+
error: values of the type `[u8; 18446744073709551615]` are too big for the current architecture
22
--> $DIR/issue-69485-var-size-diffs-too-large.rs:6:12
33
|
44
LL | Bug::V([0; !0]);

0 commit comments

Comments
 (0)