diff options
author | John Hodge <tpg@mutabah.net> | 2019-11-10 14:11:19 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2019-11-10 14:11:19 +0800 |
commit | 3e5092d73883b335c023deef2662958e43339df9 (patch) | |
tree | dc111cedb8703b65041143f5ea08c751b8f16259 /src | |
parent | 83e5d7463a5cc3f0c3fa543bdd9c8b2502073eb0 (diff) | |
download | mrust-3e5092d73883b335c023deef2662958e43339df9.tar.gz |
HIR Typecheck Static - Tweak cache behaviour for is_copy to reduce thrashing
Diffstat (limited to 'src')
-rw-r--r-- | src/hir_typeck/static.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/hir_typeck/static.cpp b/src/hir_typeck/static.cpp index 51e4b831..62dbbaba 100644 --- a/src/hir_typeck/static.cpp +++ b/src/hir_typeck/static.cpp @@ -1474,11 +1474,23 @@ bool StaticTraitResolve::type_is_copy(const Span& sp, const ::HIR::TypeRef& ty) ), (Path, const auto* markings = e.binding.get_trait_markings(); - if( markings && ! markings->is_copy ) + if( markings ) { - return false; + if( !markings->is_copy ) + { + // Doesn't impl Copy + return false; + } + else if( !e.path.m_data.as_Generic().m_params.has_params() ) + { + // No params, must be Copy + return true; + } + else + { + // TODO: Also have a marking that indicates that the type is unconditionally Copy + } } - // TODO: Also have a marking that indicates that the type is unconditionally Copy { auto it = m_copy_cache.find(ty); |