From 3acbf40e874cf8c85fbbe64db93d81201e1dc480 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Wed, 1 Oct 2025 16:26:47 +0200 Subject: [PATCH] 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 --- 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.47.3