Skip to content

Commit

Permalink
Small tweaks to make CoreFoundation work
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Dec 9, 2024
1 parent 9fb2da1 commit 3a565e0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion crates/header-translator/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ impl Location {
}

pub fn assert_file(&self, file_name: &str) {
assert_eq!(self.file_name(), Some(file_name));
assert_eq!(
self.file_name(),
Some(file_name),
"expected {self:?} to be in {file_name:?}"
);
}
}

Expand Down
3 changes: 2 additions & 1 deletion crates/header-translator/src/rust_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1725,7 +1725,8 @@ impl Ty {
FormatterFn(move |f| match self {
Self::Primitive(Primitive::NSInteger) => write!(f, "#[repr(isize)] // NSInteger"),
Self::Primitive(Primitive::NSUInteger) => write!(f, "#[repr(usize)] // NSUInteger"),
_ => panic!("invalid closed enum repr"),
Self::Primitive(Primitive::U32) => write!(f, "#[repr(u32)]"),
_ => panic!("invalid closed enum repr: {self:?}"),
})
}

Expand Down
7 changes: 6 additions & 1 deletion crates/header-translator/src/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,12 @@ fn parse_fn_param_children(entity: &Entity<'_>, context: &Context<'_>) {
immediate_children(entity, |entity, _span| match entity.get_kind() {
EntityKind::UnexposedAttr => {
if let Some(attr) = UnexposedAttr::parse(&entity, context) {
error!(?attr, "unknown attribute on fn param");
match attr {
UnexposedAttr::NoEscape => {
// TODO: Use this if mapping `fn + context ptr` to closure.
}
_ => error!(?attr, "unknown attribute on fn param"),
}
}
}
EntityKind::ObjCClassRef
Expand Down

0 comments on commit 3a565e0

Please sign in to comment.