@@ -20,7 +20,7 @@ use rustc_middle::thir::{
20
20
use rustc_middle:: ty:: layout:: IntegerExt ;
21
21
use rustc_middle:: ty:: { self , CanonicalUserTypeAnnotation , Ty , TyCtxt , TypeVisitableExt } ;
22
22
use rustc_middle:: { bug, span_bug} ;
23
- use rustc_span:: def_id:: LocalDefId ;
23
+ use rustc_span:: def_id:: DefId ;
24
24
use rustc_span:: { ErrorGuaranteed , Span } ;
25
25
use tracing:: { debug, instrument} ;
26
26
@@ -124,7 +124,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
124
124
expr : Option < & ' tcx hir:: PatExpr < ' tcx > > ,
125
125
// Out-parameters collecting extra data to be reapplied by the caller
126
126
ascriptions : & mut Vec < Ascription < ' tcx > > ,
127
- inline_consts : & mut Vec < LocalDefId > ,
127
+ expanded_consts : & mut Vec < DefId > ,
128
128
) -> Result < Option < PatRangeBoundary < ' tcx > > , ErrorGuaranteed > {
129
129
let Some ( expr) = expr else { return Ok ( None ) } ;
130
130
@@ -139,10 +139,8 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
139
139
ascriptions. push ( ascription) ;
140
140
kind = subpattern. kind ;
141
141
}
142
- PatKind :: ExpandedConstant { is_inline, def_id, subpattern } => {
143
- if is_inline {
144
- inline_consts. extend ( def_id. as_local ( ) ) ;
145
- }
142
+ PatKind :: ExpandedConstant { def_id, subpattern } => {
143
+ expanded_consts. push ( def_id) ;
146
144
kind = subpattern. kind ;
147
145
}
148
146
_ => break ,
@@ -221,10 +219,10 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
221
219
222
220
// Collect extra data while lowering the endpoints, to be reapplied later.
223
221
let mut ascriptions = vec ! [ ] ;
224
- let mut inline_consts = vec ! [ ] ;
222
+ let mut expanded_consts = vec ! [ ] ;
225
223
226
224
let mut lower_endpoint =
227
- |expr| self . lower_pattern_range_endpoint ( expr, & mut ascriptions, & mut inline_consts ) ;
225
+ |expr| self . lower_pattern_range_endpoint ( expr, & mut ascriptions, & mut expanded_consts ) ;
228
226
229
227
let lo = lower_endpoint ( lo_expr) ?. unwrap_or ( PatRangeBoundary :: NegInfinity ) ;
230
228
let hi = lower_endpoint ( hi_expr) ?. unwrap_or ( PatRangeBoundary :: PosInfinity ) ;
@@ -269,17 +267,12 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
269
267
// `Foo::<'a>::A..=Foo::B`), we need to put the ascriptions for the associated
270
268
// constants somewhere. Have them on the range pattern.
271
269
for ascription in ascriptions {
272
- kind = PatKind :: AscribeUserType {
273
- ascription,
274
- subpattern : Box :: new ( Pat { span, ty, kind } ) ,
275
- } ;
270
+ let subpattern = Box :: new ( Pat { span, ty, kind } ) ;
271
+ kind = PatKind :: AscribeUserType { ascription, subpattern } ;
276
272
}
277
- for def in inline_consts {
278
- kind = PatKind :: ExpandedConstant {
279
- def_id : def. to_def_id ( ) ,
280
- is_inline : true ,
281
- subpattern : Box :: new ( Pat { span, ty, kind } ) ,
282
- } ;
273
+ for def_id in expanded_consts {
274
+ let subpattern = Box :: new ( Pat { span, ty, kind } ) ;
275
+ kind = PatKind :: ExpandedConstant { def_id, subpattern } ;
283
276
}
284
277
Ok ( kind)
285
278
}
0 commit comments