@@ -2264,21 +2264,23 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
22642264 . unwrap_or_else ( |guar| Const :: new_error ( tcx, guar) )
22652265 }
22662266 hir:: ConstArgKind :: Struct ( qpath, inits) => {
2267- self . lower_struct_expr_const_arg ( hir_id, qpath, inits, const_arg. span ( ) )
2267+ self . lower_const_arg_struct ( hir_id, qpath, inits, const_arg. span ( ) )
22682268 }
2269- hir:: ConstArgKind :: Anon ( anon) => self . lower_anon_const ( anon) ,
2269+ hir:: ConstArgKind :: Anon ( anon) => self . lower_const_arg_anon ( anon) ,
22702270 hir:: ConstArgKind :: Infer ( span, ( ) ) => self . ct_infer ( None , span) ,
22712271 hir:: ConstArgKind :: Error ( _, e) => ty:: Const :: new_error ( tcx, e) ,
22722272 }
22732273 }
22742274
2275- fn lower_struct_expr_const_arg (
2275+ fn lower_const_arg_struct (
22762276 & self ,
22772277 hir_id : HirId ,
22782278 qpath : hir:: QPath < ' tcx > ,
22792279 inits : & ' tcx [ & ' tcx hir:: ConstArgExprField < ' tcx > ] ,
22802280 span : Span ,
22812281 ) -> Const < ' tcx > {
2282+ // FIXME(mgca): try to deduplicate this function with
2283+ // the equivalent HIR typeck logic.
22822284 let tcx = self . tcx ( ) ;
22832285
22842286 let non_adt_or_variant_res = || {
@@ -2330,7 +2332,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
23302332 . fields
23312333 . iter ( )
23322334 . map ( |field_def| {
2333- // FIXME(mgca): we aren't really handling privacy or stability at all but we should
2335+ // FIXME(mgca): we aren't really handling privacy, stability,
2336+ // or macro hygeniene but we should.
23342337 let mut init_expr =
23352338 inits. iter ( ) . filter ( |init_expr| init_expr. field . name == field_def. name ) ;
23362339
@@ -2477,7 +2480,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
24772480
24782481 /// Literals are eagerly converted to a constant, everything else becomes `Unevaluated`.
24792482 #[ instrument( skip( self ) , level = "debug" ) ]
2480- fn lower_anon_const ( & self , anon : & AnonConst ) -> Const < ' tcx > {
2483+ fn lower_const_arg_anon ( & self , anon : & AnonConst ) -> Const < ' tcx > {
24812484 let tcx = self . tcx ( ) ;
24822485
24832486 let expr = & tcx. hir_body ( anon. body ) . value ;
0 commit comments