aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2024-03-27 17:20:15 +0100
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2024-09-26 22:48:32 +0000
commit5e8da717fe1321fe1bcbb8979da8375faedbd90c (patch)
tree5a56c1e7724ae84687789e6d2ca644ed2daae30f
parent438470e8e327cd4d9c90ad701d1679062ee215ee (diff)
downloadgcc-5e8da717fe1321fe1bcbb8979da8375faedbd90c.zip
gcc-5e8da717fe1321fe1bcbb8979da8375faedbd90c.tar.gz
gcc-5e8da717fe1321fe1bcbb8979da8375faedbd90c.tar.bz2
nr2.0: default-visitor: Conditionally visit type in self parameters.
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.
-rw-r--r--gcc/rust/resolve/rust-default-resolver.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/rust/resolve/rust-default-resolver.cc b/gcc/rust/resolve/rust-default-resolver.cc
index 1a9d377..5183f89 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 &param = 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