Skip to content

PointerCast::ClosureFnPointer is unimplemented #274

Closed

Description

@danielsn

I tried this code:

#![feature(core_intrinsics)]
use std::intrinsics::r#try;

fn main() {
    unsafe {
        r#try(
            |_a: *mut u8| panic!("foo"),
            std::ptr::null_mut(),
            |_a: *mut u8, _b: *mut u8| println!("bar"),
        );
    }
}

using the following command line invocation:

rmc try.rs

with RMC version: 1.53

I expected to see this happen: It compiled

Instead, this happened: explanation
Crashed with an unimplemented on this construct

Activity

  1. added
    [C] Bug
    on Jun 29, 2021
  2. avanhatt commented on Jul 13, 2021

    @avanhatt
    Contributor

    Also used in a Rust UI test:

    src/test/ui/functions-closures/closure_to_fn_coercion-expected-types.rs

    // run-pass
    #![allow(unused_variables)]
    // Ensure that we deduce expected argument types when a `fn()` type is expected (#41755)
    
    fn foo(f: fn(Vec<u32>) -> usize) { }
    
    fn main() {
        foo(|x| x.len())
    }
  3. added
    [C] Feature / Enhancement
    and removed
    [C] Bug
    on Jan 4, 2022
  4. zhassan-aws commented on Mar 15, 2022

    @zhassan-aws
    Contributor

    The examples no longer crash, but keeping the issue open to track adding support for PointerCast::ClosureFnPointer.

  5. YoshikiTakashima commented on Sep 7, 2022

    @YoshikiTakashima
    Contributor

    4/5 tests in prost-types failing with this issue.

    Verification failed for - datetime::tests::check_timestamp_parse_to_string_roundtrip
    Verification failed for - datetime::tests::check_duration_parse_to_string_roundtrip
    Verification failed for - tests::check_system_time_roundtrip
    Verification failed for - tests::check_duration_roundtrip
    Complete - 1 successfully verified harnesses, 4 failures, 5 total.
    
  6. added
    T-High Priority
    on Oct 26, 2022
  7. added
    [E] Unsupported Construct
    on Nov 14, 2022
  8. self-assigned this
    on Nov 15, 2022
  9. celinval commented on Nov 18, 2022

    @celinval
    Contributor

    It looks like rustc reify the closure into FnOnce and pass the pointer to the call_once() implementation. Since this function doesn't capture anything, it doesn't pass Self as a parameter. We need to implement the reification.

  10. moved this to In Progress in Kani 0.16on Nov 28, 2022
  11. rod-chapman commented on Dec 13, 2022

    @rod-chapman

    I also get this unimplemented feature reported on s2n-quic/quic/s2n-quic-core/src/counter.rs

  12. YoshikiTakashima commented on Dec 16, 2022

    @YoshikiTakashima
    Contributor

    @celinval Are you taking this on before Jan'23? I'm thinking of taking a stab at this issue since it looks pretty severe for prost-types.

    P.S. 2023-01-06: No progress on this one. I got it drop self but have not found a way to codegen that function so kani still fails to verify.

  13. added
    T-User
    on Jan 4, 2023
  14. added this to the Maintenance milestone on Jan 5, 2023
  15. celinval commented on Jan 6, 2023

    @celinval
    Contributor

    @celinval Are you taking this on before Jan'23? I'm thinking of taking a stab at this issue since it looks pretty severe for prost-types.

    P.S. 2023-01-06: No progress on this one. I got it drop self but have not found a way to codegen that function so kani still fails to verify.

    Ok. Let me take a look.

  16. moved this to In Progress in Kani 2023-01-23on Jan 17, 2023
  17. moved this from In Progress to Done in Kani 2023-01-23on Jan 19, 2023
  18. moved this from In Progress to Done in Kani 0.16on Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

T-High PriorityT-User[C] Feature / Enhancement[E] Unsupported Construct

Type

No type

Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions