diff options
| author | bors <bors@rust-lang.org> | 2025-06-04 17:40:46 +0000 | 
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-06-04 17:40:46 +0000 | 
| commit | 4b27a04cc8ed4da10a546a871e23e665d03f7a79 (patch) | |
| tree | 8305aa0d5f9c705a61c6b475a878fbd78564ca80 /compiler/rustc_ast/src/tokenstream.rs | |
| parent | df8102fe5f24f28a918660b0cd918d7331c3896e (diff) | |
| parent | a06160d9a8b0b695b871b444e10016de033fa5ed (diff) | |
| download | rust-4b27a04cc8ed4da10a546a871e23e665d03f7a79.tar.gz rust-4b27a04cc8ed4da10a546a871e23e665d03f7a79.zip  | |
Auto merge of #142028 - matthiaskrgr:rollup-rawl1zo, r=matthiaskrgr
Rollup of 7 pull requests
Successful merges:
 - rust-lang/rust#141271 (Streamline some attr parsing APIs)
 - rust-lang/rust#141570 (Fix incorrect eq_unspanned in TokenStream)
 - rust-lang/rust#141893 (remove `f16: From<u16>`)
 - rust-lang/rust#141924 (Lightly tweak docs for BTree{Map,Set}::extract_if)
 - rust-lang/rust#141939 (exact_div: add tests)
 - rust-lang/rust#141959 (Add more missing 2015 edition directives)
 - rust-lang/rust#142007 (Improve some `Visitor` comments.)
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_ast/src/tokenstream.rs')
| -rw-r--r-- | compiler/rustc_ast/src/tokenstream.rs | 16 | 
1 files changed, 3 insertions, 13 deletions
diff --git a/compiler/rustc_ast/src/tokenstream.rs b/compiler/rustc_ast/src/tokenstream.rs index 636c26bcde0..3c231be20dc 100644 --- a/compiler/rustc_ast/src/tokenstream.rs +++ b/compiler/rustc_ast/src/tokenstream.rs @@ -57,7 +57,9 @@ impl TokenTree { match (self, other) { (TokenTree::Token(token, _), TokenTree::Token(token2, _)) => token.kind == token2.kind, (TokenTree::Delimited(.., delim, tts), TokenTree::Delimited(.., delim2, tts2)) => { - delim == delim2 && tts.eq_unspanned(tts2) + delim == delim2 + && tts.len() == tts2.len() + && tts.iter().zip(tts2.iter()).all(|(a, b)| a.eq_unspanned(b)) } _ => false, } @@ -694,18 +696,6 @@ impl TokenStream { TokenStreamIter::new(self) } - /// Compares two `TokenStream`s, checking equality without regarding span information. - 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() - } - /// Create a token stream containing a single token with alone spacing. The /// spacing used for the final token in a constructed stream doesn't matter /// because it's never used. In practice we arbitrarily use  | 
