diff options
Diffstat (limited to 'gcc/rust/util/rust-canonical-path.h')
-rw-r--r-- | gcc/rust/util/rust-canonical-path.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/rust/util/rust-canonical-path.h b/gcc/rust/util/rust-canonical-path.h index 4d8f954..079ae76 100644 --- a/gcc/rust/util/rust-canonical-path.h +++ b/gcc/rust/util/rust-canonical-path.h @@ -57,10 +57,11 @@ public: return *this; } - static CanonicalPath new_seg (NodeId id, const std::string &path) + static CanonicalPath new_seg (NodeId id, std::string path) { rust_assert (!path.empty ()); - return CanonicalPath ({std::pair<NodeId, std::string> (id, path)}, + return CanonicalPath ({std::pair<NodeId, std::string> (id, + std::move (path))}, UNKNOWN_CRATENUM); } @@ -68,14 +69,18 @@ public: trait_impl_projection_seg (NodeId id, const CanonicalPath &trait_seg, const CanonicalPath &impl_type_seg) { - return CanonicalPath::new_seg (id, "<" + impl_type_seg.get () + " as " + // https://doc.rust-lang.org/reference/paths.html#canonical-paths + // should be "<X>"? + return CanonicalPath::new_seg (id, "<impl " + impl_type_seg.get () + " as " + trait_seg.get () + ">"); } static CanonicalPath inherent_impl_seg (NodeId id, const CanonicalPath &impl_type_seg) { - return CanonicalPath::new_seg (id, "<" + impl_type_seg.get () + ">"); + // https://doc.rust-lang.org/reference/paths.html#canonical-paths + // should be "<X as Y>"? + return CanonicalPath::new_seg (id, "<impl " + impl_type_seg.get () + ">"); } std::string get () const |