Skip to content

Commit 1e51260

Browse files
committed
privacy: reachability: Visit all types of a struct's public fields
1 parent 3058b55 commit 1e51260

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

gcc/rust/privacy/rust-reachability.cc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,12 @@ ReachabilityVisitor::visit (HIR::StructStruct &struct_item)
110110
}
111111
}
112112

113-
// for (auto &field : struct_item.get_fields ())
114-
// if (field.get_visibility ().is_public ())
115-
// FIXME: How do we visit these fields with the reachability
116-
// visitor?
113+
for (auto &field : struct_item.get_fields ())
114+
if (field.get_visibility ().is_public ())
115+
ctx.update_reachability (field.get_field_type ()->get_mappings (),
116+
struct_reach);
117117
}
118118

119-
// FIXME: How do we get the constructor from `struct_item`? We need to update
120-
// its visibility as well. Probably by keeping a reference to the TypeCtx?
121-
122119
current_level = old_level;
123120
}
124121

0 commit comments

Comments
 (0)