c2rust-analyze mistakenly rewrites Clone to &(Clone) in the two structs' #[derive(...)] attributes. I suspect it's trying to rewrite x to &x inside the Clone impl, but is applying that rewrite in the wrong place due to the way derive(Clone) sets up the spans on the code it generates. If this is right, then we should suppress rewrites in derive-generated code (maybe by looking at the macro-expansion info in the expr/statement spans) to prevent this issue.
This filecheck test currently fails:
c2rust-analyze
mistakenly rewritesClone
to&(Clone)
in the two structs'#[derive(...)]
attributes. I suspect it's trying to rewritex
to&x
inside the Clone impl, but is applying that rewrite in the wrong place due to the wayderive(Clone)
sets up the spans on the code it generates. If this is right, then we should suppress rewrites inderive
-generated code (maybe by looking at the macro-expansion info in the expr/statement spans) to prevent this issue.