diff options
Diffstat (limited to 'compiler/rustc_builtin_macros/src/util.rs')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/util.rs | 11 | 
1 files changed, 5 insertions, 6 deletions
| diff --git a/compiler/rustc_builtin_macros/src/util.rs b/compiler/rustc_builtin_macros/src/util.rs index 38fec2bff14..f00c170e485 100644 --- a/compiler/rustc_builtin_macros/src/util.rs +++ b/compiler/rustc_builtin_macros/src/util.rs @@ -1,4 +1,3 @@ -use rustc_ast::ptr::P; use rustc_ast::tokenstream::TokenStream; use rustc_ast::{self as ast, AttrStyle, Attribute, MetaItem, attr, token}; use rustc_errors::{Applicability, Diag, ErrorGuaranteed}; @@ -83,7 +82,7 @@ type UnexpectedExprKind<'a> = Result<(Diag<'a>, bool /* has_suggestions */), Err #[allow(rustc::untranslatable_diagnostic)] pub(crate) fn expr_to_spanned_string<'a>( cx: &'a mut ExtCtxt<'_>, - expr: P<ast::Expr>, + expr: Box<ast::Expr>, err_msg: &'static str, ) -> ExpandResult<ExprToSpannedStringResult<'a>, ()> { if !cx.force_mode @@ -135,7 +134,7 @@ pub(crate) fn expr_to_spanned_string<'a>( /// compilation on error, merely emits a non-fatal error and returns `Err`. pub(crate) fn expr_to_string( cx: &mut ExtCtxt<'_>, - expr: P<ast::Expr>, + expr: Box<ast::Expr>, err_msg: &'static str, ) -> ExpandResult<Result<(Symbol, ast::StrStyle), ErrorGuaranteed>, ()> { expr_to_spanned_string(cx, expr, err_msg).map(|res| { @@ -158,7 +157,7 @@ pub(crate) fn check_zero_tts(cx: &ExtCtxt<'_>, span: Span, tts: TokenStream, nam } /// Parse an expression. On error, emit it, advancing to `Eof`, and return `Err`. -pub(crate) fn parse_expr(p: &mut parser::Parser<'_>) -> Result<P<ast::Expr>, ErrorGuaranteed> { +pub(crate) fn parse_expr(p: &mut parser::Parser<'_>) -> Result<Box<ast::Expr>, ErrorGuaranteed> { let guar = match p.parse_expr() { Ok(expr) => return Ok(expr), Err(err) => err.emit(), @@ -209,7 +208,7 @@ pub(crate) fn get_single_expr_from_tts( span: Span, tts: TokenStream, name: &str, -) -> ExpandResult<Result<P<ast::Expr>, ErrorGuaranteed>, ()> { +) -> ExpandResult<Result<Box<ast::Expr>, ErrorGuaranteed>, ()> { let mut p = cx.new_parser_from_tts(tts); if p.token == token::Eof { let guar = cx.dcx().emit_err(errors::OnlyOneArgument { span, name }); @@ -232,7 +231,7 @@ pub(crate) fn get_single_expr_from_tts( pub(crate) fn get_exprs_from_tts( cx: &mut ExtCtxt<'_>, tts: TokenStream, -) -> ExpandResult<Result<Vec<P<ast::Expr>>, ErrorGuaranteed>, ()> { +) -> ExpandResult<Result<Vec<Box<ast::Expr>>, ErrorGuaranteed>, ()> { let mut p = cx.new_parser_from_tts(tts); let mut es = Vec::new(); while p.token != token::Eof { | 
