-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
impl traits in consts through const fns are allowed but shouldn't #87277
Comments
@spastorino could you please clarify why this should be forbidden? Seems like a nice feature to have, keeping in mind that there is a lot of anonymous types usages in Rust code. |
Ohh sorry for the lack of explanation, to be clear, this should be supported at some point. We were in the middle of removing impl traits in bindings for min_taits and the example in this issue is part of that combo that we were removing. In that sense is that it shouldn't work, because we were removing it's support. At some point when let bindings are reintroduced this example should work :). Sorry for the lack of context provided. @oli-obk maybe you want to add a bit more info here. |
We are trying to avoid any and all mentions of traits other than |
Are there any particularly challenging caveats here or does this just need const expressions to have a "type filter" that forbids TAIT types? |
well.. I have recently come around to "just allowing trait bounds" in const stuff and requiring explicit const bounds (placeholder syntax |
I guess that my main reason for asking is that this seems like the biggest blocker for getting TAIT stabilised in at least a minimal form, and I'm mostly looking for what needs to be done before I can have nameable, zero-sized function types, which requires TAIT for the moment. Am currently trying to figure out whether it would be easier to get TAIT stabilised, or figure out some feature to add named function types that doesn't require TAIT and implementing that. Definitely leaning toward the former, but mostly just wanna figure out the details. |
I would presume that TAIT in const (without the ability to call methods on it) would be faster to stabilize, since it's already fully implemented and "just" needs stabilization. |
We have stabilized Closing as there is no further action required here |
The following code compiles after #87141 but shouldn't
The text was updated successfully, but these errors were encountered: