Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/diagnostics/match_check/pat_util.rs')
-rw-r--r--crates/hir-ty/src/diagnostics/match_check/pat_util.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/hir-ty/src/diagnostics/match_check/pat_util.rs b/crates/hir-ty/src/diagnostics/match_check/pat_util.rs
index c6a26cdd1d..0b39692e46 100644
--- a/crates/hir-ty/src/diagnostics/match_check/pat_util.rs
+++ b/crates/hir-ty/src/diagnostics/match_check/pat_util.rs
@@ -38,6 +38,12 @@ pub(crate) trait EnumerateAndAdjustIterator {
}
impl<T: ExactSizeIterator> EnumerateAndAdjustIterator for T {
+ /// When there is a list of items with a gap of an unknown length inside, and another list
+ /// of item it should be zipped against, this operates on the list with the gap and returns,
+ /// for each item, the index it should match in the other list.
+ ///
+ /// When compiling Rust, such situation often occurs for tuple structs/tuples with a rest pattern
+ /// that should be matched against the fields.
fn enumerate_and_adjust(
self,
expected_len: usize,