@@ -44,7 +44,7 @@ use crate::{
44
44
errors as errs, path_names_to_string, AmbiguityError , AmbiguityErrorMisc , AmbiguityKind ,
45
45
BindingError , BindingKey , Finalize , HasGenericParams , LexicalScopeBinding , MacroRulesScope ,
46
46
Module , ModuleKind , ModuleOrUniformRoot , NameBinding , NameBindingKind , ParentScope , PathResult ,
47
- PrivacyError , ResolutionError , Resolver , Scope , ScopeSet , Segment , UseError , Used ,
47
+ PrivacyError , ResolutionError , Resolver , Scope , ScopeSet , Segment , UseError , Used , UsedImport ,
48
48
VisResolutionError ,
49
49
} ;
50
50
@@ -1050,6 +1050,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1050
1050
derive,
1051
1051
Some ( MacroKind :: Derive ) ,
1052
1052
parent_scope,
1053
+ None ,
1053
1054
false ,
1054
1055
false ,
1055
1056
) {
@@ -1504,6 +1505,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1504
1505
ScopeSet :: All ( ns) ,
1505
1506
parent_scope,
1506
1507
None ,
1508
+ None ,
1507
1509
false ,
1508
1510
None ,
1509
1511
) {
@@ -1981,6 +1983,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1981
1983
path : & [ Segment ] ,
1982
1984
opt_ns : Option < Namespace > , // `None` indicates a module path in import
1983
1985
parent_scope : & ParentScope < ' a > ,
1986
+ used_import : UsedImport < ' a > ,
1984
1987
ribs : Option < & PerNS < Vec < Rib < ' a > > > > ,
1985
1988
ignore_binding : Option < NameBinding < ' a > > ,
1986
1989
module : Option < ModuleOrUniformRoot < ' a > > ,
@@ -2064,6 +2067,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2064
2067
ident,
2065
2068
ns_to_try,
2066
2069
parent_scope,
2070
+ used_import,
2067
2071
None ,
2068
2072
ignore_binding,
2069
2073
)
@@ -2075,6 +2079,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2075
2079
ident,
2076
2080
ns_to_try,
2077
2081
parent_scope,
2082
+ used_import,
2078
2083
None ,
2079
2084
& ribs[ ns_to_try] ,
2080
2085
ignore_binding,
@@ -2088,6 +2093,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2088
2093
ident,
2089
2094
ScopeSet :: All ( ns_to_try) ,
2090
2095
parent_scope,
2096
+ used_import,
2091
2097
None ,
2092
2098
false ,
2093
2099
ignore_binding,
@@ -2136,6 +2142,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2136
2142
ident,
2137
2143
ValueNS ,
2138
2144
parent_scope,
2145
+ used_import,
2139
2146
None ,
2140
2147
& ribs[ ValueNS ] ,
2141
2148
ignore_binding,
@@ -2203,6 +2210,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2203
2210
ident,
2204
2211
ScopeSet :: All ( ValueNS ) ,
2205
2212
parent_scope,
2213
+ used_import,
2206
2214
None ,
2207
2215
false ,
2208
2216
ignore_binding,
@@ -2259,7 +2267,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2259
2267
) -> Option < ( Vec < Segment > , Option < String > ) > {
2260
2268
// Replace first ident with `self` and check if that is valid.
2261
2269
path[ 0 ] . ident . name = kw:: SelfLower ;
2262
- let result = self . maybe_resolve_path ( & path, None , parent_scope) ;
2270
+ let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2263
2271
debug ! ( "make_missing_self_suggestion: path={:?} result={:?}" , path, result) ;
2264
2272
if let PathResult :: Module ( ..) = result { Some ( ( path, None ) ) } else { None }
2265
2273
}
@@ -2278,7 +2286,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2278
2286
) -> Option < ( Vec < Segment > , Option < String > ) > {
2279
2287
// Replace first ident with `crate` and check if that is valid.
2280
2288
path[ 0 ] . ident . name = kw:: Crate ;
2281
- let result = self . maybe_resolve_path ( & path, None , parent_scope) ;
2289
+ let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2282
2290
debug ! ( "make_missing_crate_suggestion: path={:?} result={:?}" , path, result) ;
2283
2291
if let PathResult :: Module ( ..) = result {
2284
2292
Some ( (
@@ -2309,7 +2317,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2309
2317
) -> Option < ( Vec < Segment > , Option < String > ) > {
2310
2318
// Replace first ident with `crate` and check if that is valid.
2311
2319
path[ 0 ] . ident . name = kw:: Super ;
2312
- let result = self . maybe_resolve_path ( & path, None , parent_scope) ;
2320
+ let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2313
2321
debug ! ( "make_missing_super_suggestion: path={:?} result={:?}" , path, result) ;
2314
2322
if let PathResult :: Module ( ..) = result { Some ( ( path, None ) ) } else { None }
2315
2323
}
@@ -2343,7 +2351,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2343
2351
for name in extern_crate_names. into_iter ( ) {
2344
2352
// Replace first ident with a crate name and check if that is valid.
2345
2353
path[ 0 ] . ident . name = name;
2346
- let result = self . maybe_resolve_path ( & path, None , parent_scope) ;
2354
+ let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2347
2355
debug ! (
2348
2356
"make_external_crate_suggestion: name={:?} path={:?} result={:?}" ,
2349
2357
name, path, result
0 commit comments