From 19ce2bd1b345e8399c514616e8cadf8cbcf348bc Mon Sep 17 00:00:00 2001 From: Khyber Sen Date: Sun, 11 Jun 2023 22:33:26 -0700 Subject: [PATCH] (`c2rust-analyze`) Fix `cast_fn_item_to_fn_ptr` test to correctly create a `PointerCast::ReifyFnPointer`. --- c2rust-analyze/tests/analyze/string_casts.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/c2rust-analyze/tests/analyze/string_casts.rs b/c2rust-analyze/tests/analyze/string_casts.rs index d33a1acf79..9aa7c9bde8 100644 --- a/c2rust-analyze/tests/analyze/string_casts.rs +++ b/c2rust-analyze/tests/analyze/string_casts.rs @@ -35,9 +35,10 @@ pub fn cast_from_literal_explicit() { } /// [`PointerCast::ReifyFnPointer`] -/// Can't figure out how to create a [`PointerCast::ReifyFnPointer`]. -#[cfg(any())] -pub fn cast_fn_item_to_fn_ptr(f: impl Fn(u8) -> i8) { +pub fn cast_fn_item_to_fn_ptr() { + fn f(x: u8) -> i8 { + x as i8 + } f as fn(u8) -> i8; }