Make hir::PathSegment::hir_id non-optional.

This commit is contained in:
Nicholas Nethercote
2022-08-30 16:54:42 +10:00
parent 6d850d936b
commit bb0ae3c446
16 changed files with 103 additions and 97 deletions

View File

@@ -1260,6 +1260,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
return self.lower_path_ty(t, qself, path, ParamMode::Explicit, itctx);
}
TyKind::ImplicitSelf => {
let hir_id = self.lower_node_id(t.id);
let res = self.expect_full_res(t.id);
let res = self.lower_res(res);
hir::TyKind::Path(hir::QPath::Resolved(
@@ -1268,6 +1269,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
res,
segments: arena_vec![self; hir::PathSegment::from_ident(
Ident::with_dummy_span(kw::SelfUpper),
hir_id,
res
)],
span: self.lower_span(t.span),
@@ -2194,13 +2196,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
hir::PredicateOrigin::ImplTrait,
);
let hir_id = self.next_id();
let res = Res::Def(DefKind::TyParam, def_id.to_def_id());
let ty = hir::TyKind::Path(hir::QPath::Resolved(
None,
self.arena.alloc(hir::Path {
span: self.lower_span(span),
res,
segments: arena_vec![self; hir::PathSegment::from_ident(self.lower_ident(ident), res)],
segments: arena_vec![self; hir::PathSegment::from_ident(self.lower_ident(ident), hir_id, res)],
}),
));