diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-03-27 17:20:15 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-19 15:32:12 +0100 |
commit | 68af48783006d7c51371b0e8634e82ef0256e4ab (patch) | |
tree | 5c59465087d106bb22d507d1d3f3ba361fd6299d /gcc | |
parent | 0581e0d9a8b1e47d43f8a6477b0536392532b6d3 (diff) | |
download | gcc-68af48783006d7c51371b0e8634e82ef0256e4ab.zip gcc-68af48783006d7c51371b0e8634e82ef0256e4ab.tar.gz gcc-68af48783006d7c51371b0e8634e82ef0256e4ab.tar.bz2 |
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.
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 89e7e39..b2cdc5f 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 |