@@ -1398,7 +1398,14 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
13981398 ) ? {
13991399 TypeRelativePath :: AssocItem ( def_id, args) => {
14001400 self . require_type_const_attribute ( def_id, span) ?;
1401- let ct = Const :: new_unevaluated ( tcx, ty:: UnevaluatedConst :: new ( def_id, args) ) ;
1401+ let ct = Const :: new_unevaluated (
1402+ tcx,
1403+ ty:: UnevaluatedConst :: new (
1404+ tcx,
1405+ ty:: UnevaluatedConstKind :: new_from_def_id ( tcx, def_id) ,
1406+ args,
1407+ ) ,
1408+ ) ;
14021409 let ct = self . check_param_uses_if_mcg ( ct, span, false ) ;
14031410 Ok ( ct)
14041411 }
@@ -1840,6 +1847,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
18401847 trait_segment : Option < & hir:: PathSegment < ' tcx > > ,
18411848 item_segment : & hir:: PathSegment < ' tcx > ,
18421849 ) -> Result < Const < ' tcx > , ErrorGuaranteed > {
1850+ let tcx = self . tcx ( ) ;
18431851 let ( item_def_id, item_args) = self . lower_resolved_assoc_item_path (
18441852 span,
18451853 opt_self_ty,
@@ -1849,8 +1857,12 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
18491857 ty:: AssocTag :: Const ,
18501858 ) ?;
18511859 self . require_type_const_attribute ( item_def_id, span) ?;
1852- let uv = ty:: UnevaluatedConst :: new ( item_def_id, item_args) ;
1853- Ok ( Const :: new_unevaluated ( self . tcx ( ) , uv) )
1860+ let uv = ty:: UnevaluatedConst :: new (
1861+ tcx,
1862+ ty:: UnevaluatedConstKind :: new_from_def_id ( tcx, item_def_id) ,
1863+ item_args,
1864+ ) ;
1865+ Ok ( Const :: new_unevaluated ( tcx, uv) )
18541866 }
18551867
18561868 /// Lower a [resolved][hir::QPath::Resolved] (type-level) associated item path.
@@ -2692,7 +2704,14 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
26922704 let _ = self
26932705 . prohibit_generic_args ( leading_segments. iter ( ) , GenericsArgsErrExtend :: None ) ;
26942706 let args = self . lower_generic_args_of_path_segment ( span, did, segment) ;
2695- ty:: Const :: new_unevaluated ( tcx, ty:: UnevaluatedConst :: new ( did, args) )
2707+ ty:: Const :: new_unevaluated (
2708+ tcx,
2709+ ty:: UnevaluatedConst :: new (
2710+ tcx,
2711+ ty:: UnevaluatedConstKind :: new_from_def_id ( tcx, did) ,
2712+ args,
2713+ ) ,
2714+ )
26962715 }
26972716 Res :: Def ( DefKind :: Ctor ( ctor_of, CtorKind :: Const ) , did) => {
26982717 assert_eq ! ( opt_self_ty, None ) ;
@@ -2816,10 +2835,11 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
28162835 Some ( v) => v,
28172836 None => ty:: Const :: new_unevaluated (
28182837 tcx,
2819- ty:: UnevaluatedConst {
2820- def : anon. def_id . to_def_id ( ) ,
2821- args : ty:: GenericArgs :: identity_for_item ( tcx, anon. def_id . to_def_id ( ) ) ,
2822- } ,
2838+ ty:: UnevaluatedConst :: new (
2839+ tcx,
2840+ ty:: UnevaluatedConstKind :: Anon { def_id : anon. def_id . to_def_id ( ) } ,
2841+ ty:: GenericArgs :: identity_for_item ( tcx, anon. def_id . to_def_id ( ) ) ,
2842+ ) ,
28232843 ) ,
28242844 }
28252845 }
0 commit comments