-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
const
requirement breaks some use cases
#44
Comments
@mathstuf It looks like we've encountered similar problem in cucumber crate. Possible workaround may be declaring |
Hrm, that doesn't seem so easy in my case since I am not using procedural macros and instead either have to expose structure innards for literal definitions or have an API which just can't take a |
The fn pointer restriction in const fn signatures is rarely problematic because in struct fields they're allowed, so the only necessary change is to package them into a struct. I put up https://gitlab.kitware.com/utils/rust-git-checks/-/merge_requests/179/diffs showing the change. |
Thanks! I've just merged it. |
@dtolnay I was using Was the change done to remove the type parameter from |
See this commit for the rationale: b853350 |
Sorry, the PR has the explanation: #43 |
I see. |
Unfortunately, this ends up breaking some use cases that I don't think are problematic. Maybe this needs some
const fn
enhancements or there's some clever way around it.The problem I have is that
fn
pointers cannot be used, so I cannot pass in a monomorphized generic function pointer to the constructor of the type in the registry. Since this is a generic function and the types which are submitted to the inventory aren't known to the consumer of it (otherwise, there'd be no point of the inventory!), I'm not sure how to best hide this monomorphization step.Crate code in question: https://gitlab.kitware.com/utils/rust-git-checks/-/blob/master/git-checks-config/src/registry.rs
The text was updated successfully, but these errors were encountered: