aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/typecheck/rust-tyty-bounds.cc20
-rw-r--r--gcc/rust/typecheck/rust-tyty.cc3
-rw-r--r--gcc/rust/typecheck/rust-tyty.h4
3 files changed, 25 insertions, 2 deletions
diff --git a/gcc/rust/typecheck/rust-tyty-bounds.cc b/gcc/rust/typecheck/rust-tyty-bounds.cc
index bda7a7f..7a1562a 100644
--- a/gcc/rust/typecheck/rust-tyty-bounds.cc
+++ b/gcc/rust/typecheck/rust-tyty-bounds.cc
@@ -215,6 +215,12 @@ TypeBoundPredicate::as_string () const
return get ()->as_string () + subst_as_string ();
}
+std::string
+TypeBoundPredicate::as_name () const
+{
+ return get ()->get_name () + subst_as_string ();
+}
+
const Resolver::TraitReference *
TypeBoundPredicate::get () const
{
@@ -432,6 +438,20 @@ TypeBoundsMappings::bounds_as_string () const
return "bounds:[" + raw_bounds_as_string () + "]";
}
+std::string
+TypeBoundsMappings::raw_bounds_as_name () const
+{
+ std::string buf;
+ for (size_t i = 0; i < specified_bounds.size (); i++)
+ {
+ const TypeBoundPredicate &b = specified_bounds.at (i);
+ bool has_next = (i + 1) < specified_bounds.size ();
+ buf += b.as_name () + (has_next ? " + " : "");
+ }
+
+ return buf;
+}
+
void
TypeBoundsMappings::add_bound (TypeBoundPredicate predicate)
{
diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc
index 6fc395c..fcbf998 100644
--- a/gcc/rust/typecheck/rust-tyty.cc
+++ b/gcc/rust/typecheck/rust-tyty.cc
@@ -2867,8 +2867,7 @@ DynamicObjectType::clone () const
std::string
DynamicObjectType::get_name () const
{
- std::string bounds = "[" + raw_bounds_as_string () + "]";
- return "dyn " + bounds;
+ return "dyn [" + raw_bounds_as_name () + "]";
}
bool
diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h
index e2f1aa4..b00237c 100644
--- a/gcc/rust/typecheck/rust-tyty.h
+++ b/gcc/rust/typecheck/rust-tyty.h
@@ -124,6 +124,8 @@ public:
std::string bounds_as_string () const;
+ std::string raw_bounds_as_name () const;
+
protected:
void add_bound (TypeBoundPredicate predicate);
@@ -1019,6 +1021,8 @@ public:
std::string as_string () const;
+ std::string as_name () const;
+
const Resolver::TraitReference *get () const;
Location get_locus () const { return locus; }