Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PointerCast::ClosureFnPointer is unimplemented #274

Closed
Tracked by #2107
danielsn opened this issue Jun 29, 2021 · 7 comments · Fixed by #2124
Closed
Tracked by #2107

PointerCast::ClosureFnPointer is unimplemented #274

danielsn opened this issue Jun 29, 2021 · 7 comments · Fixed by #2124
Assignees
Labels
[C] Feature / Enhancement A new feature request or enhancement to an existing feature. [E] Unsupported Construct Add support to an unsupported construct T-High Priority Tag issues that have high priority T-User Tag user issues / requests
Milestone

Comments

@danielsn
Copy link
Contributor

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

@danielsn danielsn added the [C] Bug This is a bug. Something isn't working. label Jun 29, 2021
@avanhatt
Copy link
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())
}

@adpaco-aws adpaco-aws added [C] Feature / Enhancement A new feature request or enhancement to an existing feature. Type: unimplemented and removed [C] Bug This is a bug. Something isn't working. labels Jan 4, 2022
@zhassan-aws
Copy link
Contributor

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

@YoshikiTakashima
Copy link
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.

@adpaco-aws adpaco-aws added the T-High Priority Tag issues that have high priority label Oct 26, 2022
@tedinski tedinski added the [E] Unsupported Construct Add support to an unsupported construct label Nov 14, 2022
@celinval celinval self-assigned this Nov 15, 2022
@celinval
Copy link
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.

@rod-chapman
Copy link

rod-chapman commented Dec 13, 2022

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

@YoshikiTakashima
Copy link
Contributor

YoshikiTakashima commented Dec 16, 2022

@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.

@celinval celinval added the T-User Tag user issues / requests label Jan 4, 2023
@celinval celinval added this to the Maintenance milestone Jan 5, 2023
@celinval
Copy link
Contributor

celinval commented Jan 6, 2023

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Feature / Enhancement A new feature request or enhancement to an existing feature. [E] Unsupported Construct Add support to an unsupported construct T-High Priority Tag issues that have high priority T-User Tag user issues / requests
Projects
No open projects
Status: Done
Status: Done
Development

Successfully merging a pull request may close this issue.

8 participants