-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Do not allow const generics to depend on type parameters #60284
Conversation
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
@bors r+ |
📌 Commit 908a639 has been approved by |
See #60286 for the follow up. |
…=cramertj Do not allow const generics to depend on type parameters Fixes rust-lang#60264. In https://github.com/rust-lang/rust/pull/58191/files/b534cf992d0189032207f395c27ed092c89b40c7#diff-aeb0880081a991f34aef2ab889e1fb7a, it was suggested that there might be a better place for this error, but as this bug already affects stable, it's probably worth merging this now, and refactoring afterwards (I can open an issue for this).
Is there a type theoretic reason why we want to disallow this? |
@Pratyush: no, we're just being conservative at this point with the types we allow to be used in const generics (see the RFC for more details). I would expect this constraint to be relaxed in the future. |
This comment has been minimized.
This comment has been minimized.
Ahh I see the structural match requirement now. Thanks! |
@bors r=cramertj |
📌 Commit 6d7c794 has been approved by |
…=cramertj Do not allow const generics to depend on type parameters Fixes rust-lang#60264. In https://github.com/rust-lang/rust/pull/58191/files/b534cf992d0189032207f395c27ed092c89b40c7#diff-aeb0880081a991f34aef2ab889e1fb7a, it was suggested that there might be a better place for this error, but as this bug already affects stable, it's probably worth merging this now, and refactoring afterwards (I can open an issue for this).
Rollup of 12 pull requests Successful merges: - #59734 (Prevent failure in case no space left on device in rustdoc) - #59940 (Set cfg(test) when rustdoc is running with --test option) - #60134 (Fix index-page generation) - #60165 (Add Pin::{into_inner,into_inner_unchecked}) - #60183 (Chalkify: Add builtin Copy/Clone) - #60225 (Introduce hir::ExprKind::Use and employ in for loop desugaring.) - #60247 (Implement Debug for Place using Place::iterate) - #60259 (Derive Default instead of new in applicable lint) - #60267 (Add feature-gate for f16c target feature) - #60284 (Do not allow const generics to depend on type parameters) - #60285 (Do not ICE when checking types against foreign fn) - #60289 (Make `-Z allow-features` work for stdlib features) Failed merges: r? @ghost
Is there a plan to allow const generics to depend on type parameters in the (near) future?
|
Not in the near future, but it's something we'd like to support eventually. It's not in the original RFC, though, so will require some design discussion. |
Fixes #60264. In https://github.com/rust-lang/rust/pull/58191/files/b534cf992d0189032207f395c27ed092c89b40c7#diff-aeb0880081a991f34aef2ab889e1fb7a, it was suggested that there might be a better place for this error, but as this bug already affects stable, it's probably worth merging this now, and refactoring afterwards (I can open an issue for this).