about summary refs log tree commit diff
path: root/src/tools/miri/tests/fail/function_pointers
diff options
context:
space:
mode:
authorMarkus Reiter <me@reitermark.us>2024-04-21 21:45:18 +0200
committerMarkus Reiter <me@reitermark.us>2024-05-08 21:37:55 +0200
commitbd8e565e16b43e2e68a67804d20992218579ac9d (patch)
tree5d56c89a7c826097856d082ce0084691601118d5 /src/tools/miri/tests/fail/function_pointers
parent7531eafa7e20eed36c8738e45790d4a82b702162 (diff)
downloadrust-bd8e565e16b43e2e68a67804d20992218579ac9d.tar.gz
rust-bd8e565e16b43e2e68a67804d20992218579ac9d.zip
Use generic `NonZero`.
Diffstat (limited to 'src/tools/miri/tests/fail/function_pointers')
-rw-r--r--src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.rs6
-rw-r--r--src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.stderr4
2 files changed, 5 insertions, 5 deletions
diff --git a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.rs b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.rs
index 2cf4e044777..c5900489b4c 100644
--- a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.rs
+++ b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.rs
@@ -1,7 +1,7 @@
-use std::num::*;
+use std::num::NonZero;
 
 #[repr(C)]
-struct S1(NonZeroI32);
+struct S1(NonZero<i32>);
 
 #[repr(C)]
 struct S2(i32);
@@ -11,6 +11,6 @@ fn callee(_s: S2) {}
 fn main() {
     let fnptr: fn(S2) = callee;
     let fnptr: fn(S1) = unsafe { std::mem::transmute(fnptr) };
-    fnptr(S1(NonZeroI32::new(1).unwrap()));
+    fnptr(S1(NonZero::new(1).unwrap()));
     //~^ ERROR: calling a function with argument of type S2 passing data of type S1
 }
diff --git a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.stderr b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.stderr
index eaacc32bf68..8ec19db813a 100644
--- a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.stderr
+++ b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.stderr
@@ -1,8 +1,8 @@
 error: Undefined Behavior: calling a function with argument of type S2 passing data of type S1
   --> $DIR/abi_mismatch_repr_C.rs:LL:CC
    |
-LL |     fnptr(S1(NonZeroI32::new(1).unwrap()));
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with argument of type S2 passing data of type S1
+LL |     fnptr(S1(NonZero::new(1).unwrap()));
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with argument of type S2 passing data of type S1
    |
    = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
    = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information