@@ -157,9 +157,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
157
157
}
158
158
kind => ( kind, None , None ) ,
159
159
} ;
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 {
163
161
value
164
162
} else {
165
163
let msg = format ! (
@@ -253,7 +251,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
253
251
( RangeEnd :: Included , Some ( Ordering :: Less ) ) => { }
254
252
// `x..=y` where `x == y` and `x` and `y` are finite.
255
253
( 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 } ;
257
255
}
258
256
// `..=x` where `x == ty::MIN`.
259
257
( RangeEnd :: Included , Some ( Ordering :: Equal ) ) if !lo. is_finite ( ) => { }
@@ -562,15 +560,12 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
562
560
_ => return pat_from_kind ( self . lower_variant_or_leaf ( res, id, span, ty, vec ! [ ] ) ) ,
563
561
} ;
564
562
565
- // HERE
566
563
let args = self . typeck_results . node_args ( id) ;
567
564
let c = ty:: Const :: new_unevaluated ( self . tcx , ty:: UnevaluatedConst { def : def_id, args } ) ;
568
- let def_span = self . tcx . def_span ( def_id) ;
569
565
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 ) } ;
572
568
}
573
- tracing:: info!( "pattern {pattern:#?} {c:?} {ty:?} {id:?}" ) ;
574
569
575
570
if !is_associated_const {
576
571
return pattern;
0 commit comments