@@ -57,9 +57,19 @@ pub enum PassWhere {
57
57
/// where `<filter>` takes the following forms:
58
58
///
59
59
/// - `all` -- dump MIR for all fns, all passes, all everything
60
- /// - `substring1&substring2,...` -- `&`-separated list of substrings
61
- /// that can appear in the pass-name or the `item_path_str` for the given
62
- /// node-id. If any one of the substrings match, the data is dumped out.
60
+ /// - a filter defined by a set of substrings combined with `&` and `|`
61
+ /// (`&` has higher precedence). At least one of the `|`-separated groups
62
+ /// must match; an `|`-separated group matches if all of its `&`-separated
63
+ /// substrings are matched.
64
+ ///
65
+ /// Example:
66
+ ///
67
+ /// - `nll` == match if `nll` appears in the name
68
+ /// - `foo & nll` == match if `foo` and `nll` both appear in the name
69
+ /// - `foo & nll | typeck` == match if `foo` and `nll` both appear in the name
70
+ /// or `typeck` appears in the name.
71
+ /// - `foo & nll | bar & typeck` == match if `foo` and `nll` both appear in the name
72
+ /// or `typeck` and `bar` both appear in the name.
63
73
pub fn dump_mir < ' a , ' gcx , ' tcx , F > (
64
74
tcx : TyCtxt < ' a , ' gcx , ' tcx > ,
65
75
pass_num : Option < & Display > ,
@@ -104,8 +114,10 @@ pub fn dump_enabled<'a, 'gcx, 'tcx>(
104
114
// see notes on #41697 below
105
115
tcx. item_path_str ( source. def_id )
106
116
} ) ;
107
- filters. split ( "&" ) . any ( |filter| {
108
- filter == "all" || pass_name. contains ( filter) || node_path. contains ( filter)
117
+ filters. split ( "|" ) . any ( |or_filter| {
118
+ or_filter. split ( "&" ) . all ( |and_filter| {
119
+ and_filter == "all" || pass_name. contains ( and_filter) || node_path. contains ( and_filter)
120
+ } )
109
121
} )
110
122
}
111
123
@@ -357,7 +369,8 @@ fn write_extra<'cx, 'gcx, 'tcx, F>(
357
369
write : & mut Write ,
358
370
mut visit_op : F ,
359
371
) -> io:: Result < ( ) >
360
- where F : FnMut ( & mut ExtraComments < ' cx , ' gcx , ' tcx > )
372
+ where
373
+ F : FnMut ( & mut ExtraComments < ' cx , ' gcx , ' tcx > ) ,
361
374
{
362
375
let mut extra_comments = ExtraComments {
363
376
_tcx : tcx,
0 commit comments