diff options
author | John Hodge <tpg@mutabah.net> | 2016-12-18 14:15:03 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-12-18 14:15:03 +0800 |
commit | 31c4212f66ef827ca933443b10b2caac5d7f654a (patch) | |
tree | 977e87461069b03eceb409524fbeece59ac67033 /src/hir_conv/markings.cpp | |
parent | 48658d1621851fc1cda5fff397cfc380c0757b8e (diff) | |
download | mrust-31c4212f66ef827ca933443b10b2caac5d7f654a.tar.gz |
HIR Markings - Store presense of a Drop impl
Diffstat (limited to 'src/hir_conv/markings.cpp')
-rw-r--r-- | src/hir_conv/markings.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/hir_conv/markings.cpp b/src/hir_conv/markings.cpp index ca5f7ca7..ed49be52 100644 --- a/src/hir_conv/markings.cpp +++ b/src/hir_conv/markings.cpp @@ -21,6 +21,7 @@ class Visitor: const ::HIR::SimplePath& m_lang_Unsize; const ::HIR::SimplePath& m_lang_CoerceUnsized; const ::HIR::SimplePath& m_lang_Deref; + const ::HIR::SimplePath& m_lang_Drop; const ::HIR::SimplePath& m_lang_PhantomData; public: Visitor(const ::HIR::Crate& crate): @@ -28,6 +29,7 @@ public: m_lang_Unsize( crate.get_lang_item_path_opt("unsize") ), m_lang_CoerceUnsized( crate.get_lang_item_path_opt("coerce_unsized") ), m_lang_Deref( crate.get_lang_item_path_opt("deref") ), + m_lang_Drop( crate.get_lang_item_path_opt("drop") ), m_lang_PhantomData( crate.get_lang_item_path_opt("phantom_data") ) { } @@ -105,6 +107,11 @@ public: DEBUG("Type " << impl.m_type << " can Unsize"); ERROR(sp, E0000, "Unsize shouldn't be manually implemented"); } + else if( trait_path == m_lang_Drop ) + { + // TODO: Check that there's only one impl, and that it covers the same set as the type. + markings.has_drop_impl = true; + } else if( trait_path == m_lang_CoerceUnsized ) { if( markings_ptr->coerce_unsized_index != ~0u ) ERROR(sp, E0000, "CoerceUnsized can only be implemented once per struct"); |