fix: backport changes for latest rustc api comaptibility

This commit is contained in:
Caleb Cartwright 2021-05-02 10:03:25 -05:00 committed by Caleb Cartwright
parent ddb224a173
commit f87414729f
3 changed files with 5 additions and 4 deletions

View File

@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2021-03-26"
channel = "nightly-2021-05-01"
components = ["rustc-dev"]

View File

@ -13,7 +13,7 @@
use std::panic::{catch_unwind, AssertUnwindSafe};
use rustc_ast::token::{BinOpToken, DelimToken, Token, TokenKind};
use rustc_ast::tokenstream::{Cursor, LazyTokenStream, TokenStream, TokenTree};
use rustc_ast::tokenstream::{Cursor, Spacing, TokenStream, TokenTree};
use rustc_ast::{ast, ptr};
use rustc_ast_pretty::pprust;
use rustc_parse::parser::{ForceCollect, Parser};
@ -1212,7 +1212,7 @@ pub(crate) fn convert_try_mac(
kind: ast::ExprKind::Try(parser.parse_expr().ok()?),
span: mac.span(), // incorrect span, but shouldn't matter too much
attrs: ast::AttrVec::new(),
tokens: Some(LazyTokenStream::new(ts)),
tokens: None,
})
} else {
None
@ -1259,7 +1259,7 @@ fn parse_branch(&mut self) -> Option<MacroBranch> {
TokenTree::Token(..) => return None,
TokenTree::Delimited(delimited_span, d, _) => (delimited_span.open.lo(), d),
};
let args = tok.joint();
let args = TokenStream::new(vec![(tok, Spacing::Joint)]);
match self.toks.next()? {
TokenTree::Token(Token {
kind: TokenKind::FatArrow,

View File

@ -55,6 +55,7 @@ pub(crate) fn new(
}
impl<'a> AstLike for Module<'a> {
const SUPPORTS_CUSTOM_INNER_ATTRS: bool = true;
fn attrs(&self) -> &[ast::Attribute] {
&self.inner_attr
}