From 1eb46203ced28c5a3e44f6b63a23d4e91bd4f344 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Thu, 13 Feb 2025 17:45:09 +0000 Subject: gccrs: self paths are patterns but we dont have mappings for it With simple patterns we dont introduce any more inference varaibles as they are already declared in a specific way. This would only lead to more unconstrained inference varaibles than is required. Fixes Rust-GCC#3022 gcc/rust/ChangeLog: * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_self): add location mappings * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path): check for self gcc/testsuite/ChangeLog: * rust/compile/issue-3022.rs: New test. Signed-off-by: Philip Herron --- gcc/rust/hir/rust-ast-lower-base.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/rust/hir') diff --git a/gcc/rust/hir/rust-ast-lower-base.cc b/gcc/rust/hir/rust-ast-lower-base.cc index 229f6e0..02fac9a 100644 --- a/gcc/rust/hir/rust-ast-lower-base.cc +++ b/gcc/rust/hir/rust-ast-lower-base.cc @@ -666,6 +666,7 @@ ASTLoweringBase::lower_self (AST::Param ¶m) Analysis::NodeMapping mapping (crate_num, self.get_node_id (), mappings.get_next_hir_id (crate_num), mappings.get_next_localdef_id (crate_num)); + mappings.insert_location (mapping.get_hirid (), param.get_locus ()); if (self.has_type ()) { -- cgit v1.1