-
Notifications
You must be signed in to change notification settings - Fork 9
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
user defined const param type backcompat #6
Comments
We already have such behaviour for |
hm, I guess I am a bit concerned because that interaction is a lot less obvious as I think many types aren't be intended to be used as const params. If there's a good way to avoid these issues I would prefer doing so. |
When you add a ptr to your struct you can also:
but that's not an option with this I think |
we could add an additional |
I'm surprised I can't find previous discussion on this topic: this is presumably a problem for anything involving structural equality, not just const generics. Having a new marker trait seems like the only plausible solution here. |
had some further discussion about this on zulip: https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/meeting.202021-03-02/near/228441502 The consensus seems to be that we want to add an additional trait to opt into allowing types as const parameters as proposed in #6 (comment) Still open is how exactly this interacts with structural match, it probably makes sense to try and get some conclusions from rust-lang/rust#74446. Maybe we can try and summarize the current status there and then talk about the remaining questions in a sync meeting? |
closing this after summarizing the results in #34 |
allowing a type to be used as a const parameter type adds some additional backcompat concerns.
For example adding raw/function pointer fields is suddenly a breaking change because the type stops being structural match.
How do we want to deal with this? Require the user to explicitly opt in, require all fields to be public (disqualifies
NonZeroT
), or something else?The text was updated successfully, but these errors were encountered: