Make hir::PathSegment::res
non-optional.
This commit is contained in:
parent
ee244bf196
commit
6d850d936b
20 changed files with 65 additions and 76 deletions
|
@ -912,7 +912,7 @@ impl<'tcx> DumpVisitor<'tcx> {
|
|||
_,
|
||||
)
|
||||
| Res::SelfTy { .. } => {
|
||||
self.dump_path_segment_ref(id, &hir::PathSegment::from_ident(ident));
|
||||
self.dump_path_segment_ref(id, &hir::PathSegment::from_ident(ident, Res::Err));
|
||||
}
|
||||
def => {
|
||||
error!("unexpected definition kind when processing collected idents: {:?}", def)
|
||||
|
|
|
@ -596,13 +596,14 @@ impl<'tcx> SaveContext<'tcx> {
|
|||
Node::TraitRef(tr) => tr.path.res,
|
||||
|
||||
Node::Item(&hir::Item { kind: hir::ItemKind::Use(path, _), .. }) => path.res,
|
||||
Node::PathSegment(seg) => match seg.res {
|
||||
Some(res) if res != Res::Err => res,
|
||||
_ => {
|
||||
Node::PathSegment(seg) => {
|
||||
if seg.res != Res::Err {
|
||||
seg.res
|
||||
} else {
|
||||
let parent_node = self.tcx.hir().get_parent_node(hir_id);
|
||||
self.get_path_res(parent_node)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Node::Expr(&hir::Expr { kind: hir::ExprKind::Struct(ref qpath, ..), .. }) => {
|
||||
self.typeck_results().qpath_res(qpath, hir_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue