@@ -144,7 +144,7 @@ fn run_cargo(
144144 let mut did_trybuild = false ;
145145 let mut ran_out_of_space = false ;
146146 let mut error_codes = BTreeSet :: new ( ) ;
147- let mut deps = BTreeSet :: new ( ) ;
147+ let mut deps: Option < BTreeSet < Crate > > = None ;
148148
149149 let mut detect_error = |line : & str , actions : & mut ProcessLinesActions | {
150150 if line. contains ( "urlopen error" ) && line. contains ( "Temporary failure in name resolution" ) {
@@ -189,11 +189,13 @@ fn run_cargo(
189189 // If the error is in a crate that is not local then it's referred to a dependency
190190 // of the current crate
191191 ( DiagnosticLevel :: Error , pkgid) => {
192+ let deps = deps. get_or_insert_default ( ) ;
192193 if let Ok ( krate) = Crate :: try_from ( pkgid) {
193194 deps. insert ( krate) ;
194195 }
195196 }
196197 ( DiagnosticLevel :: Ice , pkgid) => {
198+ let deps = deps. get_or_insert_default ( ) ;
197199 if let Ok ( krate) = Crate :: try_from ( pkgid) {
198200 deps. insert ( krate) ;
199201 }
@@ -233,7 +235,7 @@ fn run_cargo(
233235 Err ( e. context ( FailureReason :: ICE ) . into ( ) )
234236 } else if ran_out_of_space {
235237 Err ( e. context ( FailureReason :: NoSpace ) . into ( ) )
236- } else if !deps . is_empty ( ) {
238+ } else if let Some ( deps ) = deps {
237239 Err ( e. context ( FailureReason :: DependsOn ( deps) ) . into ( ) )
238240 } else if !error_codes. is_empty ( ) {
239241 Err ( e. context ( FailureReason :: CompilerError ( error_codes) ) . into ( ) )
0 commit comments