deref patterns: bare-bones feature gate and typechecking by Nadrieril · Pull Req...
source link: https://github.com/rust-lang/rust/pull/122222
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Conversation
Contributor
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.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK