[gcc r14-7403] gccrs: ast: Fix location for pub(crate)

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 17:31:43 GMT 2024


https://gcc.gnu.org/g:e61de6657d315835a427da542f692a1db1d812a1

commit r14-7403-ge61de6657d315835a427da542f692a1db1d812a1
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date:   Tue Mar 28 11:34:27 2023 +0200

    gccrs: ast: Fix location for pub(crate)
    
    When creating a SimplePath from a string, we end up creating a path
    which contains only one segment but no location. Take the location of
    the one segment instead and use it as the simple path's location.
    
    gcc/rust/ChangeLog:
    
            * ast/rust-ast.h: Call SimplePath constructor differently in
            SimplePath::from_str

Diff:
---
 gcc/rust/ast/rust-ast.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h
index 5e5913b95f6..70da8591340 100644
--- a/gcc/rust/ast/rust-ast.h
+++ b/gcc/rust/ast/rust-ast.h
@@ -413,7 +413,7 @@ public:
   {
     std::vector<AST::SimplePathSegment> single_segments
       = {AST::SimplePathSegment (std::move (str), locus)};
-    return SimplePath (std::move (single_segments));
+    return SimplePath (std::move (single_segments), false, locus);
   }
 
   const std::vector<SimplePathSegment> &get_segments () const


More information about the Gcc-cvs mailing list