From: Arthur Cohen <[email protected]>
This could trigger an assertions as `get_type` on `SelfParam` asserts that
the self param does have a given type, which is not always the case.
gcc/rust/ChangeLog:
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Do not
visit self's type if it does not have one.
---
gcc/rust/resolve/rust-default-resolver.cc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gcc/rust/resolve/rust-default-resolver.cc
b/gcc/rust/resolve/rust-default-resolver.cc
index 89e7e39f5bb..b2cdc5f52d2 100644
--- a/gcc/rust/resolve/rust-default-resolver.cc
+++ b/gcc/rust/resolve/rust-default-resolver.cc
@@ -68,7 +68,10 @@ DefaultResolver::visit (AST::Function &function)
else if (p->is_self ())
{
auto ¶m = static_cast<AST::SelfParam &> (*p);
- param.get_type ().accept_vis (*this);
+
+ if (param.has_type ())
+ param.get_type ().accept_vis (*this);
+
param.get_lifetime ().accept_vis (*this);
}
else
--
2.45.2