@@ -1178,7 +1178,7 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
1178
1178
"Pretty-print the input instead of compiling;
1179
1179
valid types are: `normal` (un-annotated source),
1180
1180
`expanded` (crates expanded), or
1181
- `expanded, identified` (fully parenthesized, AST nodes with IDs)." ,
1181
+ `expanded+ identified` (fully parenthesized, AST nodes with IDs)." ,
1182
1182
"TYPE" ,
1183
1183
) ,
1184
1184
opt:: multi_s(
@@ -2056,49 +2056,51 @@ fn parse_pretty(
2056
2056
matches : & getopts:: Matches ,
2057
2057
debugging_opts : & DebuggingOptions ,
2058
2058
efmt : ErrorOutputType ,
2059
- ) -> Option < PpMode > {
2060
- fn parse_pretty_inner ( efmt : ErrorOutputType , name : & str , extended : bool ) -> PpMode {
2059
+ ) -> Option < Vec < PpMode > > {
2060
+ fn parse_pretty_inner ( efmt : ErrorOutputType , list : & str , extended : bool ) -> Vec < PpMode > {
2061
2061
use PpMode :: * ;
2062
- let first = match ( name, extended) {
2063
- ( "normal" , _) => Source ( PpSourceMode :: Normal ) ,
2064
- ( "identified" , _) => Source ( PpSourceMode :: Identified ) ,
2065
- ( "everybody_loops" , true ) => Source ( PpSourceMode :: EveryBodyLoops ) ,
2066
- ( "expanded" , _) => Source ( PpSourceMode :: Expanded ) ,
2067
- ( "expanded,identified" , _) => Source ( PpSourceMode :: ExpandedIdentified ) ,
2068
- ( "expanded,hygiene" , _) => Source ( PpSourceMode :: ExpandedHygiene ) ,
2069
- ( "hir" , true ) => Hir ( PpHirMode :: Normal ) ,
2070
- ( "hir,identified" , true ) => Hir ( PpHirMode :: Identified ) ,
2071
- ( "hir,typed" , true ) => Hir ( PpHirMode :: Typed ) ,
2072
- ( "hir-tree" , true ) => HirTree ,
2073
- ( "mir" , true ) => Mir ,
2074
- ( "mir-cfg" , true ) => MirCFG ,
2075
- _ => {
2076
- if extended {
2077
- early_error (
2078
- efmt,
2079
- & format ! (
2080
- "argument to `unpretty` must be one of `normal`, \
2081
- `expanded`, `identified`, `expanded,identified`, \
2082
- `expanded,hygiene`, `everybody_loops`, \
2083
- `hir`, `hir,identified`, `hir,typed`, `hir-tree`, \
2084
- `mir` or `mir-cfg`; got {}",
2085
- name
2086
- ) ,
2087
- ) ;
2088
- } else {
2089
- early_error (
2090
- efmt,
2091
- & format ! (
2092
- "argument to `pretty` must be one of `normal`, \
2093
- `expanded`, `identified`, or `expanded,identified`; got {}",
2094
- name
2095
- ) ,
2096
- ) ;
2062
+ list. split ( "," ) . map ( |ppmode| {
2063
+ let first = match ( ppmode, extended) {
2064
+ ( "normal" , _) => Source ( PpSourceMode :: Normal ) ,
2065
+ ( "identified" , _) => Source ( PpSourceMode :: Identified ) ,
2066
+ ( "everybody_loops" , true ) => Source ( PpSourceMode :: EveryBodyLoops ) ,
2067
+ ( "expanded" , _) => Source ( PpSourceMode :: Expanded ) ,
2068
+ ( "expanded+identified" , _) => Source ( PpSourceMode :: ExpandedIdentified ) ,
2069
+ ( "expanded+hygiene" , _) => Source ( PpSourceMode :: ExpandedHygiene ) ,
2070
+ ( "hir" , true ) => Hir ( PpHirMode :: Normal ) ,
2071
+ ( "hir+identified" , true ) => Hir ( PpHirMode :: Identified ) ,
2072
+ ( "hir+typed" , true ) => Hir ( PpHirMode :: Typed ) ,
2073
+ ( "hir-tree" , true ) => HirTree ,
2074
+ ( "mir" , true ) => Mir ,
2075
+ ( "mir-cfg" , true ) => MirCFG ,
2076
+ _ => {
2077
+ if extended {
2078
+ early_error (
2079
+ efmt,
2080
+ & format ! (
2081
+ "argument to `unpretty` must be one of `normal`, \
2082
+ `expanded`, `identified`, `expanded+identified`, \
2083
+ `expanded+hygiene`, `everybody_loops`, \
2084
+ `hir`, `hir+identified`, `hir+typed`, `hir-tree`, \
2085
+ `mir` or `mir-cfg`; got {}",
2086
+ ppmode
2087
+ ) ,
2088
+ ) ;
2089
+ } else {
2090
+ early_error (
2091
+ efmt,
2092
+ & format ! (
2093
+ "argument to `pretty` must be a comma-separated list or one of `normal`, \
2094
+ `expanded`, `identified`, or `expanded+identified`; got {}",
2095
+ ppmode
2096
+ ) ,
2097
+ ) ;
2098
+ }
2097
2099
}
2098
- }
2099
- } ;
2100
- tracing :: debug! ( "got unpretty option: {:?}" , first) ;
2101
- first
2100
+ } ;
2101
+ tracing :: debug! ( "got unpretty option: {:?}" , first ) ;
2102
+ first
2103
+ } ) . collect ( )
2102
2104
}
2103
2105
2104
2106
if debugging_opts. unstable_options {
@@ -2227,19 +2229,19 @@ pub enum PpSourceMode {
2227
2229
Expanded ,
2228
2230
/// `--pretty=identified`
2229
2231
Identified ,
2230
- /// `--pretty=expanded, identified`
2232
+ /// `--pretty=expanded+ identified`
2231
2233
ExpandedIdentified ,
2232
- /// `--pretty=expanded, hygiene`
2234
+ /// `--pretty=expanded+ hygiene`
2233
2235
ExpandedHygiene ,
2234
2236
}
2235
2237
2236
2238
#[ derive( Copy , Clone , PartialEq , Debug ) ]
2237
2239
pub enum PpHirMode {
2238
2240
/// `-Zunpretty=hir`
2239
2241
Normal ,
2240
- /// `-Zunpretty=hir, identified`
2242
+ /// `-Zunpretty=hir+ identified`
2241
2243
Identified ,
2242
- /// `-Zunpretty=hir, typed`
2244
+ /// `-Zunpretty=hir+ typed`
2243
2245
Typed ,
2244
2246
}
2245
2247
0 commit comments