diff options
author | John Hodge <tpg@mutabah.net> | 2015-03-31 22:40:04 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2015-03-31 22:40:04 +0800 |
commit | c2684e5058415746c83e38676f91bfc32d2ee6eb (patch) | |
tree | 98ce27dcd287f52b261f9346d7bfc98ac8776483 /src/ast/provided_module.cpp | |
parent | c5b773f72a8ef077d8d189912014f64431825df5 (diff) | |
download | mrust-c2684e5058415746c83e38676f91bfc32d2ee6eb.tar.gz |
Root-level typecheck now up to requiring Sized
Diffstat (limited to 'src/ast/provided_module.cpp')
-rw-r--r-- | src/ast/provided_module.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/ast/provided_module.cpp b/src/ast/provided_module.cpp index bb1da26b..7bea81d4 100644 --- a/src/ast/provided_module.cpp +++ b/src/ast/provided_module.cpp @@ -12,7 +12,31 @@ void AST_InitProvidedModule() }); AST::Path copy_marker_path({AST::PathNode("marker"),AST::PathNode("Copy")}); + g_compiler_module.add_impl(AST::Impl(AST::TypeParams(), TypeRef(CORETYPE_U8), copy_marker_path)); + g_compiler_module.add_impl(AST::Impl(AST::TypeParams(), TypeRef(CORETYPE_U16), copy_marker_path)); + g_compiler_module.add_impl(AST::Impl(AST::TypeParams(), TypeRef(CORETYPE_U32), copy_marker_path)); + g_compiler_module.add_impl(AST::Impl(AST::TypeParams(), TypeRef(CORETYPE_U64), copy_marker_path)); + g_compiler_module.add_impl(AST::Impl(AST::TypeParams(), TypeRef(CORETYPE_UINT), copy_marker_path)); + + g_compiler_module.add_impl(AST::Impl(AST::TypeParams(), TypeRef(CORETYPE_I8), copy_marker_path)); + g_compiler_module.add_impl(AST::Impl(AST::TypeParams(), TypeRef(CORETYPE_I16), copy_marker_path)); + g_compiler_module.add_impl(AST::Impl(AST::TypeParams(), TypeRef(CORETYPE_I32), copy_marker_path)); + g_compiler_module.add_impl(AST::Impl(AST::TypeParams(), TypeRef(CORETYPE_I64), copy_marker_path)); + g_compiler_module.add_impl(AST::Impl(AST::TypeParams(), TypeRef(CORETYPE_INT), copy_marker_path)); + g_compiler_module.add_impl(AST::Impl(AST::TypeParams(), TypeRef(CORETYPE_F32), copy_marker_path)); g_compiler_module.add_impl(AST::Impl(AST::TypeParams(), TypeRef(CORETYPE_F64), copy_marker_path)); + + // A hacky default impl of 'Sized', with a negative impl on [T] + AST::Path sized_marker_path({AST::PathNode("marker"),AST::PathNode("Sized")}); + g_compiler_module.add_impl(AST::Impl(AST::TypeParams(), TypeRef(), copy_marker_path)); + AST::TypeParams tps; + tps.add_ty_param( AST::TypeParam("T") ); + g_compiler_module.add_impl(AST::Impl( + AST::Impl::TagNegative(), + ::std::move(tps), + TypeRef(TypeRef::TagUnsizedArray(), TypeRef(TypeRef::TagArg(), "T")), + copy_marker_path + )); } |