-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
The following function is incorrect:
rust/compiler/rustc_ast/src/tokenstream.rs
Lines 698 to 707 in 038d599
pub fn eq_unspanned(&self, other: &TokenStream) -> bool { | |
let mut iter1 = self.iter(); | |
let mut iter2 = other.iter(); | |
for (tt1, tt2) in iter::zip(&mut iter1, &mut iter2) { | |
if !tt1.eq_unspanned(tt2) { | |
return false; | |
} | |
} | |
iter1.next().is_none() && iter2.next().is_none() | |
} |
Zipped iterators with uneven lengths will still consume an item from both sides of the zip on their final iteration (where one will return None
and one will return Some
). This allows for both iterators to be exhausted even though their lengths are unequal.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.