From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../const-eval/index-out-of-bounds-never-type.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs (limited to 'tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs') diff --git a/tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs b/tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs new file mode 100644 index 000000000..bc2ea3f18 --- /dev/null +++ b/tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs @@ -0,0 +1,21 @@ +// build-fail + +// Regression test for #66975 +#![warn(unconditional_panic)] +#![feature(never_type)] + +struct PrintName(T); + +impl PrintName { + const VOID: ! = { let x = 0 * std::mem::size_of::(); [][x] }; + //~^ ERROR evaluation of `PrintName::<()>::VOID` failed + +} + +fn f() { + let _ = PrintName::::VOID; +} + +pub fn main() { + f::<()>(); +} -- cgit v1.2.3