@@ -4232,24 +4232,18 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
4232
4232
}
4233
4233
}
4234
4234
4235
- /// When name resolution fails, this method can be used to look up candidate
4236
- /// entities with the expected name. It allows filtering them using the
4237
- /// supplied predicate (which should be used to only accept the types of
4238
- /// definitions expected e.g. traits). The lookup spans across all crates.
4239
- ///
4240
- /// NOTE: The method does not look into imports, but this is not a problem,
4241
- /// since we report the definitions (thus, the de-aliased imports).
4242
- fn lookup_import_candidates < FilterFn > ( & mut self ,
4235
+ fn lookup_import_candidates_from_module < FilterFn > ( & mut self ,
4243
4236
lookup_name : Name ,
4244
4237
namespace : Namespace ,
4238
+ start_module : & ' a ModuleData < ' a > ,
4245
4239
filter_fn : FilterFn )
4246
4240
-> Vec < ImportSuggestion >
4247
4241
where FilterFn : Fn ( Def ) -> bool
4248
4242
{
4249
4243
let mut candidates = Vec :: new ( ) ;
4250
4244
let mut worklist = Vec :: new ( ) ;
4251
4245
let mut seen_modules = FxHashSet ( ) ;
4252
- worklist. push ( ( self . graph_root , Vec :: new ( ) , false ) ) ;
4246
+ worklist. push ( ( start_module , Vec :: new ( ) , false ) ) ;
4253
4247
4254
4248
while let Some ( ( in_module,
4255
4249
path_segments,
@@ -4318,6 +4312,23 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
4318
4312
candidates
4319
4313
}
4320
4314
4315
+ /// When name resolution fails, this method can be used to look up candidate
4316
+ /// entities with the expected name. It allows filtering them using the
4317
+ /// supplied predicate (which should be used to only accept the types of
4318
+ /// definitions expected e.g. traits). The lookup spans across all crates.
4319
+ ///
4320
+ /// NOTE: The method does not look into imports, but this is not a problem,
4321
+ /// since we report the definitions (thus, the de-aliased imports).
4322
+ fn lookup_import_candidates < FilterFn > ( & mut self ,
4323
+ lookup_name : Name ,
4324
+ namespace : Namespace ,
4325
+ filter_fn : FilterFn )
4326
+ -> Vec < ImportSuggestion >
4327
+ where FilterFn : Fn ( Def ) -> bool
4328
+ {
4329
+ self . lookup_import_candidates_from_module ( lookup_name, namespace, self . graph_root , filter_fn)
4330
+ }
4331
+
4321
4332
fn find_module ( & mut self ,
4322
4333
module_def : Def )
4323
4334
-> Option < ( Module < ' a > , ImportSuggestion ) >
0 commit comments