immunant / c2rust

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

analyze: bad rewrite of derive(Clone) #952

Closed spernsteiner closed 1 year ago

spernsteiner commented 1 year ago

Input:

#[derive(Clone)]
struct Foo {
    x: i32,
}

Output:

#[derive(Foo)]
struct Foo {
    x: i32,
}

Notice derive(Clone) has been replaced with derive(Foo), which is bogus.

We previously had some logic to suppress rewrites coming from derive-generated functions, but this seems not to work any more.