Skip to content

Commit 8adf03f

Browse files
committed
Fix dangling implicit derives
1 parent 27eebb4 commit 8adf03f

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](https://semver.org/).
77

88
## [Unreleased]
9+
- Fix dangling implicit derives
910

1011
## [v0.28.0] - 2022-12-25
1112

src/generate/peripheral.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ fn compare_this_against_prev(
859859
Ok(None)
860860
}
861861

862-
/// Compare the given type name against previous regexs, then inspect fields
862+
/// Compare previous type names against the given regex, then inspect fields
863863
fn compare_prev_against_this(
864864
reg: &MaybeArray<RegisterInfo>,
865865
ty_name: &str,
@@ -913,6 +913,21 @@ fn compare_prev_against_this(
913913
}
914914
}
915915
}
916+
if let DeriveInfo::Implicit(my_rpath) = &my_derive_info {
917+
match prev_derive_info {
918+
DeriveInfo::Implicit(their_rpath) => {
919+
if their_rpath.name == ty_name {
920+
(_, *their_rpath) = find_root(&my_rpath.name, path, index)?;
921+
}
922+
}
923+
DeriveInfo::Explicit(their_rpath) => {
924+
if their_rpath.name == ty_name {
925+
(_, *their_rpath) = find_root(&my_rpath.name, path, index)?;
926+
}
927+
}
928+
_ => {}
929+
}
930+
}
916931
}
917932
}
918933
Ok(my_derive_info)

0 commit comments

Comments
 (0)