Skip to content

Commit ee995a9

Browse files
committed
better error for pyimpl(with)
1 parent 458c4d4 commit ee995a9

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

derive/src/pyclass.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -893,17 +893,17 @@ fn extract_impl_attrs(attr: AttributeArgs) -> std::result::Result<ExtractedImplA
893893
};
894894
if path_eq(&path, "PyRef") {
895895
// special handling for PyRef
896-
withs.push(quote! {
896+
withs.push(quote_spanned! { path.span() =>
897897
PyRef::<Self>::impl_extend_class(ctx, class);
898898
});
899-
with_slots.push(quote! {
899+
with_slots.push(quote_spanned! { path.span() =>
900900
PyRef::<Self>::extend_slots(slots);
901901
});
902902
} else {
903-
withs.push(quote! {
903+
withs.push(quote_spanned! { path.span() =>
904904
<Self as #path>::__extend_py_class(ctx, class);
905905
});
906-
with_slots.push(quote! {
906+
with_slots.push(quote_spanned! { path.span() =>
907907
<Self as #path>::__extend_slots(slots);
908908
});
909909
}
@@ -913,7 +913,7 @@ fn extract_impl_attrs(attr: AttributeArgs) -> std::result::Result<ExtractedImplA
913913
match meta {
914914
NestedMeta::Meta(Meta::Path(path)) => {
915915
if let Some(ident) = path.get_ident() {
916-
flags.push(quote! {
916+
flags.push(quote_spanned! { ident.span() =>
917917
| ::rustpython_vm::slots::PyTpFlags::#ident.bits()
918918
});
919919
} else {

0 commit comments

Comments
 (0)