File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
compiler/rustc_session/src Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -2129,6 +2129,12 @@ fn collect_print_requests(
2129
2129
( "deployment-target" , PrintKind :: DeploymentTarget ) ,
2130
2130
] ;
2131
2131
2132
+ // We disallow reusing the same path in multiple prints, such as `--print
2133
+ // cfg=output.txt --print link-args=output.txt`, because outputs are printed
2134
+ // by disparate pieces of the compiler, and keeping track of which files
2135
+ // need to be overwritten vs appended to is annoying.
2136
+ let mut printed_paths = FxHashSet :: default ( ) ;
2137
+
2132
2138
prints. extend ( matches. opt_strs ( "print" ) . into_iter ( ) . map ( |req| {
2133
2139
let ( req, out) = split_out_file_name ( & req) ;
2134
2140
@@ -2165,6 +2171,15 @@ fn collect_print_requests(
2165
2171
} ;
2166
2172
2167
2173
let out = out. unwrap_or ( OutFileName :: Stdout ) ;
2174
+ if let OutFileName :: Real ( path) = & out {
2175
+ if !printed_paths. insert ( path. clone ( ) ) {
2176
+ handler. early_error ( format ! (
2177
+ "cannot print multiple outputs to the same path: {}" ,
2178
+ path. display( ) ,
2179
+ ) ) ;
2180
+ }
2181
+ }
2182
+
2168
2183
PrintRequest { kind, out }
2169
2184
} ) ) ;
2170
2185
You can’t perform that action at this time.
0 commit comments