@@ -166,6 +166,17 @@ impl Resolver {
166
166
db : & dyn DefDatabase ,
167
167
path : & Path ,
168
168
) -> Option < ( TypeNs , Option < usize > , Option < ImportOrExternCrate > ) > {
169
+ self . resolve_path_in_type_ns_with_prefix_info ( db, path) . map (
170
+ |( resolution, remaining_segments, import, _) | ( resolution, remaining_segments, import) ,
171
+ )
172
+ }
173
+
174
+ pub fn resolve_path_in_type_ns_with_prefix_info (
175
+ & self ,
176
+ db : & dyn DefDatabase ,
177
+ path : & Path ,
178
+ ) -> Option < ( TypeNs , Option < usize > , Option < ImportOrExternCrate > , ResolvePathResultPrefixInfo ) >
179
+ {
169
180
let path = match path {
170
181
Path :: BarePath ( mod_path) => mod_path,
171
182
Path :: Normal ( it) => it. mod_path ( ) ,
@@ -181,7 +192,12 @@ impl Resolver {
181
192
| LangItemTarget :: ImplDef ( _)
182
193
| LangItemTarget :: Static ( _) => return None ,
183
194
} ;
184
- return Some ( ( type_ns, seg. as_ref ( ) . map ( |_| 1 ) , None ) ) ;
195
+ return Some ( (
196
+ type_ns,
197
+ seg. as_ref ( ) . map ( |_| 1 ) ,
198
+ None ,
199
+ ResolvePathResultPrefixInfo :: default ( ) ,
200
+ ) ) ;
185
201
}
186
202
} ;
187
203
let first_name = path. segments ( ) . first ( ) ?;
@@ -197,17 +213,32 @@ impl Resolver {
197
213
Scope :: ExprScope ( _) | Scope :: MacroDefScope ( _) => continue ,
198
214
Scope :: GenericParams { params, def } => {
199
215
if let Some ( id) = params. find_type_by_name ( first_name, * def) {
200
- return Some ( ( TypeNs :: GenericParam ( id) , remaining_idx ( ) , None ) ) ;
216
+ return Some ( (
217
+ TypeNs :: GenericParam ( id) ,
218
+ remaining_idx ( ) ,
219
+ None ,
220
+ ResolvePathResultPrefixInfo :: default ( ) ,
221
+ ) ) ;
201
222
}
202
223
}
203
224
& Scope :: ImplDefScope ( impl_) => {
204
225
if * first_name == sym:: Self_ . clone ( ) {
205
- return Some ( ( TypeNs :: SelfType ( impl_) , remaining_idx ( ) , None ) ) ;
226
+ return Some ( (
227
+ TypeNs :: SelfType ( impl_) ,
228
+ remaining_idx ( ) ,
229
+ None ,
230
+ ResolvePathResultPrefixInfo :: default ( ) ,
231
+ ) ) ;
206
232
}
207
233
}
208
234
& Scope :: AdtScope ( adt) => {
209
235
if * first_name == sym:: Self_ . clone ( ) {
210
- return Some ( ( TypeNs :: AdtSelfType ( adt) , remaining_idx ( ) , None ) ) ;
236
+ return Some ( (
237
+ TypeNs :: AdtSelfType ( adt) ,
238
+ remaining_idx ( ) ,
239
+ None ,
240
+ ResolvePathResultPrefixInfo :: default ( ) ,
241
+ ) ) ;
211
242
}
212
243
}
213
244
Scope :: BlockScope ( m) => {
@@ -220,18 +251,6 @@ impl Resolver {
220
251
self . module_scope . resolve_path_in_type_ns ( db, path)
221
252
}
222
253
223
- pub fn resolve_path_in_type_ns_fully_with_imports (
224
- & self ,
225
- db : & dyn DefDatabase ,
226
- path : & Path ,
227
- ) -> Option < ( TypeNs , Option < ImportOrExternCrate > ) > {
228
- let ( res, unresolved, imp) = self . resolve_path_in_type_ns ( db, path) ?;
229
- if unresolved. is_some ( ) {
230
- return None ;
231
- }
232
- Some ( ( res, imp) )
233
- }
234
-
235
254
pub fn resolve_path_in_type_ns_fully (
236
255
& self ,
237
256
db : & dyn DefDatabase ,
@@ -986,11 +1005,12 @@ impl ModuleItemMap {
986
1005
& self ,
987
1006
db : & dyn DefDatabase ,
988
1007
path : & ModPath ,
989
- ) -> Option < ( TypeNs , Option < usize > , Option < ImportOrExternCrate > ) > {
990
- let ( module_def, idx, _) =
1008
+ ) -> Option < ( TypeNs , Option < usize > , Option < ImportOrExternCrate > , ResolvePathResultPrefixInfo ) >
1009
+ {
1010
+ let ( module_def, idx, prefix_info) =
991
1011
self . def_map . resolve_path_locally ( db, self . module_id , path, BuiltinShadowMode :: Other ) ;
992
1012
let ( res, import) = to_type_ns ( module_def) ?;
993
- Some ( ( res, idx, import) )
1013
+ Some ( ( res, idx, import, prefix_info ) )
994
1014
}
995
1015
}
996
1016
0 commit comments