Skip to content

Commit 83921c3

Browse files
authored
Rollup merge of #57666 - pnkfelix:generalize-huge-enum-test-to-work-cross-platform, r=nikomatsakis
Generalize `huge-enum.rs` test and expected stderr for more cross platform cases With this change, I am able to build and test cross-platform `rustc` In particular, I can use the following in my `config.toml`: ``` [build] host = ["i686-unknown-linux-gnu", "x86_64-unknown-linux-gnu"] target = ["i686-unknown-linux-gnu", "x86_64-unknown-linux-gnu"] ``` Before this change, my attempt to run the test suite would fail because the error output differs depending on what your host and targets are. ---- To be concrete, here are the actual messages one can observe: ``` % ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused --target=x86_64-unknown-linux-gnu error: the type `std::option::Option<[u32; 35184372088831]>` is too big for the current architecture error: aborting due to previous error % ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused --target=i686-unknown-linux-gnu error: the type `std::option::Option<[u32; 536870911]>` is too big for the current architecture error: aborting due to previous error % ./build/i686-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused --target=i686-unknown-linux-gnu error: the type `std::option::Option<[u32; 536870911]>` is too big for the current architecture error: aborting due to previous error % ./build/i686-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused --target=x86_64-unknown-linux-gnu error: the type `[u32; 35184372088831]` is too big for the current architecture error: aborting due to previous error ``` To address these variations, I changed the test to be more aggressive in its normalization strategy. We cannot (and IMO should not) guarantee that `Option` will appear in the error output here. So I normalized both types `Option<[u32; N]>` and `[u32; N]` to just `TYPE`
2 parents 36a34e3 + 7bddcba commit 83921c3

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/test/ui/huge-enum.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
// error-pattern: Option
2-
// normalize-stderr-test "<\[u32; \d+\]>" -> "<[u32; N]>"
3-
4-
// FIXME: work properly with higher limits
1+
// normalize-stderr-test "std::option::Option<\[u32; \d+\]>" -> "TYPE"
2+
// normalize-stderr-test "\[u32; \d+\]" -> "TYPE"
53

64
#[cfg(target_pointer_width = "32")]
75
fn main() {

src/test/ui/huge-enum.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: the type `std::option::Option<[u32; N]>` is too big for the current architecture
1+
error: the type `TYPE` is too big for the current architecture
22

33
error: aborting due to previous error
44

0 commit comments

Comments
 (0)