Given this input file, "derive.rs":
#![allow(
dead_code,
non_camel_case_types,
non_snake_case,
non_upper_case_globals,
unused_assignments,
unused_mut
)]
#[derive(Copy, Clone)]
#[repr(C)]
pub struct S {}
running c2rust-refactor --rewrite-mode diff remove_unused_labels -- derive.rs produces:
--- old/derive.rs
+++ new/derive.rs
@@ -7,7 +7,7 @@
unused_mut
)]
-#[derive(Copy, Clone)]
-#[repr(C)]
+
+#[repr(C)]#[derive(Copy, Clone)]
pub struct S {}
This appears to be an issue with roundtripping attributes, as it also occurs with various other transforms that aren't supposed to modify attributes, such as test_one_plus_one. This adds lots of noise to the diffs generated and makes it harder to identify what transforms are actually intending to change.
This change appears to only occur if the derive attribute precedes the repr one.
Given this input file, "derive.rs":
running
c2rust-refactor --rewrite-mode diff remove_unused_labels -- derive.rsproduces:This appears to be an issue with roundtripping attributes, as it also occurs with various other transforms that aren't supposed to modify attributes, such as
test_one_plus_one. This adds lots of noise to the diffs generated and makes it harder to identify what transforms are actually intending to change.This change appears to only occur if the
deriveattribute precedes thereprone.