@@ -184,6 +184,11 @@ impl ImportResolution {
184184 }
185185}
186186
187+ struct ImportResolvingError {
188+ span : Span ,
189+ path : String ,
190+ help : String ,
191+ }
187192
188193struct ImportResolver < ' a , ' b : ' a , ' tcx : ' b > {
189194 resolver : & ' a mut Resolver < ' b , ' tcx >
@@ -218,16 +223,16 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
218223 if self . resolver . unresolved_imports == prev_unresolved_imports {
219224 // resolving failed
220225 if errors. len ( ) > 0 {
221- for ( span , path , help ) in errors {
226+ for e in errors {
222227 resolve_error ( self . resolver ,
223- span,
224- ResolutionError :: UnresolvedImport ( Some ( ( & * path, & * help) ) ) ) ;
228+ e . span ,
229+ ResolutionError :: UnresolvedImport ( Some ( ( & e . path , & e . help ) ) ) ) ;
225230 }
226231 } else {
227- // report unresolved imports only if no hard error was already reported
228- // to avoid generating multiple errors on the same import
229- // imports that are still undeterminate at this point are actually blocked
230- // by errored imports, so there is no point reporting them
232+ // Report unresolved imports only if no hard error was already reported
233+ // to avoid generating multiple errors on the same import.
234+ // Imports that are still indeterminate at this point are actually blocked
235+ // by errored imports, so there is no point reporting them.
231236 self . resolver . report_unresolved_imports ( module_root) ;
232237 }
233238 break ;
@@ -241,7 +246,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
241246 /// Attempts to resolve imports for the given module and all of its
242247 /// submodules.
243248 fn resolve_imports_for_module_subtree ( & mut self , module_ : Rc < Module > )
244- -> Vec < ( Span , String , String ) > {
249+ -> Vec < ImportResolvingError > {
245250 let mut errors = Vec :: new ( ) ;
246251 debug ! ( "(resolving imports for module subtree) resolving {}" ,
247252 module_to_string( & * module_) ) ;
@@ -269,7 +274,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
269274 }
270275
271276 /// Attempts to resolve imports for the given module only.
272- fn resolve_imports_for_module ( & mut self , module : Rc < Module > ) -> Vec < ( Span , String , String ) > {
277+ fn resolve_imports_for_module ( & mut self , module : Rc < Module > ) -> Vec < ImportResolvingError > {
273278 let mut errors = Vec :: new ( ) ;
274279
275280 if module. all_imports_resolved ( ) {
@@ -292,12 +297,14 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
292297 Some ( ( span, msg) ) => ( span, format ! ( ". {}" , msg) ) ,
293298 None => ( import_directive. span , String :: new ( ) )
294299 } ;
295- errors. push ( ( span,
296- import_path_to_string (
297- & import_directive. module_path ,
298- import_directive. subclass
299- ) ,
300- help) )
300+ errors. push ( ImportResolvingError {
301+ span : span,
302+ path : import_path_to_string (
303+ & import_directive. module_path ,
304+ import_directive. subclass
305+ ) ,
306+ help : help
307+ } ) ;
301308 }
302309 ResolveResult :: Indeterminate => { }
303310 ResolveResult :: Success ( ( ) ) => {
0 commit comments