diff options
author | John Hodge <tpg@mutabah.net> | 2016-09-24 17:01:06 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-09-24 17:02:19 +0800 |
commit | 24ee7b3a8b6fc2a52f6b3485ffe5087d144e4a28 (patch) | |
tree | 912685e22b335ad766cd264e2dc3c4d7879402c0 /src/hir/type.cpp | |
parent | 00fe2ba047251b0178681ce818a73003ab449785 (diff) | |
download | mrust-24ee7b3a8b6fc2a52f6b3485ffe5087d144e4a28.tar.gz |
HIR Typecheck Expr - Fix impl selection bug with an evil hack
Diffstat (limited to 'src/hir/type.cpp')
-rw-r--r-- | src/hir/type.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/hir/type.cpp b/src/hir/type.cpp index 4c7a162f..de60dcb1 100644 --- a/src/hir/type.cpp +++ b/src/hir/type.cpp @@ -524,7 +524,14 @@ bool ::HIR::TypeRef::match_test_generics(const Span& sp, const ::HIR::TypeRef& x break; } ) + if( v.m_data.tag() != x.m_data.tag() ) { + // HACK: If the path is Opaque, return a fuzzy match. + // - This works around an impl selection bug. + if( v.m_data.is_Path() && v.m_data.as_Path().binding.is_Opaque() ) { + DEBUG("- Fuzzy match due to opaque"); + return Compare::Fuzzy; + } DEBUG("- Tag mismatch " << v << " and " << x); return Compare::Unequal; } |