lower implicit deref patterns to THIR
Since this uses `pat_adjustments`, I've also tweaked the documentation to mention implicit deref patterns and made sure the pattern migration diagnostic logic accounts for it. I'll adjust `ExprUseVisitor` in a later commit and add some tests there for closure capture inference.
This commit is contained in:
parent
f35eae780b
commit
cb6c499bc9
3 changed files with 36 additions and 21 deletions
|
@ -77,8 +77,8 @@ pub struct TypeckResults<'tcx> {
|
|||
/// to a form valid in all Editions, either as a lint diagnostic or hard error.
|
||||
rust_2024_migration_desugared_pats: ItemLocalMap<Rust2024IncompatiblePatInfo>,
|
||||
|
||||
/// Stores the types which were implicitly dereferenced in pattern binding modes
|
||||
/// for later usage in THIR lowering. For example,
|
||||
/// Stores the types which were implicitly dereferenced in pattern binding modes or deref
|
||||
/// patterns for later usage in THIR lowering. For example,
|
||||
///
|
||||
/// ```
|
||||
/// match &&Some(5i32) {
|
||||
|
@ -86,7 +86,16 @@ pub struct TypeckResults<'tcx> {
|
|||
/// _ => {},
|
||||
/// }
|
||||
/// ```
|
||||
/// leads to a `vec![&&Option<i32>, &Option<i32>]`. Empty vectors are not stored.
|
||||
/// leads to a `vec![&&Option<i32>, &Option<i32>]` and
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(deref_patterns)]
|
||||
/// match &Box::new(Some(5i32)) {
|
||||
/// Some(n) => {},
|
||||
/// _ => {},
|
||||
/// }
|
||||
/// ```
|
||||
/// leads to a `vec![&Box<Option<i32>>, Box<Option<i32>>]`. Empty vectors are not stored.
|
||||
///
|
||||
/// See:
|
||||
/// <https://github.com/rust-lang/rfcs/blob/master/text/2005-match-ergonomics.md#definitions>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue