summaryrefslogtreecommitdiff
path: root/src/hir/from_ast.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-02-03 17:48:32 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-02-03 17:48:32 +0800
commit42b9c8704fe4aab25e8f9d0cca15a74b025eee43 (patch)
tree2fc5e86fc800c42290c486a417b33ad1f1b7ad09 /src/hir/from_ast.cpp
parent4960edb7d948e43efc58a28ecd05fa9237c8d240 (diff)
downloadmrust-42b9c8704fe4aab25e8f9d0cca15a74b025eee43.tar.gz
HIR - Minimally-tested support for `extern { type }`
Diffstat (limited to 'src/hir/from_ast.cpp')
-rw-r--r--src/hir/from_ast.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/hir/from_ast.cpp b/src/hir/from_ast.cpp
index 768593c4..fb8096f7 100644
--- a/src/hir/from_ast.cpp
+++ b/src/hir/from_ast.cpp
@@ -1187,6 +1187,7 @@ namespace {
::std::vector< ::HIR::TraitPath> trait_bounds;
::std::string lifetime_bound;
auto gps = LowerHIR_GenericParams(i.params(), &is_sized);
+
for(auto& b : gps.m_bounds)
{
TU_MATCH(::HIR::GenericBound, (b), (be),
@@ -1463,6 +1464,15 @@ void _add_mod_val_item(::HIR::Module& mod, ::std::string name, bool is_pub, ::H
_add_mod_ns_item( mod, item.name, item.is_pub, ::HIR::TypeItem::make_Import({ ::HIR::SimplePath(e.name, {}), false, 0} ) );
),
(Type,
+ if( e.type().m_data.is_Any() )
+ {
+ if( !e.params().lft_params().empty() || !e.params().ty_params().empty() || !e.params().bounds().empty() )
+ {
+ ERROR(item.data.span, E0000, "Generics on extern type");
+ }
+ _add_mod_ns_item(mod, item.name, item.is_pub, ::HIR::ExternType {});
+ break;
+ }
_add_mod_ns_item( mod, item.name, item.is_pub, ::HIR::TypeItem::make_TypeAlias( LowerHIR_TypeAlias(e) ) );
),
(Struct,