summaryrefslogtreecommitdiff
path: root/src/hir/hir.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-10-01 21:42:19 +0800
committerJohn Hodge <tpg@mutabah.net>2016-10-01 21:42:19 +0800
commit5967b5ac48e1fcb50ce673fc96691392e2ae2692 (patch)
tree940029692aaad862eb8e92d0a79e43fdbee35042 /src/hir/hir.cpp
parentd0bb03758d31dcba938e95bd2ee155bb798a9b70 (diff)
downloadmrust-5967b5ac48e1fcb50ce673fc96691392e2ae2692.tar.gz
HIR - Store and use annotations for CoerceUnsized (and prepare markings for other traits)
Diffstat (limited to 'src/hir/hir.cpp')
-rw-r--r--src/hir/hir.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/hir/hir.cpp b/src/hir/hir.cpp
index 40ad9f86..293827d8 100644
--- a/src/hir/hir.cpp
+++ b/src/hir/hir.cpp
@@ -397,13 +397,21 @@ bool ::HIR::TraitImpl::more_specific_than(const ::HIR::TraitImpl& other) const
const ::HIR::SimplePath& ::HIR::Crate::get_lang_item_path(const Span& sp, const char* name) const
{
- // TODO: have map stored in crate populated by (or from) the #[lang] attribute handler
auto it = this->m_lang_items.find( name );
if( it == this->m_lang_items.end() ) {
ERROR(sp, E0000, "Undefined language item '" << name << "' required");
}
return it->second;
}
+const ::HIR::SimplePath& ::HIR::Crate::get_lang_item_path_opt(const char* name) const
+{
+ static ::HIR::SimplePath empty_path;
+ auto it = this->m_lang_items.find( name );
+ if( it == this->m_lang_items.end() ) {
+ return empty_path;
+ }
+ return it->second;
+}
const ::HIR::TypeItem& ::HIR::Crate::get_typeitem_by_path(const Span& sp, const ::HIR::SimplePath& path, bool ignore_crate_name) const
{