Skip to content

implement or-patterns for pattern types #139909

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

Merged
merged 6 commits into from
Apr 29, 2025
Merged

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Apr 16, 2025

These are necessary to represent NonZeroI32, as the range for that is ..0 | 1... The rustc_scalar_layout_range_* attributes avoided this by just implementing wraparound and having a single 1..=-1 range effectively. See https://rust-lang.zulipchat.com/#narrow/channel/481660-t-lang.2Fpattern-types/topic/.60or.20pattern.60.20representation.20in.20type.20system/with/504217694 for some background discussion

cc #123646

r? @BoxyUwU

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 16, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 16, 2025

changes to the core type system

cc @compiler-errors, @lcnr

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

changes to the core type system

cc @compiler-errors, @lcnr

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

HIR ty lowering was modified

cc @fmease

Copy link
Member

@BoxyUwU BoxyUwU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if for ty::TyKind::Pat it makes sense to use a general top level Or for this 🤔 Though I don't really have a good idea for how everything will turn out in the end so I guess its fine to just do this for now and figure things out at a later date

@BoxyUwU BoxyUwU added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 28, 2025
@oli-obk
Copy link
Contributor Author

oli-obk commented Apr 28, 2025

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 28, 2025
@oli-obk oli-obk force-pushed the or-patterns branch 2 times, most recently from 3c4edc5 to 5de9ffa Compare April 28, 2025 07:49
@BoxyUwU
Copy link
Member

BoxyUwU commented Apr 29, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 29, 2025

📌 Commit b023856 has been approved by BoxyUwU

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 29, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 29, 2025
Rollup of 7 pull requests

Successful merges:

 - rust-lang#138344 (Enable `reliable_f16_math` on x86)
 - rust-lang#139909 (implement or-patterns for pattern types)
 - rust-lang#140392 (compiletest: Remove the libtest-based executor and its dependency)
 - rust-lang#140400 (PassWrapper: adapt for llvm/llvm-project@d3d856ad8469)
 - rust-lang#140422 (unwind: bump `unwinding` dependency to 0.2.6)
 - rust-lang#140432 (Update documentation for `fn target_config`)
 - rust-lang#140433 (Replace the \01__gnu_mcount_nc to LLVM intrinsic for additional ARM targets)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a20fe8f into rust-lang:master Apr 29, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 29, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 29, 2025
Rollup merge of rust-lang#139909 - oli-obk:or-patterns, r=BoxyUwU

implement or-patterns for pattern types

These are necessary to represent `NonZeroI32`, as the range for that is `..0 | 1..`. The `rustc_scalar_layout_range_*` attributes avoided this by just implementing wraparound and having a single `1..=-1` range effectively. See https://rust-lang.zulipchat.com/#narrow/channel/481660-t-lang.2Fpattern-types/topic/.60or.20pattern.60.20representation.20in.20type.20system/with/504217694 for some background discussion

cc rust-lang#123646

r? `@BoxyUwU`
flip1995 pushed a commit to flip1995/rust that referenced this pull request May 1, 2025
implement or-patterns for pattern types

These are necessary to represent `NonZeroI32`, as the range for that is `..0 | 1..`. The `rustc_scalar_layout_range_*` attributes avoided this by just implementing wraparound and having a single `1..=-1` range effectively. See https://rust-lang.zulipchat.com/#narrow/channel/481660-t-lang.2Fpattern-types/topic/.60or.20pattern.60.20representation.20in.20type.20system/with/504217694 for some background discussion

cc rust-lang#123646

r? `@BoxyUwU`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants