about summary refs log tree commit diff
path: root/tests/ui/consts/const-eval/raw-bytes.rs
diff options
context:
space:
mode:
authorMarkus Reiter <me@reitermark.us>2024-02-22 14:59:52 +0100
committerMarkus Reiter <me@reitermark.us>2024-02-25 12:03:48 +0100
commitb2fbb8a05392be976c67e3b0063203d5b049da5c (patch)
tree798ac97adb74714b49df51d997c177ab056f9e34 /tests/ui/consts/const-eval/raw-bytes.rs
parent710048f790ebc9ebfac6039c6733570f8084c9de (diff)
downloadrust-b2fbb8a05392be976c67e3b0063203d5b049da5c.tar.gz
rust-b2fbb8a05392be976c67e3b0063203d5b049da5c.zip
Use generic `NonZero` in tests.
Diffstat (limited to 'tests/ui/consts/const-eval/raw-bytes.rs')
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/ui/consts/const-eval/raw-bytes.rs b/tests/ui/consts/const-eval/raw-bytes.rs
index 96903b322e4..e5dfd5ca293 100644
--- a/tests/ui/consts/const-eval/raw-bytes.rs
+++ b/tests/ui/consts/const-eval/raw-bytes.rs
@@ -2,14 +2,13 @@
 //@ ignore-endian-big
 // ignore-tidy-linelength
 //@ normalize-stderr-test "╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼" -> "╾ALLOC_ID$1╼"
-
-#![feature(never_type, rustc_attrs, ptr_metadata, slice_from_ptr_range, const_slice_from_ptr_range)]
 #![allow(invalid_value)]
+#![feature(generic_nonzero, never_type, rustc_attrs, ptr_metadata, slice_from_ptr_range, const_slice_from_ptr_range)]
 
 use std::mem;
 use std::alloc::Layout;
 use std::ptr::NonNull;
-use std::num::{NonZeroU8, NonZeroUsize};
+use std::num::NonZero;
 use std::slice::{from_ptr_range, from_raw_parts};
 
 // # Bad enums and chars
@@ -57,9 +56,9 @@ const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute
 const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
 //~^ ERROR it is undefined behavior to use this value
 
-const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
+const NULL_U8: NonZero<u8> = unsafe { mem::transmute(0u8) };
 //~^ ERROR it is undefined behavior to use this value
-const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
+const NULL_USIZE: NonZero<usize> = unsafe { mem::transmute(0usize) };
 //~^ ERROR it is undefined behavior to use this value
 
 #[rustc_layout_scalar_valid_range_start(10)]