File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
compiler/rustc_ast_lowering/src Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -42,13 +42,16 @@ impl<'hir> LoweringContext<'_, 'hir> {
4242 ExprKind :: Tup ( ref elts) => hir:: ExprKind :: Tup ( self . lower_exprs ( elts) ) ,
4343 ExprKind :: Call ( ref f, ref args) => {
4444 if e. attrs . get ( 0 ) . map_or ( false , |a| a. has_name ( sym:: rustc_box) ) {
45- if let [ inner] = & args[ ..] {
46- hir:: ExprKind :: Box ( self . lower_expr ( & inner) )
45+ if let [ inner] = & args[ ..] && e. attrs . len ( ) == 1 {
46+ let kind = hir:: ExprKind :: Box ( self . lower_expr ( & inner) ) ;
47+ let hir_id = self . lower_node_id ( e. id ) ;
48+ return hir:: Expr { hir_id, kind, span : self . lower_span ( e. span ) } ;
4749 } else {
4850 self . sess
4951 . struct_span_err (
5052 e. span ,
51- "rustc_box requires precisely one argument" ,
53+ "#[rustc_box] requires precisely one argument \
54+ and no other attributes are allowed",
5255 )
5356 . emit ( ) ;
5457 hir:: ExprKind :: Err
You can’t perform that action at this time.
0 commit comments