From: Arthur Cohen Date: Wed, 27 Mar 2024 16:20:15 +0000 (+0100) Subject: gccrs: nr2.0: default-visitor: Conditionally visit type in self parameters. X-Git-Tag: basepoints/gcc-16~1165 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68af48783006d7c51371b0e8634e82ef0256e4ab;p=thirdparty%2Fgcc.git gccrs: 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. --- 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 (*p); - param.get_type ().accept_vis (*this); + + if (param.has_type ()) + param.get_type ().accept_vis (*this); + param.get_lifetime ().accept_vis (*this); } else