Skip to content
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

Deref patterns #88

Open
nikomatsakis opened this issue Mar 9, 2021 · 9 comments
Open

Deref patterns #88

nikomatsakis opened this issue Mar 9, 2021 · 9 comments
Assignees
Labels
lang-initiative An active lang team initiative T-lang
Projects

Comments

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Mar 9, 2021

Summary

  • Allow pattern matching through types that impl Deref or DerefMut.
  • Limited to types in stdlib where we can manually annotate them as pure for now.

Info

What is this issue?

This issue represents an active project group. It is meant to be used for
the group to post updates to the lang team (and others) in a lightweight
fashion. Please do not use the comments here for discussion, that should be kept
in the Zulip stream (discussion comments here will be marked as off-topic).

@nikomatsakis nikomatsakis added lang-initiative An active lang team initiative T-lang labels Mar 9, 2021
@nikomatsakis nikomatsakis added this to Active Projects (Design) in Lang Team Mar 9, 2021
@chorman0773
Copy link
Contributor

Update on Current Status:

  • The most recent topic of discussion has been on the stdlib types list, with no current resolution. Syntax discussions have not begun as of yet.
  • Syntax Discussions could possibly benefit from a design meeting, though I'd probably want to start the discussion on the zulip stream first.
  • Currently no concerns that I can see.

@estebank
Copy link

@nikomatsakis
Copy link
Contributor Author

@chorman0773

Notes from the planning meeting today:

  • Sounds great!
  • It would be nice to see the list of stdlib types, and if there are open questions about certain types, to describe those.

@chorman0773
Copy link
Contributor

Update:

  • Limited Progress has been made since last update. The syntax discussion has been opened, but has seen limited progress.. It may be good for that to move to a design meeting.
  • The list of stdlib types last brought for consideration was Box, Arc, Rc, Vec, and String (as well as Pin<P> where P is one of the previous).

@chorman0773
Copy link
Contributor

Progress Updates:

  • Currently limited progress has been made. Syntax and stdlib types discussion are open in the same place as last update.

@chorman0773
Copy link
Contributor

Progress Update:

  • Since the last update, implementation work has begun (though limited progress has been made on that). It will initially use the "no syntax" option, and the work with the types presented above. A tracking issue has also been opened, Tracking issue: deref patterns rust#87121.

@safinaskar
Copy link

For those who cannot wait: my proc macro crate with deref patterns: https://crates.io/crates/match_deref

Manishearth added a commit to Manishearth/rust that referenced this issue Nov 16, 2022
…s, r=compiler-errors

Minimal implementation of implicit deref patterns for Strings

cc `@compiler-errors` `@BoxyUwU` rust-lang/lang-team#88 rust-lang#87121

~~I forgot to add a feature gate, will do so in a minute~~ Done
bors added a commit to rust-lang-ci/rust that referenced this issue Nov 20, 2022
… r=compiler-errors

Minimal implementation of implicit deref patterns for Strings

cc `@compiler-errors` `@BoxyUwU` rust-lang/lang-team#88 rust-lang#87121

~~I forgot to add a feature gate, will do so in a minute~~ Done
flip1995 pushed a commit to flip1995/rust-clippy that referenced this issue Nov 21, 2022
…er-errors

Minimal implementation of implicit deref patterns for Strings

cc `@compiler-errors` `@BoxyUwU` rust-lang/lang-team#88 #87121

~~I forgot to add a feature gate, will do so in a minute~~ Done
RalfJung pushed a commit to RalfJung/miri that referenced this issue Nov 27, 2022
…er-errors

Minimal implementation of implicit deref patterns for Strings

cc `@compiler-errors` `@BoxyUwU` rust-lang/lang-team#88 #87121

~~I forgot to add a feature gate, will do so in a minute~~ Done
thomcc pushed a commit to tcdi/postgrestd that referenced this issue Feb 10, 2023
…er-errors

Minimal implementation of implicit deref patterns for Strings

cc `@compiler-errors` `@BoxyUwU` rust-lang/lang-team#88 #87121

~~I forgot to add a feature gate, will do so in a minute~~ Done
@Nadrieril
Copy link
Member

I'm restarting work on this feature. I understand @cramertj isn't on T-lang anymore; would someone on T-lang be willing to take over the liaison role?

@Nadrieril
Copy link
Member

@traviscross is taking over the liaison role!

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 21, 2024
…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](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md) process, with [`@cramertj` as lang-team liaison](rust-lang/lang-team#88) (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-design `DerefPure`);
- 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 issue Mar 21, 2024
…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](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md) process, with [``@cramertj`` as lang-team liaison](rust-lang/lang-team#88) (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-design `DerefPure`);
- 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 issue Mar 21, 2024
…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](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md) process, with [```@cramertj``` as lang-team liaison](rust-lang/lang-team#88) (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-design `DerefPure`);
- 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 issue Mar 21, 2024
…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](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md) process, with [````@cramertj```` as lang-team liaison](rust-lang/lang-team#88) (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-design `DerefPure`);
- 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````
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 21, 2024
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](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md) process, with [````@cramertj```` as lang-team liaison](rust-lang/lang-team#88) (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-design `DerefPure`);
- 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````
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang-initiative An active lang team initiative T-lang
Projects
Status: Experimental
Lang Team
Active Projects (Design)
Development

No branches or pull requests

6 participants