@@ -2011,13 +2011,7 @@ fn parse_output_types(
2011
2011
if !unstable_opts. parse_only {
2012
2012
for list in matches. opt_strs ( "emit" ) {
2013
2013
for output_type in list. split ( ',' ) {
2014
- let ( shorthand, path) = match output_type. split_once ( '=' ) {
2015
- None => ( output_type, None ) ,
2016
- Some ( ( shorthand, "-" ) ) => ( shorthand, Some ( OutFileName :: Stdout ) ) ,
2017
- Some ( ( shorthand, path) ) => {
2018
- ( shorthand, Some ( OutFileName :: Real ( PathBuf :: from ( path) ) ) )
2019
- }
2020
- } ;
2014
+ let ( shorthand, path) = split_out_file_name ( output_type) ;
2021
2015
let output_type = OutputType :: from_shorthand ( shorthand) . unwrap_or_else ( || {
2022
2016
handler. early_error ( format ! (
2023
2017
"unknown emission type: `{shorthand}` - expected one of: {display}" ,
@@ -2034,6 +2028,14 @@ fn parse_output_types(
2034
2028
OutputTypes ( output_types)
2035
2029
}
2036
2030
2031
+ fn split_out_file_name ( arg : & str ) -> ( & str , Option < OutFileName > ) {
2032
+ match arg. split_once ( '=' ) {
2033
+ None => ( arg, None ) ,
2034
+ Some ( ( kind, "-" ) ) => ( kind, Some ( OutFileName :: Stdout ) ) ,
2035
+ Some ( ( kind, path) ) => ( kind, Some ( OutFileName :: Real ( PathBuf :: from ( path) ) ) ) ,
2036
+ }
2037
+ }
2038
+
2037
2039
fn should_override_cgus_and_disable_thinlto (
2038
2040
handler : & EarlyErrorHandler ,
2039
2041
output_types : & OutputTypes ,
@@ -2128,6 +2130,8 @@ fn collect_print_requests(
2128
2130
] ;
2129
2131
2130
2132
prints. extend ( matches. opt_strs ( "print" ) . into_iter ( ) . map ( |req| {
2133
+ let ( req, out) = split_out_file_name ( & req) ;
2134
+
2131
2135
let kind = match PRINT_KINDS . iter ( ) . find ( |& & ( name, _) | name == req) {
2132
2136
Some ( ( _, PrintKind :: TargetSpec ) ) => {
2133
2137
if unstable_opts. unstable_options {
@@ -2159,7 +2163,9 @@ fn collect_print_requests(
2159
2163
) ) ;
2160
2164
}
2161
2165
} ;
2162
- PrintRequest { kind, out : OutFileName :: Stdout }
2166
+
2167
+ let out = out. unwrap_or ( OutFileName :: Stdout ) ;
2168
+ PrintRequest { kind, out }
2163
2169
} ) ) ;
2164
2170
2165
2171
prints
0 commit comments