-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Type parameters on statics #10798
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
Comments
This is...basically identical to writing
except that you don't need the In general I'd say it's not "possible" in the sense of |
Closing as impossible, re-open if you disagree. |
Out of curiousity, could this be implemented by monomorphising statics like we monomorphise functions? i.e. |
@huonw that's exactly what the C++ proposal does (see link in OP). I don't know whether there's compelling use cases as of yet -- it took C++ until now to get around to wanting them, and their templates and constexprs are much more sophisticated than Rust's -- but I think it's a reasonable idea. |
One instance where it would be useful would be making a static initialiser for |
@nikomatsakis One issue is you can't pattern match on function calls. :( |
Yes, I suppose we could monomorphize on statics, I'll reopen. I was lacking in vision. |
A real use case, not quite the same but probably requiring similar things, would be |
Issues of this kind now belong in the RFC repo, so closing. |
Similar to rust-lang/rfcs#2130 |
…r=Jarcho Don't suggest unnameable types in `box_default`, `let_underscore_untyped` changelog: [`box_default`], [`let_underscore_untyped`]: Don't suggest unnameable types
Would this be possible?
I guess it would be less useful than the C++14 proposal seeing as our constexprs are currently so limited.
The text was updated successfully, but these errors were encountered: