File tree 1 file changed +6
-3
lines changed
compiler/rustc_ast_lowering/src
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> {
42
42
ExprKind :: Tup ( ref elts) => hir:: ExprKind :: Tup ( self . lower_exprs ( elts) ) ,
43
43
ExprKind :: Call ( ref f, ref args) => {
44
44
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 ) } ;
47
49
} else {
48
50
self . sess
49
51
. struct_span_err (
50
52
e. span ,
51
- "rustc_box requires precisely one argument" ,
53
+ "#[rustc_box] requires precisely one argument \
54
+ and no other attributes are allowed",
52
55
)
53
56
. emit ( ) ;
54
57
hir:: ExprKind :: Err
You can’t perform that action at this time.
0 commit comments