]> gcc.gnu.org Git - gcc.git/commit
gccrs: Respect the concrete type when resolving qualifed path types
authorPhilip Herron <herron.philip@googlemail.com>
Wed, 31 May 2023 15:06:58 +0000 (16:06 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:46:24 +0000 (18:46 +0100)
commite64a12f903bd64437bc9267f27dc2ba59b6ad5d5
treea4c30bacac95083e16f5a240610f22e2f8d3556b
parent18ba67df507b0c4560200b444f37dce07c6fc803
gccrs: Respect the concrete type when resolving qualifed path types

Concrete types can resolve to assoicated impl blocks which will allow us to
resolve the path to the projection type instead of the placeholder trait
associated type which can change. The projection will be fixed and is
safer to use.

Fixes #2165 #2166

gcc/rust/ChangeLog:

* typecheck/rust-hir-trait-resolve.cc: when the bound is concrete keep the mapping
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): add missing call
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): make this the same as paths

gcc/testsuite/ChangeLog:

* rust/compile/issue-2165.rs: New test.
* rust/compile/issue-2166.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/typecheck/rust-hir-trait-resolve.cc
gcc/rust/typecheck/rust-hir-type-check-path.cc
gcc/rust/typecheck/rust-hir-type-check-type.cc
gcc/testsuite/rust/compile/issue-2165.rs [new file with mode: 0644]
gcc/testsuite/rust/compile/issue-2166.rs [new file with mode: 0644]
This page took 0.06411 seconds and 6 git commands to generate.