@@ -83,16 +83,14 @@ impl PrettyPrintMirOptions {
8383/// - `foo & nll | bar & typeck` == match if `foo` and `nll` both appear in the name
8484/// or `typeck` and `bar` both appear in the name.
8585#[ inline]
86- pub fn dump_mir < ' tcx , F > (
86+ pub fn dump_mir < ' tcx > (
8787 tcx : TyCtxt < ' tcx > ,
8888 pass_num : bool ,
8989 pass_name : & str ,
9090 disambiguator : & dyn Display ,
9191 body : & Body < ' tcx > ,
92- extra_data : F ,
93- ) where
94- F : Fn ( PassWhere , & mut dyn io:: Write ) -> io:: Result < ( ) > ,
95- {
92+ extra_data : & dyn Fn ( PassWhere , & mut dyn io:: Write ) -> io:: Result < ( ) > ,
93+ ) {
9694 dump_mir_with_options (
9795 tcx,
9896 pass_num,
@@ -110,17 +108,15 @@ pub fn dump_mir<'tcx, F>(
110108/// See [`dump_mir`] for more details.
111109///
112110#[ inline]
113- pub fn dump_mir_with_options < ' tcx , F > (
111+ pub fn dump_mir_with_options < ' tcx > (
114112 tcx : TyCtxt < ' tcx > ,
115113 pass_num : bool ,
116114 pass_name : & str ,
117115 disambiguator : & dyn Display ,
118116 body : & Body < ' tcx > ,
119- extra_data : F ,
117+ extra_data : & dyn Fn ( PassWhere , & mut dyn io :: Write ) -> io :: Result < ( ) > ,
120118 options : PrettyPrintMirOptions ,
121- ) where
122- F : Fn ( PassWhere , & mut dyn io:: Write ) -> io:: Result < ( ) > ,
123- {
119+ ) {
124120 if !dump_enabled ( tcx, pass_name, body. source . def_id ( ) ) {
125121 return ;
126122 }
@@ -165,18 +161,15 @@ pub fn dump_enabled(tcx: TyCtxt<'_>, pass_name: &str, def_id: DefId) -> bool {
165161/// most of the MIR dumping occurs, if one needs to export it to a file they have created with
166162/// [create_dump_file], rather than to a new file created as part of [dump_mir], or to stdout/stderr
167163/// for debugging purposes.
168- pub fn dump_mir_to_writer < ' tcx , F > (
164+ pub fn dump_mir_to_writer < ' tcx > (
169165 tcx : TyCtxt < ' tcx > ,
170166 pass_name : & str ,
171167 disambiguator : & dyn Display ,
172168 body : & Body < ' tcx > ,
173169 w : & mut dyn io:: Write ,
174- extra_data : F ,
170+ extra_data : & dyn Fn ( PassWhere , & mut dyn io :: Write ) -> io :: Result < ( ) > ,
175171 options : PrettyPrintMirOptions ,
176- ) -> io:: Result < ( ) >
177- where
178- F : Fn ( PassWhere , & mut dyn io:: Write ) -> io:: Result < ( ) > ,
179- {
172+ ) -> io:: Result < ( ) > {
180173 // see notes on #41697 above
181174 let def_path =
182175 ty:: print:: with_forced_impl_filename_line!( tcx. def_path_str( body. source. def_id( ) ) ) ;
@@ -193,7 +186,7 @@ where
193186 writeln ! ( w) ?;
194187 extra_data ( PassWhere :: BeforeCFG , w) ?;
195188 write_user_type_annotations ( tcx, body, w) ?;
196- write_mir_fn ( tcx, body, & extra_data, w, options) ?;
189+ write_mir_fn ( tcx, body, extra_data, w, options) ?;
197190 extra_data ( PassWhere :: AfterCFG , w)
198191}
199192
@@ -369,16 +362,13 @@ pub fn write_mir_pretty<'tcx>(
369362}
370363
371364/// Write out a human-readable textual representation for the given function.
372- pub fn write_mir_fn < ' tcx , F > (
365+ pub fn write_mir_fn < ' tcx > (
373366 tcx : TyCtxt < ' tcx > ,
374367 body : & Body < ' tcx > ,
375- extra_data : & F ,
368+ extra_data : & dyn Fn ( PassWhere , & mut dyn io :: Write ) -> io :: Result < ( ) > ,
376369 w : & mut dyn io:: Write ,
377370 options : PrettyPrintMirOptions ,
378- ) -> io:: Result < ( ) >
379- where
380- F : Fn ( PassWhere , & mut dyn io:: Write ) -> io:: Result < ( ) > ,
381- {
371+ ) -> io:: Result < ( ) > {
382372 write_mir_intro ( tcx, body, w, options) ?;
383373 for block in body. basic_blocks . indices ( ) {
384374 extra_data ( PassWhere :: BeforeBlock ( block) , w) ?;
@@ -706,17 +696,14 @@ pub fn dump_mir_def_ids(tcx: TyCtxt<'_>, single: Option<DefId>) -> Vec<DefId> {
706696// Basic blocks and their parts (statements, terminators, ...)
707697
708698/// Write out a human-readable textual representation for the given basic block.
709- fn write_basic_block < ' tcx , F > (
699+ fn write_basic_block < ' tcx > (
710700 tcx : TyCtxt < ' tcx > ,
711701 block : BasicBlock ,
712702 body : & Body < ' tcx > ,
713- extra_data : & F ,
703+ extra_data : & dyn Fn ( PassWhere , & mut dyn io :: Write ) -> io :: Result < ( ) > ,
714704 w : & mut dyn io:: Write ,
715705 options : PrettyPrintMirOptions ,
716- ) -> io:: Result < ( ) >
717- where
718- F : Fn ( PassWhere , & mut dyn io:: Write ) -> io:: Result < ( ) > ,
719- {
706+ ) -> io:: Result < ( ) > {
720707 let data = & body[ block] ;
721708
722709 // Basic block label at the top.
@@ -748,9 +735,7 @@ where
748735 write_extra (
749736 tcx,
750737 w,
751- |visitor| {
752- visitor. visit_statement ( statement, current_location) ;
753- } ,
738+ & |visitor| visitor. visit_statement ( statement, current_location) ,
754739 options,
755740 ) ?;
756741
@@ -783,9 +768,7 @@ where
783768 write_extra (
784769 tcx,
785770 w,
786- |visitor| {
787- visitor. visit_terminator ( data. terminator ( ) , current_location) ;
788- } ,
771+ & |visitor| visitor. visit_terminator ( data. terminator ( ) , current_location) ,
789772 options,
790773 ) ?;
791774 }
@@ -1360,15 +1343,12 @@ fn post_fmt_projection(projection: &[PlaceElem<'_>], fmt: &mut Formatter<'_>) ->
13601343/// After we print the main statement, we sometimes dump extra
13611344/// information. There's often a lot of little things "nuzzled up" in
13621345/// a statement.
1363- fn write_extra < ' tcx , F > (
1346+ fn write_extra < ' tcx > (
13641347 tcx : TyCtxt < ' tcx > ,
13651348 write : & mut dyn io:: Write ,
1366- visit_op : F ,
1349+ visit_op : & dyn Fn ( & mut ExtraComments < ' tcx > ) ,
13671350 options : PrettyPrintMirOptions ,
1368- ) -> io:: Result < ( ) >
1369- where
1370- F : Fn ( & mut ExtraComments < ' tcx > ) ,
1371- {
1351+ ) -> io:: Result < ( ) > {
13721352 if options. include_extra_comments {
13731353 let mut extra_comments = ExtraComments { tcx, comments : vec ! [ ] } ;
13741354 visit_op ( & mut extra_comments) ;
0 commit comments