immunant / c2rust

Migrate C code to Rust
https://c2rust.com/
Other
3.91k stars 229 forks source link

rewriter: hypothetical lifetime parameters not added to types in function signatures #921

Closed aneksteind closed 1 year ago

aneksteind commented 1 year ago

For a function signature such as

fn foo<'d>(ra: &'d mut A<'d>, ppd: *mut *mut Data<'d>) {

If hypothetical lifetimes are introduced for ppd: &'h0 &'h1 Data<'d>and Data gets a hypothetical lifetime and updated to Data<'d, 'h2> we'd like the rewriter to generate:

fn foo<'d, 'h0, 'h1, 'h2>(ra: &'d mut A<'d>, ppd: &'h0 &'h1 Data<'d, h2>) {
aneksteind commented 1 year ago

cc @kkysen this is a potential task for you to take on in the next month if you run out of other things to do. otherwise i can get to it when i'm back

kkysen commented 1 year ago

Sure. What's the current behavior of the rewriter?

aneksteind commented 1 year ago

It avoids liftime rewrites for all non-field types

aneksteind commented 1 year ago

I'm working on this, so assigning just myself for the time being