diff options
| author | bors <bors@rust-lang.org> | 2019-01-13 17:08:24 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-01-13 17:08:24 +0000 |
| commit | 2cf736f76563f054aecd84207b39114c6fceb8ed (patch) | |
| tree | 3700724bbe6c6438f2aef5999ed54084c9c17018 /src/libsyntax_ext | |
| parent | 1c561d9b55aabc7df484f8faba24430421aee998 (diff) | |
| parent | e2311b31c64e56c3d3218f6101c22ffe573bb687 (diff) | |
| download | rust-2cf736f76563f054aecd84207b39114c6fceb8ed.tar.gz rust-2cf736f76563f054aecd84207b39114c6fceb8ed.zip | |
Auto merge of #57577 - Centril:rollup, r=Centril
Rollup of 4 pull requests Successful merges: - #57004 (Make `TokenStream` less recursive.) - #57102 (NLL: Add union justifications to conflicting borrows.) - #57337 (rustc: Place wasm linker args first instead of last) - #57549 (Add #[must_use] message to Iterator and Future) Failed merges: r? @ghost
Diffstat (limited to 'src/libsyntax_ext')
| -rw-r--r-- | src/libsyntax_ext/proc_macro_server.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libsyntax_ext/proc_macro_server.rs b/src/libsyntax_ext/proc_macro_server.rs index afd86a4f746..158cbc791ef 100644 --- a/src/libsyntax_ext/proc_macro_server.rs +++ b/src/libsyntax_ext/proc_macro_server.rs @@ -11,7 +11,7 @@ use syntax::ast; use syntax::ext::base::ExtCtxt; use syntax::parse::lexer::comments; use syntax::parse::{self, token, ParseSess}; -use syntax::tokenstream::{self, DelimSpan, IsJoint::*, TokenStream}; +use syntax::tokenstream::{self, DelimSpan, IsJoint::*, TokenStream, TreeAndJoint}; use syntax_pos::hygiene::{SyntaxContext, Transparency}; use syntax_pos::symbol::{keywords, Symbol}; use syntax_pos::{BytePos, FileName, MultiSpan, Pos, SourceFile, Span}; @@ -46,13 +46,14 @@ impl ToInternal<token::DelimToken> for Delimiter { } } -impl FromInternal<(TokenStream, &'_ ParseSess, &'_ mut Vec<Self>)> +impl FromInternal<(TreeAndJoint, &'_ ParseSess, &'_ mut Vec<Self>)> for TokenTree<Group, Punct, Ident, Literal> { - fn from_internal((stream, sess, stack): (TokenStream, &ParseSess, &mut Vec<Self>)) -> Self { + fn from_internal(((tree, is_joint), sess, stack): (TreeAndJoint, &ParseSess, &mut Vec<Self>)) + -> Self { use syntax::parse::token::*; - let (tree, joint) = stream.as_tree(); + let joint = is_joint == Joint; let (span, token) = match tree { tokenstream::TokenTree::Delimited(span, delim, tts) => { let delimiter = Delimiter::from_internal(delim); @@ -450,7 +451,7 @@ impl server::TokenStreamIter for Rustc<'_> { ) -> Option<TokenTree<Self::Group, Self::Punct, Self::Ident, Self::Literal>> { loop { let tree = iter.stack.pop().or_else(|| { - let next = iter.cursor.next_as_stream()?; + let next = iter.cursor.next_with_joint()?; Some(TokenTree::from_internal((next, self.sess, &mut iter.stack))) })?; // HACK: The condition "dummy span + group with empty delimiter" represents an AST @@ -461,7 +462,7 @@ impl server::TokenStreamIter for Rustc<'_> { // and not doing the roundtrip through AST. if let TokenTree::Group(ref group) = tree { if group.delimiter == Delimiter::None && group.span.entire().is_dummy() { - iter.cursor.insert(group.stream.clone()); + iter.cursor.append(group.stream.clone()); continue; } } |
