diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2020-01-27 00:49:56 -0500 |
|---|---|---|
| committer | Aaron Hill <aa1ronham@gmail.com> | 2020-01-27 00:49:56 -0500 |
| commit | 9ad1a8c97f8ee0c6af75bca7fae41f7c37d3e73c (patch) | |
| tree | 89f32863b182ae88c07e09ab3be20174a0710796 /src/test | |
| parent | c3681d62ee4bb849e87a2ec5d663afc34ac05d85 (diff) | |
Don't call `tcx.fn_sig` on closures
Fixes #68542
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/consts/issue-68542-closure-in-array-len.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/consts/issue-68542-closure-in-array-len.stderr | 16 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/test/ui/consts/issue-68542-closure-in-array-len.rs b/src/test/ui/consts/issue-68542-closure-in-array-len.rs new file mode 100644 index 00000000000..2e721b85334 --- /dev/null +++ b/src/test/ui/consts/issue-68542-closure-in-array-len.rs @@ -0,0 +1,10 @@ +// Regression test for issue #68542 +// Tests that we don't ICE when a closure appears +// in the length part of an array. + +struct Bug { + a: [(); (|| { 0 })()] //~ ERROR calls in constants are limited to + //~^ ERROR evaluation of constant value failed +} + +fn main() {} diff --git a/src/test/ui/consts/issue-68542-closure-in-array-len.stderr b/src/test/ui/consts/issue-68542-closure-in-array-len.stderr new file mode 100644 index 00000000000..815cc9d836f --- /dev/null +++ b/src/test/ui/consts/issue-68542-closure-in-array-len.stderr @@ -0,0 +1,16 @@ +error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants + --> $DIR/issue-68542-closure-in-array-len.rs:6:13 + | +LL | a: [(); (|| { 0 })()] + | ^^^^^^^^^^^^ + +error[E0080]: evaluation of constant value failed + --> $DIR/issue-68542-closure-in-array-len.rs:6:13 + | +LL | a: [(); (|| { 0 })()] + | ^^^^^^^^^^^^ calling non-const function `Bug::a::{{constant}}#0::{{closure}}#0` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0015, E0080. +For more information about an error, try `rustc --explain E0015`. |
