Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use const fn instead of macro_rules to construct PyMemberDef #1345

Closed
wants to merge 1 commit into from

Conversation

kngwyu
Copy link
Member

@kngwyu kngwyu commented Dec 28, 2020

A tweak for #1342

@davidhewitt
Copy link
Member

I mean, sure, but the compiler can't actually run this code at compile time, because PyCell::<T>::dict_offset (e.g.) isn't const fn. So this might as well be a closure - it'll be called at runtime either way.

@kngwyu
Copy link
Member Author

kngwyu commented Dec 28, 2020

Ah, sorry, now I understand what you said.

@kngwyu kngwyu closed this Dec 28, 2020
@kngwyu
Copy link
Member Author

kngwyu commented Dec 28, 2020

Reopened with #[inline(always)], but I don't have a strong opinion about inline vs macro so rejecting is OK.
EDITED: it seems like that I cannot reopen a PR after force push...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants