aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/lint/rust-lint-marklive.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/lint/rust-lint-marklive.cc')
-rw-r--r--gcc/rust/lint/rust-lint-marklive.cc23
1 files changed, 4 insertions, 19 deletions
diff --git a/gcc/rust/lint/rust-lint-marklive.cc b/gcc/rust/lint/rust-lint-marklive.cc
index 3776aea..2b01abc 100644
--- a/gcc/rust/lint/rust-lint-marklive.cc
+++ b/gcc/rust/lint/rust-lint-marklive.cc
@@ -179,16 +179,10 @@ MarkLive::visit_path_segment (HIR::PathExprSegment seg)
//
// We should mark them alive all and ignoring other kind of segments.
// If the segment we dont care then just return false is fine
- if (resolver->lookup_resolved_name (ast_node_id, &ref_node_id))
+ if (!resolver->lookup_resolved_name (ast_node_id, &ref_node_id))
{
- Resolver::Definition def;
- bool ok = resolver->lookup_definition (ref_node_id, &def);
- rust_assert (ok);
- ref_node_id = def.parent;
- }
- else if (!resolver->lookup_resolved_type (ast_node_id, &ref_node_id))
- {
- return false;
+ if (!resolver->lookup_resolved_type (ast_node_id, &ref_node_id))
+ return false;
}
HirId ref;
bool ok = mappings->lookup_node_to_hir (seg.get_mappings ().get_crate_num (),
@@ -300,16 +294,7 @@ MarkLive::mark_hir_id (HirId id)
void
MarkLive::find_ref_node_id (NodeId ast_node_id, NodeId &ref_node_id)
{
- if (resolver->lookup_resolved_name (ast_node_id, &ref_node_id))
- {
- // these ref_node_ids will resolve to a pattern declaration but we are
- // interested in the definition that this refers to get the parent id
- Resolver::Definition def;
- bool ok = resolver->lookup_definition (ref_node_id, &def);
- rust_assert (ok);
- ref_node_id = def.parent;
- }
- else
+ if (!resolver->lookup_resolved_name (ast_node_id, &ref_node_id))
{
bool ok = resolver->lookup_resolved_type (ast_node_id, &ref_node_id);
rust_assert (ok);