https://gcc.gnu.org/g:3acbf40e874cf8c85fbbe64db93d81201e1dc480

commit r16-4885-g3acbf40e874cf8c85fbbe64db93d81201e1dc480
Author: Pierre-Emmanuel Patry <[email protected]>
Date:   Wed Oct 1 16:26:47 2025 +0200

    gccrs: Force crash when retrieving meta item location
    
    We still don't know which location should be preferred over the other,
    this means that nobody should rely on this function's return value.
    
    gcc/rust/ChangeLog:
    
            * ast/rust-expr.h: Force crash when retrieving locus.
    
    Signed-off-by: Pierre-Emmanuel Patry <[email protected]>

Diff:
---
 gcc/rust/ast/rust-expr.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h
index 239b9511f67f..3c36238c6ee6 100644
--- a/gcc/rust/ast/rust-expr.h
+++ b/gcc/rust/ast/rust-expr.h
@@ -298,7 +298,11 @@ public:
   //  we have no idea use which of them, just simply return UNKNOWN_LOCATION
   //  now.
   // Maybe we will figure out when we really need the location in the future.
-  location_t get_locus () const override { return UNKNOWN_LOCATION; }
+  location_t get_locus () const override
+  {
+    rust_unreachable ();
+    return UNKNOWN_LOCATION;
+  }
 
   void accept_vis (ASTVisitor &vis) override;

Reply via email to