lang-team icon indicating copy to clipboard operation
lang-team copied to clipboard

Deref patterns

Open nikomatsakis opened this issue 4 years ago • 9 comments

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

  • Lead: chorman0773
  • Lang-team liaison: @cramertj
  • Charter
  • Repository - https://github.com/rust-lang/project-deref-patterns
  • Zulip stream #project-deref-patterns

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 avatar Mar 09 '21 17:03 nikomatsakis

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.

chorman0773 avatar Apr 07 '21 12:04 chorman0773

The discussion at https://internals.rust-lang.org/t/pre-pre-rfc-match-ergonomics-for-container-types-restricted-method-calls-in-patterns/13371 was fairly extensive as well.

estebank avatar Apr 14 '21 16:04 estebank

@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.

nikomatsakis avatar Apr 14 '21 17:04 nikomatsakis

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 avatar May 14 '21 12:05 chorman0773

Progress Updates:

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

chorman0773 avatar Jul 05 '21 22:07 chorman0773

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, https://github.com/rust-lang/rust/issues/87121.

chorman0773 avatar Oct 05 '21 23:10 chorman0773

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

safinaskar avatar Aug 03 '22 16:08 safinaskar

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 avatar Mar 09 '24 16:03 Nadrieril

@traviscross is taking over the liaison role!

Nadrieril avatar Mar 20 '24 20:03 Nadrieril