diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-03-27 17:20:15 +0100 |
---|---|---|
committer | P-E-P <32375388+P-E-P@users.noreply.github.com> | 2024-09-26 22:48:32 +0000 |
commit | 5e8da717fe1321fe1bcbb8979da8375faedbd90c (patch) | |
tree | 5a56c1e7724ae84687789e6d2ca644ed2daae30f /gcc | |
parent | 438470e8e327cd4d9c90ad701d1679062ee215ee (diff) | |
download | gcc-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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/resolve/rust-default-resolver.cc | 5 |
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 ¶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 |