-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
allow const generics in const fn #71109
Conversation
@bors r+ |
📌 Commit 50eb397 has been approved by |
@bors r- This was a deliberate decision. The interactions with |
/// as this is tantamount to allowing compile-time dependent typing. | ||
/// | ||
/// FIXME(const_generics): Is this really true / necessary? Discuss with @varkor. | ||
/// At any rate, the restriction feels too syntactic. Consider moving it to e.g. typeck. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could certainly move it elsewhere, but there are definitely still concerns with its interactions with const fn
. At any rate, I don't see that there's any urgent need to combine the two features at present anyway.
@varkor I've never heard of this and it doesn't make sense to me. You can already do everything struct Foo<const X: u32, const Y: u32>;
impl<const X: u32, const Y: u32> Foo<X, Y> {
const OUTPUT: u32 = X + Y;
} |
This was discussed on Discord during implementation; I may be able to find a link if Discord has recorded this much history. I need to think about the example, as I haven't thought about this in a long time. |
(We're discussing this on Zulip. If it's a false alarm, I'll re-approve shortly.) |
After discussing this, we agreed that allowing this case should not be a concern: I was worrying about calling @bors r=eddyb |
📌 Commit 50eb397 has been approved by |
Rollup of 4 pull requests Successful merges: - rust-lang#70654 (Explain how to work with subtree) - rust-lang#71092 (Remove some usage of `DUMMY_HIR_ID`) - rust-lang#71103 (Add test case for type aliasing `impl Sized`) - rust-lang#71109 (allow const generics in const fn) Failed merges: r? @ghost
This was explicitly forbidden before. As we were unable to think of a reason
why this should still be the case, this check has been removed.
r? @eddyb
cc @varkor @Centril