1
Fork 0

Track whether an assoc item is in a trait impl or an inherent impl

This commit is contained in:
Oli Scherer 2025-03-25 09:00:35 +00:00
parent 502d57cb78
commit 7cdc456727
14 changed files with 151 additions and 68 deletions

View file

@ -157,7 +157,7 @@ mod llvm_enzyme {
};
(sig.clone(), false)
}
Annotatable::AssocItem(assoc_item, _) => {
Annotatable::AssocItem(assoc_item, Impl { of_trait: false }) => {
let sig = match &assoc_item.kind {
ast::AssocItemKind::Fn(box ast::Fn { sig, .. }) => sig,
_ => {
@ -296,7 +296,7 @@ mod llvm_enzyme {
}
Annotatable::Item(iitem.clone())
}
Annotatable::AssocItem(ref mut assoc_item, i @ Impl) => {
Annotatable::AssocItem(ref mut assoc_item, i @ Impl { of_trait: false }) => {
if !assoc_item.attrs.iter().any(|a| same_attribute(&a.kind, &attr.kind)) {
assoc_item.attrs.push(attr);
}
@ -327,7 +327,7 @@ mod llvm_enzyme {
kind: assoc_item,
tokens: None,
});
Annotatable::AssocItem(d_fn, Impl)
Annotatable::AssocItem(d_fn, Impl { of_trait: false })
} else {
let mut d_fn =
ecx.item(span, d_ident, thin_vec![d_attr, inline_never], ItemKind::Fn(asdf));