diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2019-11-13 00:36:38 +0900 |
|---|---|---|
| committer | Yuki Okushi <huyuumi.dev@gmail.com> | 2019-11-13 00:36:38 +0900 |
| commit | 412f0006f520357d220882b57eef501999b44c9a (patch) | |
| tree | 898aebbf4628f5bd91c9e093624e2f0a94dd7d84 | |
| parent | bae9832f714e7244bedc34eac40273eb6e915ed7 (diff) | |
| download | rust-412f0006f520357d220882b57eef501999b44c9a.tar.gz rust-412f0006f520357d220882b57eef501999b44c9a.zip | |
Add test for issue-52432
| -rw-r--r-- | src/test/ui/consts/issue-52432.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/consts/issue-52432.stderr | 28 |
2 files changed, 38 insertions, 0 deletions
diff --git a/src/test/ui/consts/issue-52432.rs b/src/test/ui/consts/issue-52432.rs new file mode 100644 index 00000000000..2d4c939f47d --- /dev/null +++ b/src/test/ui/consts/issue-52432.rs @@ -0,0 +1,10 @@ +#![feature(const_raw_ptr_to_usize_cast)] + +fn main() { + [(); &(static |x| {}) as *const _ as usize]; + //~^ ERROR: closures cannot be static + //~| ERROR: type annotations needed + [(); &(static || {}) as *const _ as usize]; + //~^ ERROR: closures cannot be static + //~| ERROR: evaluation of constant value failed +} diff --git a/src/test/ui/consts/issue-52432.stderr b/src/test/ui/consts/issue-52432.stderr new file mode 100644 index 00000000000..e9539d24118 --- /dev/null +++ b/src/test/ui/consts/issue-52432.stderr @@ -0,0 +1,28 @@ +error[E0697]: closures cannot be static + --> $DIR/issue-52432.rs:4:12 + | +LL | [(); &(static |x| {}) as *const _ as usize]; + | ^^^^^^^^^^ + +error[E0697]: closures cannot be static + --> $DIR/issue-52432.rs:7:12 + | +LL | [(); &(static || {}) as *const _ as usize]; + | ^^^^^^^^^ + +error[E0282]: type annotations needed + --> $DIR/issue-52432.rs:4:20 + | +LL | [(); &(static |x| {}) as *const _ as usize]; + | ^ consider giving this closure parameter a type + +error[E0080]: evaluation of constant value failed + --> $DIR/issue-52432.rs:7:10 + | +LL | [(); &(static || {}) as *const _ as usize]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "pointer-to-integer cast" needs an rfc before being allowed inside constants + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0080, E0282, E0697. +For more information about an error, try `rustc --explain E0080`. |
