Rollup merge of #145722 - Qelxiros:112815-tokenstream-extend, r=dtolnay
implement Extend<{Group, Literal, Punct, Ident}> for TokenStream
Tracking issue: rust-lang/rust#112815
This commit is contained in:
commit
6967a8561b
1 changed files with 15 additions and 0 deletions
|
|
@ -376,6 +376,21 @@ impl Extend<TokenStream> for TokenStream {
|
|||
}
|
||||
}
|
||||
|
||||
macro_rules! extend_items {
|
||||
($($item:ident)*) => {
|
||||
$(
|
||||
#[stable(feature = "token_stream_extend_tt_items", since = "CURRENT_RUSTC_VERSION")]
|
||||
impl Extend<$item> for TokenStream {
|
||||
fn extend<T: IntoIterator<Item = $item>>(&mut self, iter: T) {
|
||||
self.extend(iter.into_iter().map(TokenTree::$item));
|
||||
}
|
||||
}
|
||||
)*
|
||||
};
|
||||
}
|
||||
|
||||
extend_items!(Group Literal Punct Ident);
|
||||
|
||||
/// Public implementation details for the `TokenStream` type, such as iterators.
|
||||
#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
|
||||
pub mod token_stream {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue