@@ -83,16 +83,14 @@ impl PrettyPrintMirOptions {
83
83
/// - `foo & nll | bar & typeck` == match if `foo` and `nll` both appear in the name
84
84
/// or `typeck` and `bar` both appear in the name.
85
85
#[ inline]
86
- pub fn dump_mir < ' tcx , F > (
86
+ pub fn dump_mir < ' tcx > (
87
87
tcx : TyCtxt < ' tcx > ,
88
88
pass_num : bool ,
89
89
pass_name : & str ,
90
90
disambiguator : & dyn Display ,
91
91
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
+ ) {
96
94
dump_mir_with_options (
97
95
tcx,
98
96
pass_num,
@@ -110,17 +108,15 @@ pub fn dump_mir<'tcx, F>(
110
108
/// See [`dump_mir`] for more details.
111
109
///
112
110
#[ inline]
113
- pub fn dump_mir_with_options < ' tcx , F > (
111
+ pub fn dump_mir_with_options < ' tcx > (
114
112
tcx : TyCtxt < ' tcx > ,
115
113
pass_num : bool ,
116
114
pass_name : & str ,
117
115
disambiguator : & dyn Display ,
118
116
body : & Body < ' tcx > ,
119
- extra_data : F ,
117
+ extra_data : & dyn Fn ( PassWhere , & mut dyn io :: Write ) -> io :: Result < ( ) > ,
120
118
options : PrettyPrintMirOptions ,
121
- ) where
122
- F : Fn ( PassWhere , & mut dyn io:: Write ) -> io:: Result < ( ) > ,
123
- {
119
+ ) {
124
120
if !dump_enabled ( tcx, pass_name, body. source . def_id ( ) ) {
125
121
return ;
126
122
}
@@ -165,18 +161,15 @@ pub fn dump_enabled(tcx: TyCtxt<'_>, pass_name: &str, def_id: DefId) -> bool {
165
161
/// most of the MIR dumping occurs, if one needs to export it to a file they have created with
166
162
/// [create_dump_file], rather than to a new file created as part of [dump_mir], or to stdout/stderr
167
163
/// for debugging purposes.
168
- pub fn dump_mir_to_writer < ' tcx , F > (
164
+ pub fn dump_mir_to_writer < ' tcx > (
169
165
tcx : TyCtxt < ' tcx > ,
170
166
pass_name : & str ,
171
167
disambiguator : & dyn Display ,
172
168
body : & Body < ' tcx > ,
173
169
w : & mut dyn io:: Write ,
174
- extra_data : F ,
170
+ extra_data : & dyn Fn ( PassWhere , & mut dyn io :: Write ) -> io :: Result < ( ) > ,
175
171
options : PrettyPrintMirOptions ,
176
- ) -> io:: Result < ( ) >
177
- where
178
- F : Fn ( PassWhere , & mut dyn io:: Write ) -> io:: Result < ( ) > ,
179
- {
172
+ ) -> io:: Result < ( ) > {
180
173
// see notes on #41697 above
181
174
let def_path =
182
175
ty:: print:: with_forced_impl_filename_line!( tcx. def_path_str( body. source. def_id( ) ) ) ;
@@ -193,7 +186,7 @@ where
193
186
writeln ! ( w) ?;
194
187
extra_data ( PassWhere :: BeforeCFG , w) ?;
195
188
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) ?;
197
190
extra_data ( PassWhere :: AfterCFG , w)
198
191
}
199
192
@@ -369,16 +362,13 @@ pub fn write_mir_pretty<'tcx>(
369
362
}
370
363
371
364
/// 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 > (
373
366
tcx : TyCtxt < ' tcx > ,
374
367
body : & Body < ' tcx > ,
375
- extra_data : & F ,
368
+ extra_data : & dyn Fn ( PassWhere , & mut dyn io :: Write ) -> io :: Result < ( ) > ,
376
369
w : & mut dyn io:: Write ,
377
370
options : PrettyPrintMirOptions ,
378
- ) -> io:: Result < ( ) >
379
- where
380
- F : Fn ( PassWhere , & mut dyn io:: Write ) -> io:: Result < ( ) > ,
381
- {
371
+ ) -> io:: Result < ( ) > {
382
372
write_mir_intro ( tcx, body, w, options) ?;
383
373
for block in body. basic_blocks . indices ( ) {
384
374
extra_data ( PassWhere :: BeforeBlock ( block) , w) ?;
@@ -706,17 +696,14 @@ pub fn dump_mir_def_ids(tcx: TyCtxt<'_>, single: Option<DefId>) -> Vec<DefId> {
706
696
// Basic blocks and their parts (statements, terminators, ...)
707
697
708
698
/// 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 > (
710
700
tcx : TyCtxt < ' tcx > ,
711
701
block : BasicBlock ,
712
702
body : & Body < ' tcx > ,
713
- extra_data : & F ,
703
+ extra_data : & dyn Fn ( PassWhere , & mut dyn io :: Write ) -> io :: Result < ( ) > ,
714
704
w : & mut dyn io:: Write ,
715
705
options : PrettyPrintMirOptions ,
716
- ) -> io:: Result < ( ) >
717
- where
718
- F : Fn ( PassWhere , & mut dyn io:: Write ) -> io:: Result < ( ) > ,
719
- {
706
+ ) -> io:: Result < ( ) > {
720
707
let data = & body[ block] ;
721
708
722
709
// Basic block label at the top.
@@ -748,9 +735,7 @@ where
748
735
write_extra (
749
736
tcx,
750
737
w,
751
- |visitor| {
752
- visitor. visit_statement ( statement, current_location) ;
753
- } ,
738
+ & |visitor| visitor. visit_statement ( statement, current_location) ,
754
739
options,
755
740
) ?;
756
741
@@ -783,9 +768,7 @@ where
783
768
write_extra (
784
769
tcx,
785
770
w,
786
- |visitor| {
787
- visitor. visit_terminator ( data. terminator ( ) , current_location) ;
788
- } ,
771
+ & |visitor| visitor. visit_terminator ( data. terminator ( ) , current_location) ,
789
772
options,
790
773
) ?;
791
774
}
@@ -1360,15 +1343,12 @@ fn post_fmt_projection(projection: &[PlaceElem<'_>], fmt: &mut Formatter<'_>) ->
1360
1343
/// After we print the main statement, we sometimes dump extra
1361
1344
/// information. There's often a lot of little things "nuzzled up" in
1362
1345
/// a statement.
1363
- fn write_extra < ' tcx , F > (
1346
+ fn write_extra < ' tcx > (
1364
1347
tcx : TyCtxt < ' tcx > ,
1365
1348
write : & mut dyn io:: Write ,
1366
- visit_op : F ,
1349
+ visit_op : & dyn Fn ( & mut ExtraComments < ' tcx > ) ,
1367
1350
options : PrettyPrintMirOptions ,
1368
- ) -> io:: Result < ( ) >
1369
- where
1370
- F : Fn ( & mut ExtraComments < ' tcx > ) ,
1371
- {
1351
+ ) -> io:: Result < ( ) > {
1372
1352
if options. include_extra_comments {
1373
1353
let mut extra_comments = ExtraComments { tcx, comments : vec ! [ ] } ;
1374
1354
visit_op ( & mut extra_comments) ;
0 commit comments