summaryrefslogtreecommitdiff
path: root/src/hir/path.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-10-23 19:38:13 +0800
committerJohn Hodge <tpg@mutabah.net>2016-10-23 19:38:13 +0800
commitea3c657845313a274f99cc568ff4e3310e248e15 (patch)
treef8e381baa016bc499cb982bff6e8a2aebe392508 /src/hir/path.cpp
parent061b63d4fd88e5802927bd42d4b0fd8d5f6fc0f8 (diff)
downloadmrust-ea3c657845313a274f99cc568ff4e3310e248e15.tar.gz
AST+HIR - Add stubbed support for erased types (`impl Trait`)
Diffstat (limited to 'src/hir/path.cpp')
-rw-r--r--src/hir/path.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/hir/path.cpp b/src/hir/path.cpp
index f0590e38..8e522aa9 100644
--- a/src/hir/path.cpp
+++ b/src/hir/path.cpp
@@ -356,3 +356,34 @@ namespace {
throw "";
}
+Ordering HIR::Path::ord(const ::HIR::Path& x) const
+{
+ ORD( (unsigned)m_data.tag(), (unsigned)x.m_data.tag() );
+ TU_MATCH(::HIR::Path::Data, (this->m_data, x.m_data), (tpe, xpe),
+ (Generic,
+ return ::ord(tpe, xpe);
+ ),
+ (UfcsInherent,
+ ORD(*tpe.type, *xpe.type);
+ ORD(tpe.item, xpe.item);
+ return ::ord(tpe.params, xpe.params);
+ ),
+ (UfcsKnown,
+ ORD(*tpe.type, *xpe.type);
+ ORD(tpe.trait, xpe.trait);
+ ORD(tpe.item, xpe.item);
+ return ::ord(tpe.params, xpe.params);
+ ),
+ (UfcsUnknown,
+ ORD(*tpe.type, *xpe.type);
+ ORD(tpe.item, xpe.item);
+ return ::ord(tpe.params, xpe.params);
+ )
+ )
+ throw "";
+}
+
+bool ::HIR::Path::operator==(const Path& x) const {
+ return this->ord(x) == ::OrdEqual;
+}
+