summaryrefslogtreecommitdiff
path: root/compiler/rustc_ast/src/tokenstream.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_ast/src/tokenstream.rs')
-rw-r--r--compiler/rustc_ast/src/tokenstream.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/compiler/rustc_ast/src/tokenstream.rs b/compiler/rustc_ast/src/tokenstream.rs
index f0a6a5e0725..db296aa44db 100644
--- a/compiler/rustc_ast/src/tokenstream.rs
+++ b/compiler/rustc_ast/src/tokenstream.rs
@@ -48,14 +48,15 @@ pub enum TokenTree {
Delimited(DelimSpan, Delimiter, TokenStream),
}
-// Ensure all fields of `TokenTree` is `Send` and `Sync`.
+// Ensure all fields of `TokenTree` are `DynSend` and `DynSync`.
#[cfg(parallel_compiler)]
fn _dummy()
where
- Token: Send + Sync,
- DelimSpan: Send + Sync,
- Delimiter: Send + Sync,
- TokenStream: Send + Sync,
+ Token: sync::DynSend + sync::DynSync,
+ Spacing: sync::DynSend + sync::DynSync,
+ DelimSpan: sync::DynSend + sync::DynSync,
+ Delimiter: sync::DynSend + sync::DynSync,
+ TokenStream: sync::DynSend + sync::DynSync,
{
}
@@ -118,7 +119,7 @@ where
}
}
-pub trait ToAttrTokenStream: sync::Send + sync::Sync {
+pub trait ToAttrTokenStream: sync::DynSend + sync::DynSync {
fn to_attr_token_stream(&self) -> AttrTokenStream;
}
@@ -550,6 +551,10 @@ impl TokenStream {
vec_mut.extend(stream_iter);
}
}
+
+ pub fn chunks(&self, chunk_size: usize) -> core::slice::Chunks<'_, TokenTree> {
+ self.0.chunks(chunk_size)
+ }
}
/// By-reference iterator over a [`TokenStream`], that produces `&TokenTree`