From e02903c7f11fc719062ecc13bb0ca5a0d9e2655d 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/c2rust-analyze/tests/analyze/string_casts.rs b/c2rust-analyze/tests/analyze/string_casts.rs index d33a1acf79..f5d42ec21a 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) { + fn f(x: u8) -> i8 { + x as i8 + } f as fn(u8) -> i8; }