@@ -33,7 +33,6 @@ use rustc_session::errors::{report_lit_error, ExprParenthesesNeeded};
3333use rustc_session:: lint:: builtin:: BREAK_WITH_LABEL_AND_LOOP ;
3434use rustc_session:: lint:: BuiltinLintDiagnostics ;
3535use rustc_span:: source_map:: { self , Spanned } ;
36- use rustc_span:: symbol:: kw:: PathRoot ;
3736use rustc_span:: symbol:: { kw, sym, Ident , Symbol } ;
3837use rustc_span:: { BytePos , Pos , Span } ;
3938use thin_vec:: { thin_vec, ThinVec } ;
@@ -612,9 +611,6 @@ impl<'a> Parser<'a> {
612611 let operand_expr = this. parse_expr_dot_or_call ( Default :: default ( ) ) ?;
613612 this. recover_from_prefix_increment ( operand_expr, pre_span, starts_stmt)
614613 }
615- token:: Ident ( ..) if this. token . is_keyword ( kw:: Box ) => {
616- make_it ! ( this, attrs, |this, _| this. parse_expr_box( lo) )
617- }
618614 token:: Ident ( ..) if this. may_recover ( ) && this. is_mistaken_not_ident_negation ( ) => {
619615 make_it ! ( this, attrs, |this, _| this. recover_not_expr( lo) )
620616 }
@@ -641,29 +637,6 @@ impl<'a> Parser<'a> {
641637 self . parse_expr_unary ( lo, UnOp :: Not )
642638 }
643639
644- /// Parse `box expr` - this syntax has been removed, but we still parse this
645- /// for now to provide an automated way to fix usages of it
646- fn parse_expr_box ( & mut self , lo : Span ) -> PResult < ' a , ( Span , ExprKind ) > {
647- let ( span, expr) = self . parse_expr_prefix_common ( lo) ?;
648- let code = self . sess . source_map ( ) . span_to_snippet ( span. with_lo ( lo. hi ( ) ) ) . unwrap ( ) ;
649- self . dcx ( ) . emit_err ( errors:: BoxSyntaxRemoved { span, code : code. trim ( ) } ) ;
650- // So typechecking works, parse `box <expr>` as `::std::boxed::Box::new(expr)`
651- let path = Path {
652- span,
653- segments : [
654- PathSegment :: from_ident ( Ident :: with_dummy_span ( PathRoot ) ) ,
655- PathSegment :: from_ident ( Ident :: with_dummy_span ( sym:: std) ) ,
656- PathSegment :: from_ident ( Ident :: from_str ( "boxed" ) ) ,
657- PathSegment :: from_ident ( Ident :: from_str ( "Box" ) ) ,
658- PathSegment :: from_ident ( Ident :: with_dummy_span ( sym:: new) ) ,
659- ]
660- . into ( ) ,
661- tokens : None ,
662- } ;
663- let path = self . mk_expr ( span, ExprKind :: Path ( None , path) ) ;
664- Ok ( ( span, self . mk_call ( path, ThinVec :: from ( [ expr] ) ) ) )
665- }
666-
667640 fn is_mistaken_not_ident_negation ( & self ) -> bool {
668641 let token_cannot_continue_expr = |t : & Token | match t. uninterpolate ( ) . kind {
669642 // These tokens can start an expression after `!`, but
0 commit comments