From 75d951e1adf515b6ef549c4cf12432dfbe1b8ac5 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Fri, 27 Sep 2019 15:36:20 +0200 Subject: [PATCH] Add regression test for ICE #4579 --- tests/ui/ice-4579.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tests/ui/ice-4579.rs diff --git a/tests/ui/ice-4579.rs b/tests/ui/ice-4579.rs new file mode 100644 index 000000000..2e7e279f8 --- /dev/null +++ b/tests/ui/ice-4579.rs @@ -0,0 +1,13 @@ +#![allow(clippy::single_match)] + +use std::ptr; + +fn main() { + match Some(0_usize) { + Some(_) => { + let s = "012345"; + unsafe { ptr::read(s.as_ptr().offset(1) as *const [u8; 5]) }; + }, + _ => (), + }; +}