about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-06-04 17:40:46 +0000
committerbors <bors@rust-lang.org>2025-06-04 17:40:46 +0000
commit4b27a04cc8ed4da10a546a871e23e665d03f7a79 (patch)
tree8305aa0d5f9c705a61c6b475a878fbd78564ca80 /compiler/rustc_parse/src
parentdf8102fe5f24f28a918660b0cd918d7331c3896e (diff)
parenta06160d9a8b0b695b871b444e10016de033fa5ed (diff)
downloadrust-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_parse/src')
-rw-r--r--compiler/rustc_parse/src/parser/tokenstream/tests.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/tokenstream/tests.rs b/compiler/rustc_parse/src/parser/tokenstream/tests.rs
index aac75323ff3..19b2c98f5af 100644
--- a/compiler/rustc_parse/src/parser/tokenstream/tests.rs
+++ b/compiler/rustc_parse/src/parser/tokenstream/tests.rs
@@ -14,6 +14,10 @@ fn sp(a: u32, b: u32) -> Span {
     Span::with_root_ctxt(BytePos(a), BytePos(b))
 }
 
+fn cmp_token_stream(a: &TokenStream, b: &TokenStream) -> bool {
+    a.len() == b.len() && a.iter().zip(b.iter()).all(|(x, y)| x.eq_unspanned(y))
+}
+
 #[test]
 fn test_concat() {
     create_default_session_globals_then(|| {
@@ -25,7 +29,7 @@ fn test_concat() {
         eq_res.push_stream(test_snd);
         assert_eq!(test_res.iter().count(), 5);
         assert_eq!(eq_res.iter().count(), 5);
-        assert_eq!(test_res.eq_unspanned(&eq_res), true);
+        assert_eq!(cmp_token_stream(&test_res, &eq_res), true);
     })
 }
 
@@ -104,7 +108,7 @@ fn test_dotdotdot() {
         stream.push_tree(TokenTree::token_joint(token::Dot, sp(0, 1)));
         stream.push_tree(TokenTree::token_joint(token::Dot, sp(1, 2)));
         stream.push_tree(TokenTree::token_alone(token::Dot, sp(2, 3)));
-        assert!(stream.eq_unspanned(&string_to_ts("...")));
+        assert!(cmp_token_stream(&stream, &string_to_ts("...")));
         assert_eq!(stream.iter().count(), 1);
     })
 }