Uh oh!
There was an error while loading. Please reload this page.
Do not allow const generics to depend on type parameters - #60284
Conversation
rust-highfive
commented
Apr 25, 2019
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
cramertj
commented
Apr 25, 2019
@bors r+ |
bors
commented
Apr 25, 2019
📌 Commit 908a639 has been approved by |
See #60286 for the follow up. |
…=cramertj Do not allow const generics to depend on type parameters Fixesrust-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).
Pratyush
commented
Apr 25, 2019
Is there a type theoretic reason why we want to disallow this? |
varkor
commented
Apr 25, 2019
@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.
Pratyush
commented
Apr 25, 2019
Ahh I see the structural match requirement now. Thanks! |
varkor
commented
Apr 26, 2019
@bors r=cramertj |
bors
commented
Apr 26, 2019
📌 Commit 6d7c794 has been approved by |
…=cramertj Do not allow const generics to depend on type parameters Fixesrust-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? |
varkor
commented
Oct 21, 2020
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).