aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-07-05 16:35:50 +0100
committerPhilip Herron <philip.herron@embecosm.com>2021-07-10 21:24:14 +0100
commit30ca36242090e5b1dcb8094a7a11574949f36d1a (patch)
treeb295018e7675322059a7805a32766a11e6f9da30 /gcc/rust
parent9a58a5c256b866e6f66eb3cfb3a9a199dad3e42d (diff)
downloadgcc-30ca36242090e5b1dcb8094a7a11574949f36d1a.zip
gcc-30ca36242090e5b1dcb8094a7a11574949f36d1a.tar.gz
gcc-30ca36242090e5b1dcb8094a7a11574949f36d1a.tar.bz2
Assert that impl items are non null when translated to hir
When we translate AST::InherentImplItems or AST::TraitImplItem's these get lowered into a generic ImplBlock with ImplItems these must be non null. TraitImpl blocks can contains associated types but normal InherentImpl's do not this unifies the path to turn both into an HIR::ImplBlock
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/hir/rust-ast-lower-item.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-item.h b/gcc/rust/hir/rust-ast-lower-item.h
index 7985faa..68324c7 100644
--- a/gcc/rust/hir/rust-ast-lower-item.h
+++ b/gcc/rust/hir/rust-ast-lower-item.h
@@ -379,6 +379,7 @@ public:
HIR::ImplItem *lowered
= ASTLowerImplItem::translate (impl_item.get (),
mapping.get_hirid ());
+ rust_assert (lowered != nullptr);
impl_items.push_back (std::unique_ptr<HIR::ImplItem> (lowered));
impl_item_ids.push_back (lowered->get_impl_mappings ().get_hirid ());
}
@@ -521,6 +522,7 @@ public:
HIR::ImplItem *lowered
= ASTLowerImplItem::translate (impl_item.get (),
mapping.get_hirid ());
+ rust_assert (lowered != nullptr);
impl_items.push_back (std::unique_ptr<HIR::ImplItem> (lowered));
impl_item_ids.push_back (lowered->get_impl_mappings ().get_hirid ());
}