Skip to content

Commit 24a95bf

Browse files
dianneNadrieril
andauthored
clarify wording on doc comment
Co-authored-by: Nadrieril <[email protected]>
1 parent 4b7c080 commit 24a95bf

File tree

1 file changed

+9
-6
lines changed
  • compiler/rustc_hir_typeck/src

1 file changed

+9
-6
lines changed

compiler/rustc_hir_typeck/src/pat.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,15 @@ enum InheritedRefMatchRule {
232232
/// When the underlying type is a reference type, reference patterns consume both layers of
233233
/// reference, i.e. they both reset the binding mode and consume the reference type.
234234
EatBoth {
235-
/// This represents two behaviors implemented by both the `ref_pat_eat_one_layer_2024` and
236-
/// `ref_pat_eat_one_layer_2024_structural` feature gates, and is false for stable Rust.
237-
/// - Whether to allow reference patterns to consume only an inherited reference when
238-
/// matching against a non-reference type.
239-
/// - Whether to allow a `&mut` reference pattern to eat a `&` reference type if it's also
240-
/// able to consume a mutable inherited reference.
235+
/// If `true`, an inherited reference will be considered when determining whether a reference
236+
/// pattern matches a given type:
237+
/// - If the underlying type is not a reference, a reference pattern may eat the inherited reference;
238+
/// - If the underlying type is a reference, a reference pattern matches if it can eat either one
239+
/// of the underlying and inherited references. E.g. a `&mut` pattern is allowed if either the
240+
/// underlying type is `&mut` or the inherited reference is `&mut`.
241+
/// If `false`, a reference pattern is only matched against the underlying type.
242+
/// This is `false` for stable Rust and `true` for both the `ref_pat_eat_one_layer_2024` and
243+
/// `ref_pat_eat_one_layer_2024_structural` feature gates.
241244
consider_inherited_ref_first: bool,
242245
},
243246
}

0 commit comments

Comments
 (0)