aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-resolve-path.cc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-02-16 15:40:28 +0000
committerPhilip Herron <herron.philip@googlemail.com>2021-03-01 10:35:07 +0000
commit9af2ae0ff91535da104db0d3828d863770439fad (patch)
tree57b375ba818f22c70066c87a4d9c2a1c1b78f69e /gcc/rust/backend/rust-compile-resolve-path.cc
parent06bb1d6542a9d07f4d866613a5b039be7bcb5f95 (diff)
downloadgcc-9af2ae0ff91535da104db0d3828d863770439fad.zip
gcc-9af2ae0ff91535da104db0d3828d863770439fad.tar.gz
gcc-9af2ae0ff91535da104db0d3828d863770439fad.tar.bz2
Support Generic arguments to Structs
This removes StructFieldType from the TyTy base as it is not a type that can be unified against. It adds in a substition mapper implementation which will likely change over time when this this support is extended over to Functions and TupleStructs. Note generic argument binding is not supported as part of this yet. Fixes #235
Diffstat (limited to 'gcc/rust/backend/rust-compile-resolve-path.cc')
-rw-r--r--gcc/rust/backend/rust-compile-resolve-path.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/rust/backend/rust-compile-resolve-path.cc b/gcc/rust/backend/rust-compile-resolve-path.cc
index de325fa..ffc2655 100644
--- a/gcc/rust/backend/rust-compile-resolve-path.cc
+++ b/gcc/rust/backend/rust-compile-resolve-path.cc
@@ -84,7 +84,7 @@ ResolvePathRef::visit (HIR::PathInExpression &expr)
CompileItem::compile (resolved_item, ctx);
if (!ctx->lookup_function_decl (ref, &fn))
{
- rust_error_at (expr.get_locus (), "forward decl was not compiled");
+ rust_error_at (expr.get_locus (), "forward decl was not compiled 1");
return;
}
}
@@ -112,12 +112,14 @@ ResolvePathType::visit (HIR::PathInExpression &expr)
return;
}
- // assumes paths are functions for now
- if (!ctx->lookup_compiled_types (ref, &resolved))
+ TyTy::BaseType *tyty = nullptr;
+ if (!ctx->get_tyctx ()->lookup_type (ref, &tyty))
{
- rust_error_at (expr.get_locus (), "forward decl was not compiled");
+ rust_error_at (expr.get_locus (), "unknown type");
return;
}
+
+ resolved = TyTyResolveCompile::compile (ctx, tyty);
}
} // namespace Compile