summaryrefslogtreecommitdiff
path: root/src/hir
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2019-11-03 11:59:35 +0800
committerJohn Hodge <tpg@mutabah.net>2019-11-03 11:59:35 +0800
commit56c9b3f6f9c4e9e34477b19b5abf25193dbc3a41 (patch)
treed0b1983ab77eae175086f2587522bddccb47980e /src/hir
parent0a2ea1a773c54c3a4b02edfeb19123aa4224c735 (diff)
downloadmrust-56c9b3f6f9c4e9e34477b19b5abf25193dbc3a41.tar.gz
HIR Expand Closures - Move closure prefix to a common location
Diffstat (limited to 'src/hir')
-rw-r--r--src/hir/type.hpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/hir/type.hpp b/src/hir/type.hpp
index cbc2e94a..f499c73f 100644
--- a/src/hir/type.hpp
+++ b/src/hir/type.hpp
@@ -17,6 +17,8 @@
/// Binding index for a Generic that indicates "Self"
#define GENERIC_Self 0xFFFF
+constexpr const char* CLOSURE_PATH_PREFIX = "closure#";
+
namespace HIR {
class TraitMarkings;
@@ -209,7 +211,7 @@ public:
bool is_closure() const {
return path.m_data.is_Generic()
&& path.m_data.as_Generic().m_path.m_components.back().size() > 8
- && path.m_data.as_Generic().m_path.m_components.back().compare(0,8, "closure#") == 0
+ && path.m_data.as_Generic().m_path.m_components.back().compare(0,strlen(CLOSURE_PATH_PREFIX), CLOSURE_PATH_PREFIX) == 0
;
}
}),