summaryrefslogtreecommitdiff
path: root/src/hir/hir.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2017-08-31 16:19:00 +0800
committerJohn Hodge <tpg@ucc.asn.au>2017-08-31 16:19:00 +0800
commitd545aa5cdfb6813c0b4f77a6b66e391a3d887fb4 (patch)
tree4e714dfe669f299d72a25d9881182d2212a76fb8 /src/hir/hir.cpp
parent894562850163a60721e23b5986869a580c7be5c7 (diff)
downloadmrust-d545aa5cdfb6813c0b4f77a6b66e391a3d887fb4.tar.gz
HIR - Fix minor bug in specialisation ordering
Diffstat (limited to 'src/hir/hir.cpp')
-rw-r--r--src/hir/hir.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/hir/hir.cpp b/src/hir/hir.cpp
index e3f78102..a8cffda2 100644
--- a/src/hir/hir.cpp
+++ b/src/hir/hir.cpp
@@ -558,15 +558,16 @@ bool ::HIR::TraitImpl::more_specific_than(const ::HIR::TraitImpl& other) const
try
{
auto ord = type_ord_specific(sp, this->m_type, other.m_type);
+ // If `*this` < `other` : false
if( ord != ::OrdEqual ) {
- DEBUG("- Type " << (ord == ::OrdLess ? "less" : "more") << " specific - " << this->m_type << " AND " << other.m_type);
- return ord == ::OrdLess;
+ DEBUG("- Type " << this->m_type << " " << (ord == ::OrdLess ? "less" : "more") << " specific than " << other.m_type);
+ return ord == ::OrdGreater;
}
// 2. If any in te.impl->m_params is less specific than oe.impl->m_params: return false
ord = typelist_ord_specific(sp, this->m_trait_args.m_types, other.m_trait_args.m_types);
if( ord != ::OrdEqual ) {
DEBUG("- Trait arguments " << (ord == ::OrdLess ? "less" : "more") << " specific");
- return ord == ::OrdLess;
+ return ord == ::OrdGreater;
}
}
catch(const TypeOrdSpecific_MixedOrdering& e)