@@ -202,13 +202,8 @@ 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).
210
- pub hir_id : Option < HirId > ,
211
- pub res : Option < Res > ,
205
+ pub hir_id : HirId ,
206
+ pub res : Res ,
212
207
213
208
/// Type/lifetime parameters attached to this path. They come in
214
209
/// two flavors: `Path<A,B,C>` and `Path(A,B) -> C`. Note that
@@ -226,12 +221,12 @@ pub struct PathSegment<'hir> {
226
221
227
222
impl < ' hir > PathSegment < ' hir > {
228
223
/// 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 }
224
+ pub fn new ( ident : Ident , hir_id : HirId , res : Res ) -> PathSegment < ' hir > {
225
+ PathSegment { ident, hir_id, res, infer_args : true , args : None }
231
226
}
232
227
233
228
pub fn invalid ( ) -> Self {
234
- Self :: from_ident ( Ident :: empty ( ) )
229
+ Self :: new ( Ident :: empty ( ) , HirId :: INVALID , Res :: Err )
235
230
}
236
231
237
232
pub fn args ( & self ) -> & GenericArgs < ' hir > {
0 commit comments