@@ -33,7 +33,6 @@ use rustc_session::errors::{report_lit_error, ExprParenthesesNeeded};
33
33
use rustc_session:: lint:: builtin:: BREAK_WITH_LABEL_AND_LOOP ;
34
34
use rustc_session:: lint:: BuiltinLintDiagnostics ;
35
35
use rustc_span:: source_map:: { self , Spanned } ;
36
- use rustc_span:: symbol:: kw:: PathRoot ;
37
36
use rustc_span:: symbol:: { kw, sym, Ident , Symbol } ;
38
37
use rustc_span:: { BytePos , Pos , Span } ;
39
38
use thin_vec:: { thin_vec, ThinVec } ;
@@ -612,9 +611,6 @@ impl<'a> Parser<'a> {
612
611
let operand_expr = this. parse_expr_dot_or_call ( Default :: default ( ) ) ?;
613
612
this. recover_from_prefix_increment ( operand_expr, pre_span, starts_stmt)
614
613
}
615
- token:: Ident ( ..) if this. token . is_keyword ( kw:: Box ) => {
616
- make_it ! ( this, attrs, |this, _| this. parse_expr_box( lo) )
617
- }
618
614
token:: Ident ( ..) if this. may_recover ( ) && this. is_mistaken_not_ident_negation ( ) => {
619
615
make_it ! ( this, attrs, |this, _| this. recover_not_expr( lo) )
620
616
}
@@ -641,29 +637,6 @@ impl<'a> Parser<'a> {
641
637
self . parse_expr_unary ( lo, UnOp :: Not )
642
638
}
643
639
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
-
667
640
fn is_mistaken_not_ident_negation ( & self ) -> bool {
668
641
let token_cannot_continue_expr = |t : & Token | match t. uninterpolate ( ) . kind {
669
642
// These tokens can start an expression after `!`, but
0 commit comments