Skip to content

Commit c0c6d42

Browse files
committed
support both trait and non-trail associated declaration
1 parent b8005bf commit c0c6d42

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

compiler/rustc_builtin_macros/src/autodiff.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,12 @@ mod llvm_enzyme {
217217
ast::StmtKind::Item(iitem) => extract_item_info(iitem),
218218
_ => None,
219219
},
220-
Annotatable::AssocItem(assoc_item, Impl { of_trait: false }) => {
221-
match &assoc_item.kind {
222-
ast::AssocItemKind::Fn(box ast::Fn { sig, ident, .. }) => {
223-
Some((assoc_item.vis.clone(), sig.clone(), ident.clone()))
224-
}
225-
_ => None,
220+
Annotatable::AssocItem(assoc_item, Impl { .. }) => match &assoc_item.kind {
221+
ast::AssocItemKind::Fn(box ast::Fn { sig, ident, .. }) => {
222+
Some((assoc_item.vis.clone(), sig.clone(), ident.clone()))
226223
}
227-
}
224+
_ => None,
225+
},
228226
_ => None,
229227
}) else {
230228
dcx.emit_err(errors::AutoDiffInvalidApplication { span: item.span() });
@@ -365,7 +363,7 @@ mod llvm_enzyme {
365363
}
366364
Annotatable::Item(iitem.clone())
367365
}
368-
Annotatable::AssocItem(ref mut assoc_item, i @ Impl { of_trait: false }) => {
366+
Annotatable::AssocItem(ref mut assoc_item, i @ Impl { .. }) => {
369367
if !assoc_item.attrs.iter().any(|a| same_attribute(&a.kind, &attr.kind)) {
370368
assoc_item.attrs.push(attr);
371369
}

0 commit comments

Comments
 (0)