Skip to content

Commit ac617d7

Browse files
sakupan102CohenArthur
authored andcommitted
Add check before calling get_trait_ref()
gcc/rust/ChangeLog: * hir/tree/rust-hir-visitor.cc (DefaultHIRVisitor::walk): Add check before calling `get_trait_ref()` Signed-off-by: Ryutaro Okada <[email protected]>
1 parent ed7b761 commit ac617d7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

gcc/rust/hir/tree/rust-hir-visitor.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,8 @@ DefaultHIRVisitor::walk (ImplBlock &impl)
897897
visit_outer_attrs (impl);
898898
for (auto &generic : impl.get_generic_params ())
899899
generic->accept_vis (*this);
900-
impl.get_trait_ref ().accept_vis (*this);
900+
if (impl.has_trait_ref ())
901+
impl.get_trait_ref ().accept_vis (*this);
901902
impl.get_type ().accept_vis (*this);
902903
if (impl.has_where_clause ())
903904
visit_where_clause (impl.get_where_clause ());

0 commit comments

Comments
 (0)