diff options
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/issue-52023-array-size-pointer-cast.rs | 13 | ||||
| -rw-r--r-- | src/test/ui/issue-52023-array-size-pointer-cast.stderr | 9 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/test/ui/issue-52023-array-size-pointer-cast.rs b/src/test/ui/issue-52023-array-size-pointer-cast.rs new file mode 100644 index 00000000000..f3bee1a6315 --- /dev/null +++ b/src/test/ui/issue-52023-array-size-pointer-cast.rs @@ -0,0 +1,13 @@ +// 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. + +fn main() { + let _ = [0; (&0 as *const i32) as usize]; //~ ERROR raw pointers cannot be cast +} diff --git a/src/test/ui/issue-52023-array-size-pointer-cast.stderr b/src/test/ui/issue-52023-array-size-pointer-cast.stderr new file mode 100644 index 00000000000..888de82e379 --- /dev/null +++ b/src/test/ui/issue-52023-array-size-pointer-cast.stderr @@ -0,0 +1,9 @@ +error[E0018]: raw pointers cannot be cast to integers in constants + --> $DIR/issue-52023-array-size-pointer-cast.rs:12:17 + | +LL | let _ = [0; (&0 as *const i32) as usize]; //~ ERROR raw pointers cannot be cast + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0018`. |
