deref patterns: bare-bones feature gate and typechecking by Nadrieril · Pull Request #122222 · rust-lang/rust (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation21 Commits1 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
I am restarting the deref patterns experimentation. This introduces a feature gate under the lang-team experimental feature process, with @cramertj as lang-team liaison (it's been a while though, you still ok with this @cramertj?). Tracking issue: #87121.
This is the barest-bones implementation I could think of:
- explicit syntax, reusing
box <pat>
because that saves me a ton of work; - use
Deref
as a marker trait (instead of a yet-to-designDerefPure
); - no support for mutable patterns with
DerefMut
for now; - MIR lowering will come in the next PR. It's the trickiest part.
My goal is to let us figure out the MIR lowering part, which might take some work. And hopefully get something working for std types soon.
This is in large part salvaged from @fee1-dead's #119467.
rustbot added S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
This comment has been minimized.
rustbot 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
pls squash as well, ty
regarding the lang team experiment, it may need a new liaison since @cramertj is no longer on T-lang
Ok, I've asked around for a new lang-team liaison
Please, add more tests. I want to see how this is supposed to work. In particular I'd like to see this code in tests:
let a = Rc::new(vec![0]); let x = match a { box x => x, }
let a = Rc::new(vec![0]); let x: &Vec = match &a { box x => x, }
As well as I understand the first example should not compile (because you cannot move out of Rc
), but the second - should
These test are not yet possible, because patterns are not lowered correctly to MIR. This is the very first beginnings of implementing the feature, more tests will come in later PRs. (I've just added your examples to my next PR, thank you for them. You are correct about how they should work).
📌 Commit bf7951d has been approved by compiler-errors
It is now in the queue for this repository.
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-author
Status: This is awaiting some action (such as code changes or more information) from the author.
labels
Actually
@bors r-
this needs rebasing
bors 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-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
labels
Co-authored-by: Deadbeef ent3rm4n@gmail.com
📌 Commit 120d357 has been approved by compiler-errors
It is now in the queue for this repository.
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-author
Status: This is awaiting some action (such as code changes or more information) from the author.
labels
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
…r=compiler-errors
deref patterns: bare-bones feature gate and typechecking
I am restarting the deref patterns experimentation. This introduces a feature gate under the lang-team experimental feature process, with @cramertj
as lang-team liaison (it's been a while though, you still ok with this @cramertj?).
Tracking issue: rust-lang#87121.
This is the barest-bones implementation I could think of:
- explicit syntax, reusing
box <pat>
because that saves me a ton of work; - use
Deref
as a marker trait (instead of a yet-to-designDerefPure
); - no support for mutable patterns with
DerefMut
for now; - MIR lowering will come in the next PR. It's the trickiest part.
My goal is to let us figure out the MIR lowering part, which might take some work. And hopefully get something working for std types soon.
This is in large part salvaged from @fee1-dead's
rust-lang#119467.
r? @compiler-errors
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request
…r=compiler-errors
deref patterns: bare-bones feature gate and typechecking
I am restarting the deref patterns experimentation. This introduces a feature gate under the lang-team experimental feature process, with @cramertj
as lang-team liaison (it's been a while though, you still ok with this @cramertj?).
Tracking issue: rust-lang#87121.
This is the barest-bones implementation I could think of:
- explicit syntax, reusing
box <pat>
because that saves me a ton of work; - use
Deref
as a marker trait (instead of a yet-to-designDerefPure
); - no support for mutable patterns with
DerefMut
for now; - MIR lowering will come in the next PR. It's the trickiest part.
My goal is to let us figure out the MIR lowering part, which might take some work. And hopefully get something working for std types soon.
This is in large part salvaged from @fee1-dead's
rust-lang#119467.
r? @compiler-errors
bors added a commit to rust-lang-ci/rust that referenced this pull request
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
…r=compiler-errors
deref patterns: bare-bones feature gate and typechecking
I am restarting the deref patterns experimentation. This introduces a feature gate under the lang-team experimental feature process, with @cramertj
as lang-team liaison (it's been a while though, you still ok with this @cramertj?).
Tracking issue: rust-lang#87121.
This is the barest-bones implementation I could think of:
- explicit syntax, reusing
box <pat>
because that saves me a ton of work; - use
Deref
as a marker trait (instead of a yet-to-designDerefPure
); - no support for mutable patterns with
DerefMut
for now; - MIR lowering will come in the next PR. It's the trickiest part.
My goal is to let us figure out the MIR lowering part, which might take some work. And hopefully get something working for std types soon.
This is in large part salvaged from @fee1-dead's
rust-lang#119467.
r? @compiler-errors
This was referenced
Mar 21, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request
…iaskrgr
Rollup of 8 pull requests
Successful merges:
- rust-lang#122222 (deref patterns: bare-bones feature gate and typechecking)
- rust-lang#122358 (Don't ICE when encountering bound regions in generator interior type)
- rust-lang#122696 (Add bare metal riscv32 target.)
- rust-lang#122773 (make "expected paren or brace" error translatable)
- rust-lang#122795 (Inherit
RUSTC_BOOTSTRAP
when testing wasm) - rust-lang#122799 (Replace closures with
_
when suggesting fully qualified path for method call) - rust-lang#122801 (Fix misc printing issues in emit=stable_mir)
- rust-lang#122806 (Make
type_ascribe!
not a built-in)
Failed merges:
- rust-lang#122771 (add some comments to hir::ModuleItems)
r? @ghost
@rustbot
modify labels: rollup
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
Rollup merge of rust-lang#122222 - Nadrieril:deref-pat-feature-gate, r=compiler-errors
deref patterns: bare-bones feature gate and typechecking
I am restarting the deref patterns experimentation. This introduces a feature gate under the lang-team experimental feature process, with @cramertj
as lang-team liaison (it's been a while though, you still ok with this @cramertj?).
Tracking issue: rust-lang#87121.
This is the barest-bones implementation I could think of:
- explicit syntax, reusing
box <pat>
because that saves me a ton of work; - use
Deref
as a marker trait (instead of a yet-to-designDerefPure
); - no support for mutable patterns with
DerefMut
for now; - MIR lowering will come in the next PR. It's the trickiest part.
My goal is to let us figure out the MIR lowering part, which might take some work. And hopefully get something working for std types soon.
This is in large part salvaged from @fee1-dead's
rust-lang#119467.
r? @compiler-errors
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
…r=Nadrieril
Implement macro-based deref!() syntax for deref patterns
Stop using box PAT
syntax for deref patterns, and instead use a perma-unstable macro.
Blocked on rust-lang#122222
r? @Nadrieril
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
Rollup merge of rust-lang#122793 - compiler-errors:deref-pat-syntax, r=Nadrieril
Implement macro-based deref!() syntax for deref patterns
Stop using box PAT
syntax for deref patterns, and instead use a perma-unstable macro.
Blocked on rust-lang#122222
r? @Nadrieril
Labels
`#![feature(deref_patterns)]`
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Relevant to the compiler team, which will review and decide on the PR/issue.