Skip to content

Commit

Permalink
Make TokenStream's IntoIter derive Clone
Browse files Browse the repository at this point in the history
Both the wrapper and fallback versions are cloneable.
This brings proc_macro2 in line with proc_macro in terms of this
functionality.
  • Loading branch information
ivanbakel committed May 8, 2019
1 parent 79c8ed7 commit f6754d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,7 @@ pub mod token_stream {
///
/// The iteration is "shallow", e.g. the iterator doesn't recurse into
/// delimited groups, and returns whole groups as token trees.
#[derive(Clone)]
pub struct IntoIter {
inner: imp::TokenTreeIter,
_marker: marker::PhantomData<Rc<()>>,
Expand Down
1 change: 1 addition & 0 deletions src/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ impl fmt::Debug for LexError {
}
}

#[derive(Clone)]
pub enum TokenTreeIter {
Compiler(proc_macro::token_stream::IntoIter),
Fallback(fallback::TokenTreeIter),
Expand Down

0 comments on commit f6754d3

Please sign in to comment.