diff options
| author | bors <bors@rust-lang.org> | 2018-07-01 18:43:41 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-07-01 18:43:41 +0000 |
| commit | a2be769fd50403a07c45677f8f285491c8e90d74 (patch) | |
| tree | 898d003c54271e6be9ca89de25668091d9f3336d /src/test/compile-fail | |
| parent | 6af9f91a170d33550e8f5922cdb728384ec9c7eb (diff) | |
| parent | 46512e09c9f97a68a36e2d72e3be766b1e76a1a0 (diff) | |
| download | rust-a2be769fd50403a07c45677f8f285491c8e90d74.tar.gz rust-a2be769fd50403a07c45677f8f285491c8e90d74.zip | |
Auto merge of #51833 - wesleywiser:faster_large_constant_arrays, r=oli-obk
Speed up compilation of large constant arrays This is a different approach to #51672 as suggested by @oli-obk. Rather than write each repeated value one-by-one, we write the first one and then copy its value directly into the remaining memory. With this change, the [toy program](https://github.com/rust-lang/rust/blob/c2f4744d2db4e162df824d0bd0b093ba4b351545/src/test/run-pass/mir_heavy_promoted.rs) goes from 63 seconds to 19 seconds on my machine. Edit: Inlining `Size::bytes()` saves an additional 6 seconds dropping the total time to 13 seconds on my machine. Edit2: Now down to 2.8 seconds. r? @oli-obk cc @nnethercote @eddyb
Diffstat (limited to 'src/test/compile-fail')
| -rw-r--r-- | src/test/compile-fail/const-err4.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/compile-fail/const-err4.rs b/src/test/compile-fail/const-err4.rs new file mode 100644 index 00000000000..09ebf1681c5 --- /dev/null +++ b/src/test/compile-fail/const-err4.rs @@ -0,0 +1,24 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[derive(Copy, Clone)] +union Foo { + a: isize, + b: (), +} + +enum Bar { + Boo = [unsafe { Foo { b: () }.a }; 4][3], + //~^ ERROR constant evaluation of enum discriminant resulted in non-integer +} + +fn main() { + assert_ne!(Bar::Boo as isize, 0); +} |
