@@ -106,7 +106,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
106106
107107 let kind = match & e. kind {
108108 ExprKind :: Array ( exprs) => hir:: ExprKind :: Array ( self . lower_exprs ( exprs) ) ,
109- ExprKind :: ConstBlock ( c) => hir:: ExprKind :: ConstBlock ( self . lower_const_block ( c) ) ,
109+ ExprKind :: ConstBlock ( c) => {
110+ hir:: ExprKind :: ConstBlock ( self . lower_const_block ( c, attrs) )
111+ }
110112 ExprKind :: Repeat ( expr, count) => {
111113 let expr = self . lower_expr ( expr) ;
112114 let count = self . lower_array_length_to_const_arg ( count) ;
@@ -391,12 +393,20 @@ impl<'hir> LoweringContext<'_, 'hir> {
391393 } )
392394 }
393395
394- pub ( crate ) fn lower_const_block ( & mut self , c : & AnonConst ) -> hir:: ConstBlock {
396+ pub ( crate ) fn lower_const_block (
397+ & mut self ,
398+ c : & AnonConst ,
399+ attrs : & ' hir [ hir:: Attribute ] ,
400+ ) -> hir:: ConstBlock {
395401 self . with_new_scopes ( c. value . span , |this| {
396402 let def_id = this. local_def_id ( c. id ) ;
403+ let hir_id = this. lower_node_id ( c. id ) ;
404+ if !attrs. is_empty ( ) {
405+ this. attrs . insert ( hir_id. local_id , attrs) ;
406+ }
397407 hir:: ConstBlock {
398408 def_id,
399- hir_id : this . lower_node_id ( c . id ) ,
409+ hir_id,
400410 body : this. lower_const_body ( c. value . span , Some ( & c. value ) ) ,
401411 }
402412 } )
0 commit comments