aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-expr.cc
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2024-11-25 21:37:19 +0000
committerPhilip Herron <philip.herron@embecosm.com>2024-11-27 22:40:59 +0000
commitc11ee4f56266512171fb77d6bcaf37f390e5ad30 (patch)
tree7588d2d3ebc76df5d65fbce6962d2c94aa339548 /gcc/rust/backend/rust-compile-expr.cc
parenta4abbbcffe4a30f069c3d74236d2253b89bd8aeb (diff)
downloadgcc-c11ee4f56266512171fb77d6bcaf37f390e5ad30.zip
gcc-c11ee4f56266512171fb77d6bcaf37f390e5ad30.tar.gz
gcc-c11ee4f56266512171fb77d6bcaf37f390e5ad30.tar.bz2
gccrs: improve handling of Self Type paths
TypePaths have special handling for Self where we can look at the current ctx for more acurate TypeAlias information if required. We cant do this for Impl contexts but not for Traits as we might as well fall back to the TypePathProbe. The other issue was the dyn type comming in because Foo::foo and Foo is a trait reference we represent this as a dyn type as the root resolved path but then find the associated impl block for this but we cannot do this when we have resolved to a Dyn because this is just a representation that we know we are talking about a trait not because we are actually working with a real Dyn type. Fixes Rust-GCC#2907 gcc/rust/ChangeLog: * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): track trait * typecheck/rust-hir-type-check-implitem.cc: trait block * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): dont when dyn * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): look at Self contenxt (TypeCheckType::resolve_root_path): track if Self (TypeCheckType::resolve_associated_type): look at current context for associated types * typecheck/rust-hir-type-check-type.h: change prototype * typecheck/rust-hir-type-check.h (class TypeCheckBlockContextItem): new context system to track current state * typecheck/rust-typecheck-context.cc (TypeCheckContext::have_block_context): likewise (TypeCheckContext::peek_block_context): likewise (TypeCheckContext::push_block_context): likewise (TypeCheckContext::pop_block_context): likewise (TypeCheckBlockContextItem::Item::Item): likewise (TypeCheckBlockContextItem::TypeCheckBlockContextItem): likewise (TypeCheckBlockContextItem::is_impl_block): likewise (TypeCheckBlockContextItem::is_trait_block): likewise (TypeCheckBlockContextItem::get_impl_block): likewise (TypeCheckBlockContextItem::get_trait): likewise gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr2 cant handle this * rust/compile/issue-2907.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.cc')
0 files changed, 0 insertions, 0 deletions