summaryrefslogtreecommitdiff
path: root/src/expand/lang_item.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-09-27 22:37:56 +0800
committerJohn Hodge <tpg@mutabah.net>2016-09-27 22:37:56 +0800
commit9ba41a54e44ae2f107a8646364353b06a7776bb5 (patch)
tree0f402da3a8294bebc177272c4645604d199eca9c /src/expand/lang_item.cpp
parent1f57abaf71ab7b557aca2bd78784b1078ad14358 (diff)
downloadmrust-9ba41a54e44ae2f107a8646364353b06a7776bb5.tar.gz
Expand - Hack around expansion order quirk with anon modules
Diffstat (limited to 'src/expand/lang_item.cpp')
-rw-r--r--src/expand/lang_item.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/expand/lang_item.cpp b/src/expand/lang_item.cpp
index 186f2cea..f8aea8c3 100644
--- a/src/expand/lang_item.cpp
+++ b/src/expand/lang_item.cpp
@@ -103,7 +103,11 @@ void handle_lang_item(const Span& sp, AST::Crate& crate, const AST::Path& path,
auto rv = crate.m_lang_items.insert( ::std::make_pair( name, ::AST::Path(path) ) );
if( !rv.second ) {
- ERROR(sp, E0000, "Duplicate definition of language item '" << name << "' - " << rv.first->second << " and " << path);
+ const auto& other_path = rv.first->second;
+ if( path != other_path ) {
+ // HACK: Anon modules get visited twice, so can lead to duplicate annotations
+ ERROR(sp, E0000, "Duplicate definition of language item '" << name << "' - " << other_path << " and " << path);
+ }
}
}