aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2025-05-02 20:28:15 -0400
committerPhilip Herron <philip.herron@embecosm.com>2025-05-07 15:33:20 +0000
commit98573bd61ef95e4224bc2d050fa1f47d893f2c31 (patch)
tree164dde56df7e6c356b54d041ecb21034eea73893 /gcc/rust/resolve
parent927d067721e91ad3d702f9b9efaf939afd319ef1 (diff)
downloadgcc-98573bd61ef95e4224bc2d050fa1f47d893f2c31.zip
gcc-98573bd61ef95e4224bc2d050fa1f47d893f2c31.tar.gz
gcc-98573bd61ef95e4224bc2d050fa1f47d893f2c31.tar.bz2
Improve canonical path handling for impl items
gcc/rust/ChangeLog: * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Use the return values of CanonicalPath::inherent_impl_seg and CanonicalPath::trait_impl_projection_seg more directly. * util/rust-canonical-path.h (CanonicalPath::trait_impl_projection_seg): Append "<impl " instead of "<" to the beginning of the returned path segment. (CanonicalPath::inherent_impl_seg): Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust/resolve')
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-item.cc13
1 files changed, 2 insertions, 11 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-item.cc b/gcc/rust/resolve/rust-ast-resolve-item.cc
index fc226cf..c2626ea 100644
--- a/gcc/rust/resolve/rust-ast-resolve-item.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-item.cc
@@ -608,10 +608,7 @@ ResolveItem::visit (AST::InherentImpl &impl_block)
}
else
{
- std::string seg_buf = "<impl " + self_cpath.get () + ">";
- CanonicalPath seg
- = CanonicalPath::new_seg (impl_block.get_node_id (), seg_buf);
- cpath = canonical_prefix.append (seg);
+ cpath = canonical_prefix.append (impl_type_seg);
}
// done setup paths
@@ -732,13 +729,7 @@ ResolveItem::visit (AST::TraitImpl &impl_block)
}
else
{
- std::string projection_str = canonical_projection.get ();
- std::string seg_buf
- = "<impl " + projection_str.substr (1, projection_str.size () - 2)
- + ">";
- CanonicalPath seg
- = CanonicalPath::new_seg (impl_block.get_node_id (), seg_buf);
- cpath = canonical_prefix.append (seg);
+ cpath = canonical_prefix.append (canonical_projection);
}
// DONE setup canonical-path