@@ -202,13 +202,10 @@ impl Path<'_> {
202
202
pub struct PathSegment < ' hir > {
203
203
/// The identifier portion of this path segment.
204
204
pub ident : Ident ,
205
- // `id` and `res` are optional. We currently only use these in save-analysis,
206
- // any path segments without these will not have save-analysis info and
207
- // therefore will not have 'jump to def' in IDEs, but otherwise will not be
208
- // affected. (In general, we don't bother to get the defs for synthesized
209
- // segments, only for segments which have come from the AST).
205
+
210
206
pub hir_id : Option < HirId > ,
211
- pub res : Option < Res > ,
207
+
208
+ pub res : Res ,
212
209
213
210
/// Type/lifetime parameters attached to this path. They come in
214
211
/// two flavors: `Path<A,B,C>` and `Path(A,B) -> C`. Note that
@@ -226,12 +223,12 @@ pub struct PathSegment<'hir> {
226
223
227
224
impl < ' hir > PathSegment < ' hir > {
228
225
/// Converts an identifier to the corresponding segment.
229
- pub fn from_ident ( ident : Ident ) -> PathSegment < ' hir > {
230
- PathSegment { ident, hir_id : None , res : None , infer_args : true , args : None }
226
+ pub fn from_ident ( ident : Ident , res : Res ) -> PathSegment < ' hir > {
227
+ PathSegment { ident, hir_id : None , res, infer_args : true , args : None }
231
228
}
232
229
233
230
pub fn invalid ( ) -> Self {
234
- Self :: from_ident ( Ident :: empty ( ) )
231
+ Self :: from_ident ( Ident :: empty ( ) , Res :: Err )
235
232
}
236
233
237
234
pub fn args ( & self ) -> & GenericArgs < ' hir > {
0 commit comments