@@ -184,6 +184,11 @@ impl ImportResolution {
184
184
}
185
185
}
186
186
187
+ struct ImportResolvingError {
188
+ span : Span ,
189
+ path : String ,
190
+ help : String ,
191
+ }
187
192
188
193
struct ImportResolver < ' a , ' b : ' a , ' tcx : ' b > {
189
194
resolver : & ' a mut Resolver < ' b , ' tcx >
@@ -218,16 +223,16 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
218
223
if self . resolver . unresolved_imports == prev_unresolved_imports {
219
224
// resolving failed
220
225
if errors. len ( ) > 0 {
221
- for ( span , path , help ) in errors {
226
+ for e in errors {
222
227
resolve_error ( self . resolver ,
223
- span,
224
- ResolutionError :: UnresolvedImport ( Some ( ( & * path, & * help) ) ) ) ;
228
+ e . span ,
229
+ ResolutionError :: UnresolvedImport ( Some ( ( & e . path , & e . help ) ) ) ) ;
225
230
}
226
231
} 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.
231
236
self . resolver . report_unresolved_imports ( module_root) ;
232
237
}
233
238
break ;
@@ -241,7 +246,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
241
246
/// Attempts to resolve imports for the given module and all of its
242
247
/// submodules.
243
248
fn resolve_imports_for_module_subtree ( & mut self , module_ : Rc < Module > )
244
- -> Vec < ( Span , String , String ) > {
249
+ -> Vec < ImportResolvingError > {
245
250
let mut errors = Vec :: new ( ) ;
246
251
debug ! ( "(resolving imports for module subtree) resolving {}" ,
247
252
module_to_string( & * module_) ) ;
@@ -269,7 +274,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
269
274
}
270
275
271
276
/// 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 > {
273
278
let mut errors = Vec :: new ( ) ;
274
279
275
280
if module. all_imports_resolved ( ) {
@@ -292,12 +297,14 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
292
297
Some ( ( span, msg) ) => ( span, format ! ( ". {}" , msg) ) ,
293
298
None => ( import_directive. span , String :: new ( ) )
294
299
} ;
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
+ } ) ;
301
308
}
302
309
ResolveResult :: Indeterminate => { }
303
310
ResolveResult :: Success ( ( ) ) => {
0 commit comments