Skip to content

Commit

Permalink
Rollup merge of rust-lang#57666 - pnkfelix:generalize-huge-enum-test-…
Browse files Browse the repository at this point in the history
…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`
  • Loading branch information
Centril committed Jan 19, 2019
2 parents 36a34e3 + 7bddcba commit 83921c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/test/ui/huge-enum.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// error-pattern: Option
// normalize-stderr-test "<\[u32; \d+\]>" -> "<[u32; N]>"

// FIXME: work properly with higher limits
// normalize-stderr-test "std::option::Option<\[u32; \d+\]>" -> "TYPE"
// normalize-stderr-test "\[u32; \d+\]" -> "TYPE"

#[cfg(target_pointer_width = "32")]
fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/huge-enum.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: the type `std::option::Option<[u32; N]>` is too big for the current architecture
error: the type `TYPE` is too big for the current architecture

error: aborting due to previous error

0 comments on commit 83921c3

Please sign in to comment.