-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Tracking Issue for generic pattern types #136574
Comments
…oxyUwU Prevent generic pattern types from being used in libstd Pattern types should follow the same rules that patterns follow. So a pattern type range must not wrap and not be empty. While we reject such invalid ranges at layout computation time, that only happens during monomorphization in the case of const generics. This is the exact same issue as other const generic math has, and since there's no solution there yet, I put these pattern types behind a separate incomplete feature. These are not necessary for the pattern types MVP (replacing the layout range attributes in libcore and rustc). cc rust-lang#136574 (new tracking issue for the `generic_pattern_types` feature gate) r? `@lcnr` cc `@scottmcm` `@joshtriplett`
…oxyUwU Prevent generic pattern types from being used in libstd Pattern types should follow the same rules that patterns follow. So a pattern type range must not wrap and not be empty. While we reject such invalid ranges at layout computation time, that only happens during monomorphization in the case of const generics. This is the exact same issue as other const generic math has, and since there's no solution there yet, I put these pattern types behind a separate incomplete feature. These are not necessary for the pattern types MVP (replacing the layout range attributes in libcore and rustc). cc rust-lang#136574 (new tracking issue for the `generic_pattern_types` feature gate) r? `@lcnr` cc `@scottmcm` `@joshtriplett`
…oxyUwU Prevent generic pattern types from being used in libstd Pattern types should follow the same rules that patterns follow. So a pattern type range must not wrap and not be empty. While we reject such invalid ranges at layout computation time, that only happens during monomorphization in the case of const generics. This is the exact same issue as other const generic math has, and since there's no solution there yet, I put these pattern types behind a separate incomplete feature. These are not necessary for the pattern types MVP (replacing the layout range attributes in libcore and rustc). cc rust-lang#136574 (new tracking issue for the `generic_pattern_types` feature gate) r? ``@lcnr`` cc ``@scottmcm`` ``@joshtriplett``
Rollup merge of rust-lang#136584 - oli-obk:pattern-types-generic, r=BoxyUwU Prevent generic pattern types from being used in libstd Pattern types should follow the same rules that patterns follow. So a pattern type range must not wrap and not be empty. While we reject such invalid ranges at layout computation time, that only happens during monomorphization in the case of const generics. This is the exact same issue as other const generic math has, and since there's no solution there yet, I put these pattern types behind a separate incomplete feature. These are not necessary for the pattern types MVP (replacing the layout range attributes in libcore and rustc). cc rust-lang#136574 (new tracking issue for the `generic_pattern_types` feature gate) r? ``@lcnr`` cc ``@scottmcm`` ``@joshtriplett``
Hopefully this is the right place to write this. For me the (hard) requirement of pattern types (or similar Rust features) is this to compile and it to not contain a run-time array bound test: type I10 = usize is 0 .. 10;
const fn foo(a: [i32; 10], i: I10) -> i32 {
a[i]
} Other nice to have subfeatures is (using this I10 as an example) the values I10::MIN, I10::MAX, and I10::RANGE (that's a Range, assuming the ID isn't a union of multiple intervals). |
Please avoid using tracking issues for discussions. Tracking issues become unmanageable quickly. There's a dedicated Zulip stream for absolutely anything you want to talk about on pattern types: https://rust-lang.zulipchat.com/#narrow/channel/481660-t-lang.2Fpattern-types |
The feature gate for the issue is
#![feature(generic_pattern_types)]
.About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Discussion comments will get marked as off-topic or deleted.
Repeated discussions on the tracking issue may lead to the tracking issue getting locked.
Use the associated zulip thread for discussions.
Steps
Unresolved Questions
Implementation history
The text was updated successfully, but these errors were encountered: