rust-lang / lang-team

Home of the Rust lang team
http://lang-team.rust-lang.org/
Apache License 2.0
202 stars 48 forks source link

Design meeting: Deref Patterns #260

Closed Nadrieril closed 5 months ago

Nadrieril commented 6 months ago

Summary

We would like to be able to match through the smart pointers of the standard library ergonomically:

let x: Option<Rc<bool>> = ...;
match x {
    Some(deref true) => ...,
    Some(x) => ...,
    None => ...,
}

There are a few design questions around this, most importantly syntax-wise. I prepared a design document with two specific proposals; I would like to discuss them.

Concrete questions I would like answered:

Background reading

About this issue

This issue corresponds to a lang-team design meeting proposal. It corresponds to a possible topic of discussion that may be scheduled for deeper discussion during one of our design meetings.