immunant / c2rust

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

rewriter: hypothetical lifetimes do not get added to type-alias types #959

Open aneksteind opened 1 year ago

aneksteind commented 1 year ago
type Tuple<'a> = (*mut i32, &'a i32);
struct TupleHypo<'a> {
    // CHECK-DAG: x: Tuple<'a>
    x: Tuple<'a>
}

gets rewritten to

type Tuple<'a> = (*mut i32, &'a i32);
struct TupleHypo<'a,'h7> {
    // (FileCheck directive omitted)
    x: (&i32, &'a i32)
}

Ideally we'd have support for rewriting the alias itself as well, but the stop gap that replace rewrites with the MIR type should at least be correct

kkysen commented 1 year ago

By the way, what do you mean by Hypo in the struct names? Hypothetical lifetime?

aneksteind commented 1 year ago

Yes