@@ -2190,34 +2190,40 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
21902190 // this is not *quite* right and changes the ordering of some output
21912191 // anyways.
21922192 let ( new_value, map) = if self . tcx ( ) . sess . verbose ( ) {
2193- // anon index + 1 (BrEnv takes 0) -> name
2194- let mut region_map: FxHashMap < _ , _ > = Default :: default ( ) ;
2195- let bound_vars = value. bound_vars ( ) ;
2196- for var in bound_vars {
2197- let ty:: BoundVariableKind :: Region ( var) = var else { continue } ;
2198- match var {
2199- ty:: BrAnon ( _) | ty:: BrEnv => {
2200- start_or_continue ( & mut self , "for<" , ", " ) ;
2201- let name = next_name ( & self ) ;
2202- do_continue ( & mut self , name) ;
2203- region_map. insert ( var, ty:: BrNamed ( CRATE_DEF_ID . to_def_id ( ) , name) ) ;
2204- }
2205- ty:: BrNamed ( def_id, kw:: UnderscoreLifetime ) => {
2206- start_or_continue ( & mut self , "for<" , ", " ) ;
2207- let name = next_name ( & self ) ;
2208- do_continue ( & mut self , name) ;
2209- region_map. insert ( var, ty:: BrNamed ( def_id, name) ) ;
2210- }
2211- ty:: BrNamed ( _, name) => {
2212- start_or_continue ( & mut self , "for<" , ", " ) ;
2213- do_continue ( & mut self , name) ;
2193+ let regions: Vec < _ > = value
2194+ . bound_vars ( )
2195+ . into_iter ( )
2196+ . map ( |var| {
2197+ let ty:: BoundVariableKind :: Region ( var) = var else {
2198+ // This doesn't really matter because it doesn't get used,
2199+ // it's just an empty value
2200+ return ty:: BrAnon ( 0 ) ;
2201+ } ;
2202+ match var {
2203+ ty:: BrAnon ( _) | ty:: BrEnv => {
2204+ start_or_continue ( & mut self , "for<" , ", " ) ;
2205+ let name = next_name ( & self ) ;
2206+ do_continue ( & mut self , name) ;
2207+ ty:: BrNamed ( CRATE_DEF_ID . to_def_id ( ) , name)
2208+ }
2209+ ty:: BrNamed ( def_id, kw:: UnderscoreLifetime ) => {
2210+ start_or_continue ( & mut self , "for<" , ", " ) ;
2211+ let name = next_name ( & self ) ;
2212+ do_continue ( & mut self , name) ;
2213+ ty:: BrNamed ( def_id, name)
2214+ }
2215+ ty:: BrNamed ( def_id, name) => {
2216+ start_or_continue ( & mut self , "for<" , ", " ) ;
2217+ do_continue ( & mut self , name) ;
2218+ ty:: BrNamed ( def_id, name)
2219+ }
22142220 }
2215- }
2216- }
2221+ } )
2222+ . collect ( ) ;
22172223 start_or_continue ( & mut self , "" , "> " ) ;
22182224
22192225 self . tcx . replace_late_bound_regions ( value. clone ( ) , |br| {
2220- let kind = region_map [ & br. kind ] ;
2226+ let kind = regions [ br. var . as_usize ( ) ] ;
22212227 self . tcx . mk_region ( ty:: ReLateBound (
22222228 ty:: INNERMOST ,
22232229 ty:: BoundRegion { var : br. var , kind } ,
0 commit comments