diff options
-rw-r--r-- | gcc/rust/backend/rust-compile-type.cc | 12 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-tyty.cc | 11 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-tyty.h | 3 |
3 files changed, 17 insertions, 9 deletions
diff --git a/gcc/rust/backend/rust-compile-type.cc b/gcc/rust/backend/rust-compile-type.cc index 21da9af..ba6a206 100644 --- a/gcc/rust/backend/rust-compile-type.cc +++ b/gcc/rust/backend/rust-compile-type.cc @@ -148,11 +148,13 @@ TyTyResolveCompile::visit (const TyTy::FnPtr &type) tree result_type = TyTyResolveCompile::compile (ctx, type.get_return_type ()); std::vector<tree> parameters; - type.iterate_params ([&] (TyTy::BaseType *p) mutable -> bool { - tree pty = TyTyResolveCompile::compile (ctx, p); - parameters.push_back (pty); - return true; - }); + + auto ¶ms = type.get_params (); + for (auto &p : params) + { + tree pty = TyTyResolveCompile::compile (ctx, p.get_tyty ()); + parameters.push_back (pty); + } translated = ctx->get_backend ()->function_ptr_type (result_type, parameters, type.get_ident ().locus); diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc index fa5dcfb..0a29644 100644 --- a/gcc/rust/typecheck/rust-tyty.cc +++ b/gcc/rust/typecheck/rust-tyty.cc @@ -1295,10 +1295,13 @@ std::string FnPtr::as_string () const { std::string params_str; - iterate_params ([&] (BaseType *p) mutable -> bool { - params_str += p->as_string () + " ,"; - return true; - }); + + auto ¶ms = get_params (); + for (auto &p : params) + { + params_str += p.get_tyty ()->as_string () + " ,"; + } + return "fnptr (" + params_str + ") -> " + get_return_type ()->as_string (); } diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h index 85948b2..bf4110b 100644 --- a/gcc/rust/typecheck/rust-tyty.h +++ b/gcc/rust/typecheck/rust-tyty.h @@ -1527,6 +1527,9 @@ public: } } + std::vector<TyVar> &get_params () { return params; } + const std::vector<TyVar> &get_params () const { return params; } + bool is_concrete () const override final { for (auto &p : params) |