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

This commit is contained in:
Nicholas Nethercote
2022-08-30 15:10:28 +10:00
parent ee244bf196
commit 6d850d936b
20 changed files with 65 additions and 76 deletions

View File

@@ -1267,7 +1267,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
self.arena.alloc(hir::Path {
res,
segments: arena_vec![self; hir::PathSegment::from_ident(
Ident::with_dummy_span(kw::SelfUpper)
Ident::with_dummy_span(kw::SelfUpper),
res
)],
span: self.lower_span(t.span),
}),
@@ -2193,12 +2194,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
hir::PredicateOrigin::ImplTrait,
);
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: Res::Def(DefKind::TyParam, def_id.to_def_id()),
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), res)],
}),
));