diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-09-02 11:28:42 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-09-02 11:28:42 +0800 |
commit | 4656343c6feafc6ea26dd5eb22a30b3afebf5a18 (patch) | |
tree | a7be3771a9e5be95357839148d914193aec651c7 /src/hir/hir.cpp | |
parent | 39df0dc75a10ff3bea15b39f31454c2642a83ad1 (diff) | |
download | mrust-4656343c6feafc6ea26dd5eb22a30b3afebf5a18.tar.gz |
HIR Impl Specialisation - Check param bounds for overlap
Diffstat (limited to 'src/hir/hir.cpp')
-rw-r--r-- | src/hir/hir.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/hir/hir.cpp b/src/hir/hir.cpp index a8cffda2..5b43c1c9 100644 --- a/src/hir/hir.cpp +++ b/src/hir/hir.cpp @@ -917,7 +917,21 @@ bool ::HIR::TraitImpl::overlaps_with(const Crate& crate, const ::HIR::TraitImpl& // Determine if `ty` would be bounded (it's an ATY or generic) if( ty.m_data.is_Generic() ) { - TODO(Span(), "Check bound " << ty << " : " << trait << " in source bounds - " << g_src.m_params.fmt_bounds()); + bool found = false; + for(const auto& bound : g_src.m_params.m_bounds) + { + if(const auto* be = bound.opt_TraitBound()) + { + if( be->type != ty ) continue; + if( be->trait != trait ) continue; + found = true; + } + } + if( !found ) + { + DEBUG("No matching bound for " << ty << " : " << trait << " in source bounds - " << g_src.m_params.fmt_bounds()); + return false; + } } else if( TU_TEST1(ty.m_data, Path, .binding.is_Opaque()) ) { TODO(Span(), "Check bound " << ty << " : " << trait << " in source bounds or trait bounds"); |