1
Fork 0

Revert "Rollup merge of #76285 - matklad:censor-spacing, r=petrochenkov"

This reverts commit 85cee57fd7, reversing
changes made to b4d3873024.
This commit is contained in:
Tyler Mandry 2020-09-10 02:18:46 +00:00
parent 97eb606e4b
commit fdff7defc9
4 changed files with 16 additions and 25 deletions

View file

@ -47,26 +47,15 @@ impl ToInternal<token::DelimToken> for Delimiter {
}
}
impl
FromInternal<(
TreeAndJoint,
Option<&'_ tokenstream::TokenTree>,
&'_ ParseSess,
&'_ mut Vec<Self>,
)> for TokenTree<Group, Punct, Ident, Literal>
impl FromInternal<(TreeAndJoint, &'_ ParseSess, &'_ mut Vec<Self>)>
for TokenTree<Group, Punct, Ident, Literal>
{
fn from_internal(
((tree, is_joint), look_ahead, sess, stack): (
TreeAndJoint,
Option<&tokenstream::TokenTree>,
&ParseSess,
&mut Vec<Self>,
),
((tree, is_joint), sess, stack): (TreeAndJoint, &ParseSess, &mut Vec<Self>),
) -> Self {
use rustc_ast::token::*;
let joint = is_joint == Joint
&& matches!(look_ahead, Some(tokenstream::TokenTree::Token(t)) if t.is_op());
let joint = is_joint == Joint;
let Token { kind, span } = match tree {
tokenstream::TokenTree::Delimited(span, delim, tts) => {
let delimiter = Delimiter::from_internal(delim);
@ -456,8 +445,7 @@ impl server::TokenStreamIter for Rustc<'_> {
loop {
let tree = iter.stack.pop().or_else(|| {
let next = iter.cursor.next_with_joint()?;
let lookahead = iter.cursor.look_ahead(0);
Some(TokenTree::from_internal((next, lookahead, self.sess, &mut iter.stack)))
Some(TokenTree::from_internal((next, self.sess, &mut iter.stack)))
})?;
// A hack used to pass AST fragments to attribute and derive macros
// as a single nonterminal token instead of a token stream.