diff options
author | John Hodge <tpg@mutabah.net> | 2016-10-01 21:42:19 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-10-01 21:42:19 +0800 |
commit | 5967b5ac48e1fcb50ce673fc96691392e2ae2692 (patch) | |
tree | 940029692aaad862eb8e92d0a79e43fdbee35042 /src/hir/hir.cpp | |
parent | d0bb03758d31dcba938e95bd2ee155bb798a9b70 (diff) | |
download | mrust-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.cpp | 10 |
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 { |