@@ -21,7 +21,6 @@ use rustc_middle::ty::adjustment::{PatAdjust, PatAdjustment};
2121use rustc_middle:: ty:: layout:: IntegerExt ;
2222use rustc_middle:: ty:: { self , CanonicalUserTypeAnnotation , Ty , TyCtxt } ;
2323use rustc_middle:: { bug, span_bug} ;
24- use rustc_span:: def_id:: DefId ;
2524use rustc_span:: { ErrorGuaranteed , Span } ;
2625use tracing:: { debug, instrument} ;
2726
@@ -131,9 +130,8 @@ impl<'tcx> PatCtxt<'tcx> {
131130 fn lower_pattern_range_endpoint (
132131 & mut self ,
133132 expr : Option < & ' tcx hir:: PatExpr < ' tcx > > ,
134- // Out-parameters collecting extra data to be reapplied by the caller
133+ // Out-parameter collecting extra data to be reapplied by the caller
135134 ascriptions : & mut Vec < Ascription < ' tcx > > ,
136- expanded_consts : & mut Vec < DefId > ,
137135 ) -> Result < Option < PatRangeBoundary < ' tcx > > , ErrorGuaranteed > {
138136 let Some ( expr) = expr else { return Ok ( None ) } ;
139137
@@ -148,8 +146,10 @@ impl<'tcx> PatCtxt<'tcx> {
148146 ascriptions. push ( ascription) ;
149147 kind = subpattern. kind ;
150148 }
151- PatKind :: ExpandedConstant { def_id, subpattern } => {
152- expanded_consts. push ( def_id) ;
149+ PatKind :: ExpandedConstant { def_id : _, subpattern } => {
150+ // Expanded-constant nodes are currently only needed by
151+ // diagnostics that don't apply to range patterns, so we
152+ // can just discard them here.
153153 kind = subpattern. kind ;
154154 }
155155 _ => break ,
@@ -227,10 +227,7 @@ impl<'tcx> PatCtxt<'tcx> {
227227
228228 // Collect extra data while lowering the endpoints, to be reapplied later.
229229 let mut ascriptions = vec ! [ ] ;
230- let mut expanded_consts = vec ! [ ] ;
231-
232- let mut lower_endpoint =
233- |expr| self . lower_pattern_range_endpoint ( expr, & mut ascriptions, & mut expanded_consts) ;
230+ let mut lower_endpoint = |expr| self . lower_pattern_range_endpoint ( expr, & mut ascriptions) ;
234231
235232 let lo = lower_endpoint ( lo_expr) ?. unwrap_or ( PatRangeBoundary :: NegInfinity ) ;
236233 let hi = lower_endpoint ( hi_expr) ?. unwrap_or ( PatRangeBoundary :: PosInfinity ) ;
@@ -282,10 +279,11 @@ impl<'tcx> PatCtxt<'tcx> {
282279 let subpattern = Box :: new ( Pat { span, ty, kind } ) ;
283280 kind = PatKind :: AscribeUserType { ascription, subpattern } ;
284281 }
285- for def_id in expanded_consts {
286- let subpattern = Box :: new ( Pat { span, ty, kind } ) ;
287- kind = PatKind :: ExpandedConstant { def_id, subpattern } ;
288- }
282+ // `PatKind::ExpandedConstant` wrappers from range endpoints used to
283+ // also be preserved here, but that was only needed for unsafeck of
284+ // inline `const { .. }` patterns, which were removed by
285+ // <https://github.com/rust-lang/rust/pull/138492>.
286+
289287 Ok ( kind)
290288 }
291289
0 commit comments