File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1084,7 +1084,7 @@ fn parse_arguments(arguments: &[OsString], cwd: &Path) -> CompilerArguments<Pars
10841084 let mut gcno = false ;
10851085 let mut target_json = None ;
10861086
1087- for arg in ArgsIter :: new ( arguments. iter ( ) . cloned ( ) , & ARGS [ ..] ) {
1087+ for ( idx , arg) in ArgsIter :: new ( arguments. iter ( ) . cloned ( ) , & ARGS [ ..] ) . enumerate ( ) {
10881088 let arg = try_or_cannot_cache ! ( arg, "argument parse" ) ;
10891089 match arg. get_data ( ) {
10901090 Some ( TooHardFlag ) | Some ( TooHardPath ( _) ) => {
@@ -1176,9 +1176,21 @@ fn parse_arguments(arguments: &[OsString], cwd: &Path) -> CompilerArguments<Pars
11761176 None => {
11771177 match arg {
11781178 Argument :: Raw ( ref val) => {
1179+ if idx == 0 {
1180+ if let Some ( value) = val. to_str ( ) {
1181+ if value == "rustc" {
1182+ // If the first argument is rustc, it's likely called via clippy-driver,
1183+ // so it's not actually an input file, which means we should discount it.
1184+ continue ;
1185+ }
1186+ }
1187+ }
11791188 if input. is_some ( ) {
11801189 // Can't cache compilations with multiple inputs.
1181- cannot_cache ! ( "multiple input files" ) ;
1190+ cannot_cache ! (
1191+ "multiple input files" ,
1192+ format!( "prev = {input:?}, next = {arg:?}" )
1193+ ) ;
11821194 }
11831195 input = Some ( val. clone ( ) ) ;
11841196 }
You can’t perform that action at this time.
0 commit comments