aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve/rust-ice-finalizer.cc
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2024-11-25 18:04:06 +0100
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2025-01-21 16:45:34 +0000
commit289bf52597fbe4cd85c0dca2bcb0404a960ad588 (patch)
tree2c2682a74ce58a12281986cd83ddebd3f8605dd4 /gcc/rust/resolve/rust-ice-finalizer.cc
parent490c70374d9e98d8f9b761afe1be1a36a8ed41d0 (diff)
downloadgcc-289bf52597fbe4cd85c0dca2bcb0404a960ad588.zip
gcc-289bf52597fbe4cd85c0dca2bcb0404a960ad588.tar.gz
gcc-289bf52597fbe4cd85c0dca2bcb0404a960ad588.tar.bz2
Fix rust breakage with nr2
Nr2 did not emit the correct error message for break identifier "rust". gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add "rust" identifier detection akin to nr1. (funny_ice_finalizer): Copy ICE finalizer from nr1. * resolve/rust-late-name-resolver-2.0.h: Add funny_error member context state. * Make-lang.in: Add new translation unit for new ice finalizer. * resolve/rust-ast-resolve-expr.cc: Move ice finalizer to it's own file. * resolve/rust-ice-finalizer.cc: New file. * resolve/rust-ice-finalizer.h: New file. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove break-rust3.rs from exclude list. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/resolve/rust-ice-finalizer.cc')
-rw-r--r--gcc/rust/resolve/rust-ice-finalizer.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/rust/resolve/rust-ice-finalizer.cc b/gcc/rust/resolve/rust-ice-finalizer.cc
new file mode 100644
index 0000000..3ec8438
--- /dev/null
+++ b/gcc/rust/resolve/rust-ice-finalizer.cc
@@ -0,0 +1,35 @@
+// Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+// This file is part of GCC.
+
+// GCC is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 3, or (at your option) any later
+// version.
+
+// GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with GCC; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include "rust-ice-finalizer.h"
+
+namespace Rust {
+namespace Resolver {
+
+void ATTRIBUTE_NORETURN
+funny_ice_finalizer (diagnostic_context *context,
+ const diagnostic_info *diagnostic, diagnostic_t diag_kind)
+{
+ gcc_assert (diag_kind == DK_ICE_NOBT);
+ default_diagnostic_finalizer (context, diagnostic, diag_kind);
+ fnotice (stderr, "You have broken GCC Rust. This is a feature.\n");
+ exit (ICE_EXIT_CODE);
+}
+
+} // namespace Resolver
+} // namespace Rust