@@ -157,9 +157,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
157157 }
158158 kind => ( kind, None , None ) ,
159159 } ;
160- let value = if let PatKind :: Constant { value }
161- | PatKind :: NamedConstant { value, span : _ } = kind
162- {
160+ let value = if let PatKind :: Constant { value, opt_def : _ } = kind {
163161 value
164162 } else {
165163 let msg = format ! (
@@ -253,7 +251,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
253251 ( RangeEnd :: Included , Some ( Ordering :: Less ) ) => { }
254252 // `x..=y` where `x == y` and `x` and `y` are finite.
255253 ( RangeEnd :: Included , Some ( Ordering :: Equal ) ) if lo. is_finite ( ) && hi. is_finite ( ) => {
256- kind = PatKind :: Constant { value : lo. as_finite ( ) . unwrap ( ) } ;
254+ kind = PatKind :: Constant { value : lo. as_finite ( ) . unwrap ( ) , opt_def : None } ;
257255 }
258256 // `..=x` where `x == ty::MIN`.
259257 ( RangeEnd :: Included , Some ( Ordering :: Equal ) ) if !lo. is_finite ( ) => { }
@@ -562,15 +560,12 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
562560 _ => return pat_from_kind ( self . lower_variant_or_leaf ( res, id, span, ty, vec ! [ ] ) ) ,
563561 } ;
564562
565- // HERE
566563 let args = self . typeck_results . node_args ( id) ;
567564 let c = ty:: Const :: new_unevaluated ( self . tcx , ty:: UnevaluatedConst { def : def_id, args } ) ;
568- let def_span = self . tcx . def_span ( def_id) ;
569565 let mut pattern = self . const_to_pat ( c, ty, id, span) ;
570- if let PatKind :: Constant { value } = pattern. kind {
571- pattern. kind = PatKind :: NamedConstant { value, span : def_span } ;
566+ if let PatKind :: Constant { value, opt_def : None } = pattern. kind {
567+ pattern. kind = PatKind :: Constant { value, opt_def : Some ( def_id ) } ;
572568 }
573- tracing:: info!( "pattern {pattern:#?} {c:?} {ty:?} {id:?}" ) ;
574569
575570 if !is_associated_const {
576571 return pattern;
0 commit comments