]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Add missing name resolution to item statements
authorPhilip Herron <herron.philip@googlemail.com>
Tue, 30 May 2023 12:45:58 +0000 (13:45 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:37:22 +0000 (18:37 +0100)
commit56e29f4d5de8134db5f7772adc13154f3efccf43
treeddd86d2a368468da6dd9148eb209ba94047bbdca
parent546fbc6289b43ed59fc18d353084faf53c5bcced
gccrs: Add missing name resolution to item statements

This fixes the issue but there are two cleanups to do at some point.

  1. misc namesapce this is a scope AST namespace where we dump resolution
     info when its not defined here. This occurs in the case such as nested
     scopes where the nested scope is popped and we hit an assertion.
     Outside of name resolution this requirement shouldnt really apply
     it should be permissive to allow for this

  2. We reuse our existing name resolution pieces here for Traits and impl
     blocks we should start doing this for the other statements.

Fixes #2238

gcc/rust/ChangeLog:

* resolve/rust-ast-resolve-stmt.cc (ResolveStmt::visit): add name resolution
* resolve/rust-ast-resolve-stmt.h: likewise
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): insert resolved node

gcc/testsuite/ChangeLog:

* rust/compile/issue-2238.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/resolve/rust-ast-resolve-stmt.cc
gcc/rust/resolve/rust-ast-resolve-stmt.h
gcc/rust/typecheck/rust-hir-type-check-expr.cc
gcc/testsuite/rust/compile/issue-2238.rs [new file with mode: 0644]