@@ -166,6 +166,17 @@ impl Resolver {
166166 db : & dyn DefDatabase ,
167167 path : & Path ,
168168 ) -> 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+ {
169180 let path = match path {
170181 Path :: BarePath ( mod_path) => mod_path,
171182 Path :: Normal ( it) => it. mod_path ( ) ,
@@ -181,7 +192,12 @@ impl Resolver {
181192 | LangItemTarget :: ImplDef ( _)
182193 | LangItemTarget :: Static ( _) => return None ,
183194 } ;
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+ ) ) ;
185201 }
186202 } ;
187203 let first_name = path. segments ( ) . first ( ) ?;
@@ -197,17 +213,32 @@ impl Resolver {
197213 Scope :: ExprScope ( _) | Scope :: MacroDefScope ( _) => continue ,
198214 Scope :: GenericParams { params, def } => {
199215 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+ ) ) ;
201222 }
202223 }
203224 & Scope :: ImplDefScope ( impl_) => {
204225 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+ ) ) ;
206232 }
207233 }
208234 & Scope :: AdtScope ( adt) => {
209235 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+ ) ) ;
211242 }
212243 }
213244 Scope :: BlockScope ( m) => {
@@ -220,18 +251,6 @@ impl Resolver {
220251 self . module_scope . resolve_path_in_type_ns ( db, path)
221252 }
222253
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-
235254 pub fn resolve_path_in_type_ns_fully (
236255 & self ,
237256 db : & dyn DefDatabase ,
@@ -986,11 +1005,12 @@ impl ModuleItemMap {
9861005 & self ,
9871006 db : & dyn DefDatabase ,
9881007 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) =
9911011 self . def_map . resolve_path_locally ( db, self . module_id , path, BuiltinShadowMode :: Other ) ;
9921012 let ( res, import) = to_type_ns ( module_def) ?;
993- Some ( ( res, idx, import) )
1013+ Some ( ( res, idx, import, prefix_info ) )
9941014 }
9951015}
9961016
0 commit comments