Make hir::PathSegment::res
non-optional.
This commit is contained in:
parent
ee244bf196
commit
6d850d936b
20 changed files with 65 additions and 76 deletions
|
@ -202,13 +202,10 @@ impl Path<'_> {
|
|||
pub struct PathSegment<'hir> {
|
||||
/// The identifier portion of this path segment.
|
||||
pub ident: Ident,
|
||||
// `id` and `res` are optional. We currently only use these in save-analysis,
|
||||
// any path segments without these will not have save-analysis info and
|
||||
// therefore will not have 'jump to def' in IDEs, but otherwise will not be
|
||||
// affected. (In general, we don't bother to get the defs for synthesized
|
||||
// segments, only for segments which have come from the AST).
|
||||
|
||||
pub hir_id: Option<HirId>,
|
||||
pub res: Option<Res>,
|
||||
|
||||
pub res: Res,
|
||||
|
||||
/// Type/lifetime parameters attached to this path. They come in
|
||||
/// two flavors: `Path<A,B,C>` and `Path(A,B) -> C`. Note that
|
||||
|
@ -226,12 +223,12 @@ pub struct PathSegment<'hir> {
|
|||
|
||||
impl<'hir> PathSegment<'hir> {
|
||||
/// Converts an identifier to the corresponding segment.
|
||||
pub fn from_ident(ident: Ident) -> PathSegment<'hir> {
|
||||
PathSegment { ident, hir_id: None, res: None, infer_args: true, args: None }
|
||||
pub fn from_ident(ident: Ident, res: Res) -> PathSegment<'hir> {
|
||||
PathSegment { ident, hir_id: None, res, infer_args: true, args: None }
|
||||
}
|
||||
|
||||
pub fn invalid() -> Self {
|
||||
Self::from_ident(Ident::empty())
|
||||
Self::from_ident(Ident::empty(), Res::Err)
|
||||
}
|
||||
|
||||
pub fn args(&self) -> &GenericArgs<'hir> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue