From: Pierre-Emmanuel Patry <[email protected]>

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]>
---
 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 239b9511f67..3c36238c6ee 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;
 
-- 
2.50.1

Reply via email to