@@ -202,13 +202,10 @@ impl Path<'_> {
202202pub struct PathSegment < ' hir > {
203203 /// The identifier portion of this path segment.
204204 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+
210206 pub hir_id : Option < HirId > ,
211- pub res : Option < Res > ,
207+
208+ pub res : Res ,
212209
213210 /// Type/lifetime parameters attached to this path. They come in
214211 /// two flavors: `Path<A,B,C>` and `Path(A,B) -> C`. Note that
@@ -226,12 +223,12 @@ pub struct PathSegment<'hir> {
226223
227224impl < ' hir > PathSegment < ' hir > {
228225 /// 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 }
231228 }
232229
233230 pub fn invalid ( ) -> Self {
234- Self :: from_ident ( Ident :: empty ( ) )
231+ Self :: from_ident ( Ident :: empty ( ) , Res :: Err )
235232 }
236233
237234 pub fn args ( & self ) -> & GenericArgs < ' hir > {
0 commit comments