]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: rust-unreachable: Add specific behavior for rust_unreachable
authorArthur Cohen <arthur.cohen@embecosm.com>
Sun, 9 Jul 2023 11:44:52 +0000 (13:44 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:49:37 +0000 (18:49 +0100)
As discussed during the community call, rust_unreachable() should
always trigger an internal compiler error and should not offer
the behavior of __builtin_unreachable when asserts are disabled, unlike
gcc_unreachable().

gcc/rust/ChangeLog:

* rust-system.h (rust_unreachable): Change definition to fancy_abort
* ast/rust-ast-collector.cc (TokenCollector::visit): Use rust_unreachable
instead of gcc_unreachable.
(get_delimiters): Likewise.
* ast/rust-ast-dump.h: Likewise.
* ast/rust-ast-formatting.cc (get_string_in_delims): Likewise.
(get_mode_dump_desc): Likewise.
* ast/rust-ast.cc (Visibility::as_string): Likewise.
(UseTreeGlob::as_string): Likewise.
* ast/rust-ast.h: Likewise.
* ast/rust-macro.h: Likewise.
* ast/rust-path.h: Likewise.
* backend/rust-compile-expr.cc (sort_tuple_patterns): Likewise.
(CompileExpr::visit): Likewise.
(CompileExpr::generate_closure_fntype): Likewise.
* backend/rust-compile-intrinsic.cc (op_with_overflow_inner): Likewise.
* backend/rust-compile-pattern.cc (CompilePatternBindings::visit): Likewise.
(CompilePatternLet::visit): Likewise.
* backend/rust-constexpr.cc (base_field_constructor_elt): Likewise.
(eval_array_reference): Likewise.
(label_matches): Likewise.
(eval_store_expression): Likewise.
(eval_call_expression): Likewise.
(build_data_member_initialization): Likewise.
(array_index_cmp): Likewise.
(get_array_or_vector_nelts): Likewise.
(eval_bit_field_ref): Likewise.
(eval_loop_expr): Likewise.
(potential_constant_expression_1): Likewise.
* backend/rust-mangle.cc (v0_simple_type_prefix): Likewise.
(v0_type_prefix): Likewise.
(v0_mangle_item): Likewise.
(Mangler::mangle_item): Likewise.
* backend/rust-tree.cc (convert_to_void): Likewise.
(type_memfn_quals): Likewise.
(rs_tree_equal): Likewise.
(fold_offsetof): Likewise.
(fold_builtin_source_location): Likewise.
(lvalue_error): Likewise.
* backend/rust-tree.h (struct named_decl_hash): Likewise.
(struct named_label_hash): Likewise.
* checks/errors/privacy/rust-visibility-resolver.cc
(VisibilityResolver::resolve_visibility): Likewise.
(VisibilityResolver::visit): Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::ctx_to_str): Likewise.
* checks/errors/rust-feature.cc (Feature::create): Likewise.
* expand/rust-expand-visitor.cc (get_traits_to_derive): Likewise.
(derive_item): Likewise.
(expand_item_attribute): Likewise.
(expand_stmt_attribute): Likewise.
* expand/rust-macro-expand.cc (MacroExpander::match_matcher): Likewise.
(MacroExpander::match_repetition): Likewise.
(transcribe_context): Likewise.
(MacroExpander::import_proc_macros): Likewise.
(MacroExpander::parse_proc_macro_output): Likewise.
* expand/rust-macro-expand.h: Likewise.
* expand/rust-macro-invoc-lexer.h: Likewise.
* expand/rust-macro-substitute-ctx.cc (SubstituteCtx::substitute_token): Likewise.
* expand/rust-proc-macro-invoc-lexer.h: Likewise.
* expand/rust-proc-macro.cc (load_macros): Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_generic_args): Likewise.
(ASTLoweringBase::lower_literal): Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise.
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Likewise.
* hir/rust-ast-lower-type.cc (ASTLoweringType::visit): Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/tree/rust-hir.cc (get_string_in_delims): Likewise.
(Visibility::as_string): Likewise.
(UseTreeGlob::as_string): Likewise.
(CompoundAssignmentExpr::as_string): Likewise.
(ArithmeticOrLogicalExpr::as_string): Likewise.
* lex/rust-lex.cc (Lexer::parse_byte_string): Likewise.
(Lexer::parse_string): Likewise.
* lex/rust-token.cc (RS_TOKEN): Likewise.
* parse/rust-parse-impl.h (Parser::parse_simple_path_segment): Likewise.
(Parser::parse_path_ident_segment): Likewise.
(Parser::parse_attr_input): Likewise.
(Parser::parse_inherent_impl_item): Likewise.
(Parser::parse_trait_impl_item): Likewise.
(Parser::parse_type_path_segment): Likewise.
(Parser::parse_reference_type): Likewise.
(get_lbp_for_comparison_expr): Likewise.
* parse/rust-parse.cc (peculiar_fragment_match_compatible): Likewise.
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Likewise.
* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::visit): Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise.
(ResolveTypeToCanonicalPath::visit): Likewise.
(ResolveGenericArgs::resolve_disambiguated_generic): Likewise.
* rust-gcc.cc (operator_to_tree_code): Likewise.
(fetch_overflow_builtins): Likewise.
(Gcc_backend::non_zero_size_type): Likewise.
(Gcc_backend::convert_tree): Likewise.
* rust-lang.cc (grs_langhook_type_for_mode): Likewise.
(grs_langhook_global_bindings_p): Likewise.
(grs_langhook_pushdecl): Likewise.
(grs_langhook_getdecls): Likewise.
(convert): Likewise.
* typecheck/rust-autoderef.h: Likewise.
* typecheck/rust-hir-path-probe.cc: Likewise.
* typecheck/rust-hir-trait-reference.cc (TraitItemReference::get_tyty): Likewise.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): Likewise.
* typecheck/rust-hir-type-check-expr.cc: Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItem::visit): Likewise.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.h: Likewise.
* typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): Likewise.
* typecheck/rust-substitution-mapper.h: Likewise.
* typecheck/rust-typecheck-context.cc (TypeCheckContextItem::get_context_type): Likewise.
* typecheck/rust-tyty-call.h: Likewise.
* typecheck/rust-tyty.cc (TypeKindFormat::to_string): Likewise.
(BaseType::monomorphized_clone): Likewise.
(VariantDef::variant_type_string): Likewise.
(ClosureType::handle_substitions): Likewise.
(IntType::as_string): Likewise.
(UintType::as_string): Likewise.
(FloatType::as_string): Likewise.
* typecheck/rust-unify.cc (UnifyRules::expect_projection): Likewise.
* util/rust-token-converter.cc (convert): Likewise.
(from_literal): Likewise.
(from_group): Likewise.
(from_tokentree): Likewise.

56 files changed:
gcc/rust/ast/rust-ast-collector.cc
gcc/rust/ast/rust-ast-dump.h
gcc/rust/ast/rust-ast-formatting.cc
gcc/rust/ast/rust-ast.cc
gcc/rust/ast/rust-ast.h
gcc/rust/ast/rust-macro.h
gcc/rust/ast/rust-path.h
gcc/rust/backend/rust-compile-expr.cc
gcc/rust/backend/rust-compile-intrinsic.cc
gcc/rust/backend/rust-compile-pattern.cc
gcc/rust/backend/rust-constexpr.cc
gcc/rust/backend/rust-mangle.cc
gcc/rust/backend/rust-tree.cc
gcc/rust/backend/rust-tree.h
gcc/rust/checks/errors/privacy/rust-visibility-resolver.cc
gcc/rust/checks/errors/rust-const-checker.cc
gcc/rust/checks/errors/rust-feature.cc
gcc/rust/expand/rust-expand-visitor.cc
gcc/rust/expand/rust-macro-expand.cc
gcc/rust/expand/rust-macro-expand.h
gcc/rust/expand/rust-macro-invoc-lexer.h
gcc/rust/expand/rust-macro-substitute-ctx.cc
gcc/rust/expand/rust-proc-macro-invoc-lexer.h
gcc/rust/expand/rust-proc-macro.cc
gcc/rust/hir/rust-ast-lower-base.cc
gcc/rust/hir/rust-ast-lower-expr.cc
gcc/rust/hir/rust-ast-lower-pattern.cc
gcc/rust/hir/rust-ast-lower-type.cc
gcc/rust/hir/rust-hir-dump.cc
gcc/rust/hir/tree/rust-hir.cc
gcc/rust/lex/rust-lex.cc
gcc/rust/lex/rust-token.cc
gcc/rust/parse/rust-parse-impl.h
gcc/rust/parse/rust-parse.cc
gcc/rust/resolve/rust-ast-resolve-path.cc
gcc/rust/resolve/rust-ast-resolve-pattern.cc
gcc/rust/resolve/rust-ast-resolve-type.cc
gcc/rust/rust-gcc.cc
gcc/rust/rust-lang.cc
gcc/rust/rust-system.h
gcc/rust/typecheck/rust-autoderef.h
gcc/rust/typecheck/rust-hir-path-probe.cc
gcc/rust/typecheck/rust-hir-trait-reference.cc
gcc/rust/typecheck/rust-hir-type-check-base.cc
gcc/rust/typecheck/rust-hir-type-check-expr.cc
gcc/rust/typecheck/rust-hir-type-check-expr.h
gcc/rust/typecheck/rust-hir-type-check-implitem.cc
gcc/rust/typecheck/rust-hir-type-check-pattern.cc
gcc/rust/typecheck/rust-hir-type-check-stmt.h
gcc/rust/typecheck/rust-hir-type-check.cc
gcc/rust/typecheck/rust-substitution-mapper.h
gcc/rust/typecheck/rust-typecheck-context.cc
gcc/rust/typecheck/rust-tyty-call.h
gcc/rust/typecheck/rust-tyty.cc
gcc/rust/typecheck/rust-unify.cc
gcc/rust/util/rust-token-converter.cc

index 9859861b4a5ae637a21c3c257f540314c7c5a8ac..ad2ffd025283df02571bcac6496e2f12f2820c38 100644 (file)
@@ -208,7 +208,7 @@ TokenCollector::visit (Attribute &attrib)
            break;
          }
        default:
-         gcc_unreachable ();
+         rust_unreachable ();
        }
     }
   push (Rust::Token::make (RIGHT_SQUARE, UNDEF_LOCATION));
@@ -668,7 +668,7 @@ TokenCollector::visit (GenericArg &arg)
       }
       break;
     case GenericArg::Kind::Error:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
@@ -822,11 +822,11 @@ TokenCollector::visit (Literal &lit, Location locus)
        else if (value == "true")
          push (Rust::Token::make (TRUE_LITERAL, locus));
        else
-         gcc_unreachable (); // Not a boolean
+         rust_unreachable (); // Not a boolean
        break;
       }
     case Literal::LitType::ERROR:
-      gcc_unreachable ();
+      rust_unreachable ();
       break;
     }
 }
@@ -1188,7 +1188,7 @@ void
 TokenCollector::visit (StructExprStructBase &)
 {
   // FIXME: Implement this node
-  gcc_unreachable ();
+  rust_unreachable ();
 }
 
 void
@@ -2252,7 +2252,7 @@ get_delimiters (DelimType delim)
     case CURLY:
       return {LEFT_CURLY, RIGHT_CURLY};
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
index 38df5f3951b43c15c71c0c4571351fdc81e4678d..b76cbbf825d333d7c04abc71699822fa400db7a1 100644 (file)
@@ -71,7 +71,7 @@ public:
            previous = nullptr;
            break;
          default:
-           gcc_unreachable ();
+           rust_unreachable ();
          }
       }
   }
index 4c13ef05dc6d2da165ff022c628aa41b72d5cd7e..e6f969f2dfc59847183d3ddcd1a2f49656e7c8ab 100644 (file)
@@ -51,7 +51,7 @@ get_string_in_delims (std::string str_input, DelimType delim_type)
     default:
       return "ERROR-MARK-STRING (delims)";
     }
-  gcc_unreachable ();
+  rust_unreachable ();
 }
 
 std::string
@@ -64,7 +64,7 @@ get_mode_dump_desc (AttrMode mode)
     case INNER:
       return "inner attributes";
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
       return "";
     }
 }
index 1319b7de7bc9b09e7342f4100baf9674a6ee7f25..4e24f1d406a6f658852da0e1dd5c93c13486560a 100644 (file)
@@ -225,7 +225,7 @@ Visibility::as_string () const
     case PUB_IN_PATH:
       return std::string ("pub(in ") + in_path.as_string () + std::string (")");
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
@@ -623,7 +623,7 @@ UseTreeGlob::as_string () const
       // some kind of error
       return "ERROR-PATH";
     }
-  gcc_unreachable ();
+  rust_unreachable ();
 }
 
 std::string
index 520baaec3e389db51f577619a612c3911bf3fb51..85dae487b3b9087f2c8276cefc2ad4340becbb50 100644 (file)
@@ -1887,7 +1887,7 @@ public:
        return type == nullptr;
       }
 
-    gcc_unreachable ();
+    rust_unreachable ();
     return true;
   }
 
@@ -1913,7 +1913,7 @@ public:
        return "Type: " + type->as_string ();
       }
 
-    gcc_unreachable ();
+    rust_unreachable ();
     return "";
   }
 };
index 1620ff6974b8bcc93ba9e0a5d04d997a830a3bef..55fbd3a3fe8817ccb27164f6a1faf24e25140cc1 100644 (file)
@@ -473,14 +473,14 @@ private:
 
   /**
    * Default function to use as an associated transcriber. This function should
-   * never be called, hence the gcc_unreachable().
+   * never be called, hence the rust_unreachable().
    * If this function is used, then the macro is not builtin and the compiler
    * should make use of the actual rules. If the macro is builtin, then another
    * associated transcriber should be used
    */
   static Fragment dummy_builtin (Location, MacroInvocData &)
   {
-    gcc_unreachable ();
+    rust_unreachable ();
     return Fragment::create_error ();
   }
 
index cdd90e84b724f992a5fe43d08eba2a46a2d1a6f9..5675fda424341357b26d177aada6ff24f665494e 100644 (file)
@@ -224,7 +224,7 @@ public:
       case Kind::Either:
        break;
       case Kind::Error:
-       gcc_unreachable ();
+       rust_unreachable ();
       }
   }
 
@@ -254,7 +254,7 @@ public:
     switch (get_kind ())
       {
       case Kind::Error:
-       gcc_unreachable ();
+       rust_unreachable ();
       case Kind::Either:
        return "Ambiguous: " + path.as_string ();
       case Kind::Const:
index b6f92bb1e1552ff0dacb14b8ae77751011735137..80cc608a53e948bcb96ccbe24fa31d636befadb2 100644 (file)
@@ -1117,7 +1117,7 @@ sort_tuple_patterns (HIR::MatchExpr &expr)
       else /* TuplePatternItemType::RANGED */
        {
          // FIXME
-         gcc_unreachable ();
+         rust_unreachable ();
        }
     }
 
@@ -1430,25 +1430,25 @@ CompileExpr::visit (HIR::MatchExpr &expr)
            else
              {
                // FIXME: There are other cases, but it better not be a Tuple
-               gcc_unreachable ();
+               rust_unreachable ();
              }
          }
          break;
 
          case HIR::Expr::ExprType::Path: {
            // FIXME
-           gcc_unreachable ();
+           rust_unreachable ();
          }
          break;
 
        default:
-         gcc_unreachable ();
+         rust_unreachable ();
        }
     }
   else
     {
       // FIXME: match on other types of expressions not yet implemented.
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 
   // setup the end label so the cases can exit properly
@@ -2856,7 +2856,7 @@ CompileExpr::generate_closure_fntype (HIR::ClosureExpr &expr,
   else
     {
       // FIXME error message?
-      gcc_unreachable ();
+      rust_unreachable ();
       return error_mark_node;
     }
 
index 0034f1e1188d41a728410fb17899d0240c594c3e..0521d850cada101498b5f3bd6290c2a91ccc5790 100644 (file)
@@ -627,7 +627,7 @@ op_with_overflow_inner (Context *ctx, TyTy::FnType *fntype, tree_code op)
       break;
 
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
       break;
     }
   rust_assert (overflow_builtin != error_mark_node);
index 6d7678d03a7148d431d057b8707b91d1b82f1dc6..c65569091edd7d9b99afb2cfe0bc5cd3ccfa59f2 100644 (file)
@@ -199,7 +199,7 @@ CompilePatternBindings::visit (HIR::TupleStructPattern &pattern)
     {
       case HIR::TupleStructItems::RANGE: {
        // TODO
-       gcc_unreachable ();
+       rust_unreachable ();
       }
       break;
 
@@ -284,13 +284,13 @@ CompilePatternBindings::visit (HIR::StructPattern &pattern)
        {
          case HIR::StructPatternField::ItemType::TUPLE_PAT: {
            // TODO
-           gcc_unreachable ();
+           rust_unreachable ();
          }
          break;
 
          case HIR::StructPatternField::ItemType::IDENT_PAT: {
            // TODO
-           gcc_unreachable ();
+           rust_unreachable ();
          }
          break;
 
@@ -467,7 +467,7 @@ CompilePatternLet::visit (HIR::TuplePattern &pattern)
        return;
       }
       default: {
-       gcc_unreachable ();
+       rust_unreachable ();
       }
     }
 }
index 0eed9186905814969f7ac7aecc26b3741e101121..a80cfd7600b94130fd70e3840846bf7be3e89738 100644 (file)
@@ -1131,7 +1131,7 @@ base_field_constructor_elt (vec<constructor_elt, va_gc> *v, tree ref)
     if (ce->index == field)
       return ce;
 
-  gcc_unreachable ();
+  rust_unreachable ();
   return NULL;
 }
 
@@ -1617,7 +1617,7 @@ eval_array_reference (const constexpr_ctx *ctx, tree t, bool lval,
       /* We can't do anything with other tree codes, so use
         VERIFY_CONSTANT to complain and fail.  */
       VERIFY_CONSTANT (ary);
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 
   bool found;
@@ -1854,7 +1854,7 @@ label_matches (const constexpr_ctx *ctx, tree *jump_target, tree stmt)
       break;
 
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
   return false;
 }
@@ -2694,7 +2694,7 @@ eval_store_expression (const constexpr_ctx *ctx, tree t, bool lval,
            if (TREE_CODE (probe) == ARRAY_REF)
              {
                // TODO
-               gcc_unreachable ();
+               rust_unreachable ();
                // elt = eval_and_check_array_index (ctx, probe, false,
                //                                non_constant_p, overflow_p);
                if (*non_constant_p)
@@ -3371,7 +3371,7 @@ eval_call_expression (const constexpr_ctx *ctx, tree t, bool lval,
     {
       // return cxx_eval_internal_function (ctx, t, lval,
       //                              non_constant_p, overflow_p);
-      gcc_unreachable ();
+      rust_unreachable ();
       return error_mark_node;
     }
 
@@ -3875,7 +3875,7 @@ build_data_member_initialization (tree t, vec<constructor_elt, va_gc> **vec)
 //     goto found;
 //
 //      default:
-//     gcc_unreachable ();
+//     rust_unreachable ();
 //      }
 // found:
 //
@@ -4142,7 +4142,7 @@ array_index_cmp (tree key, tree index)
          return 0;
       }
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
@@ -4434,7 +4434,7 @@ get_array_or_vector_nelts (const constexpr_ctx *ctx, tree type,
   else if (VECTOR_TYPE_P (type))
     nelts = size_int (TYPE_VECTOR_SUBPARTS (type));
   else
-    gcc_unreachable ();
+    rust_unreachable ();
 
   /* For VLAs, the number of elements won't be an integer constant.  */
   nelts
@@ -4786,7 +4786,7 @@ eval_bit_field_ref (const constexpr_ctx *ctx, tree t, bool lval,
     }
   if (fld_seen)
     return fold_convert (TREE_TYPE (t), retval);
-  gcc_unreachable ();
+  rust_unreachable ();
   return error_mark_node;
 }
 
@@ -4875,7 +4875,7 @@ eval_loop_expr (const constexpr_ctx *ctx, tree t, bool *non_constant_p,
       count = -1;
       break;
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
   auto_vec<tree, 10> save_exprs;
   new_ctx.save_exprs = &save_exprs;
@@ -6431,7 +6431,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
 
     default:
       sorry ("unexpected AST of kind %s", get_tree_code_name (TREE_CODE (t)));
-      gcc_unreachable ();
+      rust_unreachable ();
       return false;
     }
 #undef RECUR
index 83aefa7997a84d16b77ffe018444ee117e7ec136..8a1a73c326489439502fdb857f9a48abc8ad2ff5 100644 (file)
@@ -193,7 +193,7 @@ v0_simple_type_prefix (const TyTy::BaseType *ty)
       return "";
     }
 
-  gcc_unreachable ();
+  rust_unreachable ();
 }
 
 // Add an underscore-terminated base62 integer to the mangling string.
@@ -262,7 +262,7 @@ v0_type_prefix (const TyTy::BaseType *ty)
     return ty_prefix;
 
   // FIXME: We need to fetch more type prefixes
-  gcc_unreachable ();
+  rust_unreachable ();
 }
 
 static std::string
@@ -291,7 +291,7 @@ v0_mangle_item (const TyTy::BaseType *ty, const Resolver::CanonicalPath &path)
   v0_add_identifier (mangled, crate_name);
   v0_add_disambiguator (mangled, 62);
 
-  gcc_unreachable ();
+  rust_unreachable ();
 }
 
 std::string
@@ -305,7 +305,7 @@ Mangler::mangle_item (const TyTy::BaseType *ty,
     case Mangler::MangleVersion::V0:
       return v0_mangle_item (ty, path);
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
index 1a1e5a5871b942ba26d7acf0672e4dc650c5104c..d1277ffd8ca60f457fdd53cf71bf1a91f0ec87d3 100644 (file)
@@ -382,7 +382,7 @@ convert_to_void (tree expr, impl_conv_void implicit)
                            type);
                break;
              default:
-               gcc_unreachable ();
+               rust_unreachable ();
              }
          }
        /* Don't load the value if this is an implicit dereference, or if
@@ -438,7 +438,7 @@ convert_to_void (tree expr, impl_conv_void implicit)
                            type);
                break;
              default:
-               gcc_unreachable ();
+               rust_unreachable ();
              }
          }
        else if (is_volatile && TREE_ADDRESSABLE (type))
@@ -493,7 +493,7 @@ convert_to_void (tree expr, impl_conv_void implicit)
                            type);
                break;
              default:
-               gcc_unreachable ();
+               rust_unreachable ();
              }
          }
        if (is_reference || !is_volatile || !is_complete
@@ -571,7 +571,7 @@ convert_to_void (tree expr, impl_conv_void implicit)
                          expr, type);
              break;
            default:
-             gcc_unreachable ();
+             rust_unreachable ();
            }
 
        break;
@@ -1309,7 +1309,7 @@ type_memfn_quals (const_tree type)
   else if (TREE_CODE (type) == METHOD_TYPE)
     return rs_type_quals (class_of_this_parm (type));
   else
-    gcc_unreachable ();
+    rust_unreachable ();
 }
 
 // forked from gcc/cp/pt.cc find_parameter_pack_data
@@ -1880,7 +1880,7 @@ rs_tree_equal (tree t1, tree t2)
     case VOID_CST:
       /* There's only a single VOID_CST node, so we should never reach
         here.  */
-      gcc_unreachable ();
+      rust_unreachable ();
 
     case INTEGER_CST:
       return tree_int_cst_equal (t1, t2);
@@ -2047,7 +2047,7 @@ rs_tree_equal (tree t1, tree t2)
       return same_type_p (t1, t2);
 
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 
   /* We can get here with --disable-checking.  */
@@ -3643,7 +3643,7 @@ fold_offsetof (tree expr, tree type, enum tree_code ctx)
       return fold_offsetof (t, type);
 
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 
   if (!POINTER_TYPE_P (type))
@@ -3920,7 +3920,7 @@ retry:
       break;
 
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
@@ -4814,7 +4814,7 @@ fold_builtin_source_location (location_t loc)
          else if (strcmp (n, "_M_column") == 0)
            val = build_int_cst (TREE_TYPE (field), LOCATION_COLUMN (loc));
          else
-           gcc_unreachable ();
+           rust_unreachable ();
          CONSTRUCTOR_APPEND_ELT (v, field, val);
        }
 
@@ -5940,7 +5940,7 @@ lvalue_error (location_t loc, enum lvalue_use use)
       error_at (loc, "lvalue required in %<asm%> statement");
       break;
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
index b4c058fe009795d9875b196f204ba3086a317e4d..605d0ddcb5c50ca6d5d48da0df885bf28d06e572 100644 (file)
@@ -1958,7 +1958,7 @@ struct named_decl_hash : ggc_remove<tree>
 
   /* Nothing is deletable.  Everything is insertable.  */
   static bool is_deleted (value_type) { return false; }
-  static void mark_deleted (value_type) { gcc_unreachable (); }
+  static void mark_deleted (value_type) { rust_unreachable (); }
 };
 
 // forked from gcc/cp/cp-tree.h lang_decl_selector
@@ -2168,7 +2168,7 @@ struct named_label_hash : ggc_remove<named_label_entry *>
 
   /* Nothing is deletable.  Everything is insertable.  */
   inline static bool is_deleted (value_type) { return false; }
-  inline static void mark_deleted (value_type) { gcc_unreachable (); }
+  inline static void mark_deleted (value_type) { rust_unreachable (); }
 };
 
 // forked from gcc/cp/cp-tree.h
index dc6ae0ead0f624cf3063719fe1e9bdcc33c158ac..381f68c9df68d1f370cfa9a3edf129c48ca6e558 100644 (file)
@@ -117,7 +117,7 @@ VisibilityResolver::resolve_visibility (const HIR::Visibility &visibility,
        return result;
       }
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
       return false;
     }
 }
@@ -240,7 +240,7 @@ VisibilityResolver::visit (HIR::ImplBlock &impl)
          vis_item = static_cast<HIR::ConstantItem *> (item.get ());
          break;
        default:
-         gcc_unreachable ();
+         rust_unreachable ();
          return;
        }
       vis_item->accept_vis (*this);
index d9bd427ee2b0b69a4d32c1991d0606e62f22ce3c..a5b6f30721113d4c467316cc3398aaa2978332ed 100644 (file)
@@ -72,7 +72,7 @@ ConstChecker::ctx_to_str (ConstGenericCtx ctx)
     case ConstGenericCtx::Impl:
       return "impl";
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
index 035a1d1ce27cc5c5bf5c998985cf9bc9e3f6286a..88649f14e6038af723acd5e59b5b3f41179057c6 100644 (file)
@@ -43,7 +43,7 @@ Feature::create (Feature::Name name)
       return Feature (Feature::Name::EXTERN_TYPES, Feature::State::ACTIVE,
                      "extern_types", "1.23.0", 43467, tl::nullopt, "");
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
index d40d1059683cc6b7ac5f891a23aac5da14983b80..c4b3791dfa5f586630e70fb134b52a2de8f3e59c 100644 (file)
@@ -89,7 +89,7 @@ get_traits_to_derive (AST::Attribute &attr)
     case AST::AttrInput::LITERAL:
     case AST::AttrInput::META_ITEM:
     case AST::AttrInput::MACRO:
-      gcc_unreachable ();
+      rust_unreachable ();
       break;
     }
 
@@ -119,7 +119,7 @@ derive_item (AST::Item &item, const std::string &to_derive,
              result.push_back (node.take_item ());
              break;
            default:
-             gcc_unreachable ();
+             rust_unreachable ();
            }
        }
     }
@@ -142,7 +142,7 @@ expand_item_attribute (AST::Item &item, AST::SimplePath &name,
              result.push_back (node.take_item ());
              break;
            default:
-             gcc_unreachable ();
+             rust_unreachable ();
            }
        }
     }
@@ -171,7 +171,7 @@ expand_stmt_attribute (T &statement, AST::SimplePath &attribute,
              result.push_back (node.take_stmt ());
              break;
            default:
-             gcc_unreachable ();
+             rust_unreachable ();
            }
        }
     }
index f8495c68de94dc50631fc149a266f4682b5b8254..ac57e83afa8eaf283555357905b3be8d85bd90ec 100644 (file)
@@ -557,7 +557,7 @@ MacroExpander::match_matcher (Parser<MacroInvocLexer> &parser,
       }
       break;
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 
   return true;
@@ -750,7 +750,7 @@ MacroExpander::match_repetition (Parser<MacroInvocLexer> &parser,
       res = match_n_matches (parser, rep, match_amount, 0, 1);
       break;
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 
   rust_debug_loc (rep.get_match_locus (), "%s matched %lu times",
@@ -991,7 +991,7 @@ transcribe_context (MacroExpander::ContextType ctx,
     case MacroExpander::ContextType::EXPR:
       return transcribe_expression (parser);
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
@@ -1103,7 +1103,7 @@ MacroExpander::import_proc_macros (std::string extern_crate)
       // Extern crate path is not available.
       // FIXME: Emit error
       rust_error_at (UNDEF_LOCATION, "Cannot find requested proc macro crate");
-      gcc_unreachable ();
+      rust_unreachable ();
     }
   auto macros = load_macros (path->second);
 
@@ -1132,7 +1132,7 @@ MacroExpander::import_proc_macros (std::string extern_crate)
            macro.payload.bang);
          break;
        default:
-         gcc_unreachable ();
+         rust_unreachable ();
        }
     }
 }
@@ -1171,7 +1171,7 @@ MacroExpander::parse_proc_macro_output (ProcMacro::TokenStream ts)
     case ContextType::TYPE:
     case ContextType::EXPR:
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 
   if (parser.has_errors ())
index e5366c46ff7efb1ccd8286405cdf0468133f6a08..781d201bf509f7032b826dcea060ecdb1bfeee56 100644 (file)
@@ -220,7 +220,7 @@ public:
       current_map.emplace (fragment.fragment_ident,
                           MatchedFragmentContainer::metavar (fragment));
     else
-      gcc_unreachable ();
+      rust_unreachable ();
   }
 
   /**
index 4ea31d7bdde32a0df0375ba013a786c1f704a17e..c8db89204d2625750664ef13231b88ad72838f72 100644 (file)
@@ -38,7 +38,7 @@ public:
   std::string get_filename () const
   {
     // FIXME
-    gcc_unreachable ();
+    rust_unreachable ();
     return "FIXME";
   }
 
@@ -76,7 +76,7 @@ public:
   std::string get_filename () const
   {
     // FIXME
-    gcc_unreachable ();
+    rust_unreachable ();
     return "FIXME";
   }
 
index 6eeb82b10314a26d59be3f6697d73ee73cbc7468..eeb573a39d6ac2627cbe22f733579ad67d6b8032 100644 (file)
@@ -306,7 +306,7 @@ SubstituteCtx::substitute_token (size_t token_idx)
       }
     }
 
-  gcc_unreachable ();
+  rust_unreachable ();
 }
 
 std::vector<std::unique_ptr<AST::Token>>
index 7c047efb1f16dcdfa0658cdf200f0bdeb034d969..b1bae3e3778dba22d6f2f730196fd997063246e1 100644 (file)
@@ -49,7 +49,7 @@ public:
   std::string get_filename () const
   {
     // FIXME
-    gcc_unreachable ();
+    rust_unreachable ();
     return "FIXME";
   }
 
index 07a8d915474d6cdc6f10c41b5a9d08a0d9a516af..b68486eb982f38090f2807095382127b0acf4b1e 100644 (file)
@@ -43,7 +43,7 @@ load_macros_array (std::string path)
 #else
   rust_sorry_at (UNDEF_LOCATION,
                 "Procedural macros are not yet supported on windows host");
-  gcc_unreachable ();
+  rust_unreachable ();
 #endif
 }
 
@@ -53,7 +53,7 @@ load_macros (std::string path)
   const ProcMacro::ProcmacroArray *array = load_macros_array (path);
   // Did not load the proc macro
   if (array == nullptr)
-    gcc_unreachable ();
+    rust_unreachable ();
 
   rust_debug ("Found %lu procedural macros", array->length);
 
index bd1797cba52d9c42491a02d541c8c0695cb905cd..f7601e4742beb5121f27bfddb98ea0ed92e23fd8 100644 (file)
@@ -621,7 +621,7 @@ ASTLoweringBase::lower_generic_args (AST::GenericArgs &args)
            break;
          }
        default:
-         gcc_unreachable ();
+         rust_unreachable ();
        }
     }
 
@@ -913,7 +913,7 @@ ASTLoweringBase::lower_literal (const AST::Literal &literal)
       type = HIR::Literal::LitType::BOOL;
       break;
     case AST::Literal::LitType::ERROR:
-      gcc_unreachable ();
+      rust_unreachable ();
       break;
     }
 
index ad907a823594ec6008a9de74f1216b122bf88371..80790f53693b9185d0300ce07e5fdac0f533982e 100644 (file)
@@ -461,7 +461,7 @@ ASTLoweringExpr::visit (AST::CompoundAssignmentExpr &expr)
       op = ArithmeticOrLogicalOperator::RIGHT_SHIFT;
       break;
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 
   HIR::Expr *asignee_expr
index 63ea66333f9f818e029e9e10534fa208cc5a90be..37f0015764166c76f4f2ad269307e1f95ad4e542 100644 (file)
@@ -76,7 +76,7 @@ ASTLoweringPattern::visit (AST::TupleStructPattern &pattern)
     {
       case AST::TupleStructItems::RANGE: {
        // TODO
-       gcc_unreachable ();
+       rust_unreachable ();
       }
       break;
 
@@ -123,7 +123,7 @@ ASTLoweringPattern::visit (AST::StructPattern &pattern)
        {
          case AST::StructPatternField::ItemType::TUPLE_PAT: {
            // TODO
-           gcc_unreachable ();
+           rust_unreachable ();
          }
          break;
 
index e35e4f4d31fe6a4fd632b290c54ee5737792d007..768817b8fc392358c0f507655b121b735837ff0c 100644 (file)
@@ -218,7 +218,7 @@ ASTLoweringType::visit (AST::BareFunctionType &fntype)
          kind = HIR::MaybeNamedParam::ParamKind::WILDCARD;
          break;
        default:
-         gcc_unreachable ();
+         rust_unreachable ();
        }
 
       HIR::Type *param_type
index b885141a6b951fcc6b5d726bbf81d3d81dec6bdd..eecad30076b75af48c4e6bb13fb548d176868645 100644 (file)
@@ -184,7 +184,7 @@ Dump::visit (ArithmeticOrLogicalExpr &aole)
       operator_str = ">>";
       break;
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
       break;
     }
 
index a84a741c68283e88a45d5ff4cc474d44a129b7fa..b5e88d41f4e1b9d98415ee89929f1893feb520d6 100644 (file)
@@ -66,7 +66,7 @@ get_string_in_delims (std::string str_input, AST::DelimType delim_type)
     default:
       return "ERROR-MARK-STRING (delims)";
     }
-  gcc_unreachable ();
+  rust_unreachable ();
 }
 
 std::string
@@ -128,7 +128,7 @@ Visibility::as_string () const
       return std::string ("pub(in ") + path.get_mappings ().as_string ()
             + std::string (")");
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
@@ -518,7 +518,7 @@ UseTreeGlob::as_string () const
       // some kind of error
       return "ERROR-PATH";
     }
-  gcc_unreachable ();
+  rust_unreachable ();
 }
 
 std::string
@@ -1342,7 +1342,7 @@ CompoundAssignmentExpr::as_string () const
       operator_str = ">>";
       break;
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
       break;
     }
 
@@ -1617,7 +1617,7 @@ ArithmeticOrLogicalExpr::as_string () const
       operator_str = ">>";
       break;
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
       break;
     }
 
index 1e4a362231b4c649f133356c4086aa8977a1d7f4..ee91d027977fe6ee1980dfda87df2a675875518a 100644 (file)
@@ -1822,7 +1822,7 @@ Lexer::parse_byte_string (Location loc)
     }
   else
     {
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 
   str.shrink_to_fit ();
@@ -2052,7 +2052,7 @@ Lexer::parse_string (Location loc)
     }
   else
     {
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 
   str.shrink_to_fit ();
index 1dacd167d9857c25b5bd6d020b910c10da47a39b..8807017bdbf3f898588d9b4c6c5f9f8819dde654 100644 (file)
@@ -35,7 +35,7 @@ get_token_description (TokenId id)
 #undef RS_TOKEN_KEYWORD
 #undef RS_TOKEN
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
@@ -54,7 +54,7 @@ token_id_to_str (TokenId id)
 #undef RS_TOKEN_KEYWORD
 #undef RS_TOKEN
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
@@ -85,13 +85,13 @@ token_id_keyword_string (TokenId id)
       static const std::string str (str_ptr);                                  \
       return str;                                                              \
     }                                                                          \
-    gcc_unreachable ();
+    rust_unreachable ();
 #define RS_TOKEN(a, b)
       RS_TOKEN_LIST
 #undef RS_TOKEN_KEYWORD
 #undef RS_TOKEN
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
index c6a1d3047241af197a31c9068d5c56b241c79b94..6dfc2b034fb1853e7ed8bd82cbfc75ae5e3d6833 100644 (file)
@@ -713,7 +713,7 @@ Parser<ManagedTokenSource>::parse_simple_path_segment ()
       // test prevent error
       return AST::SimplePathSegment::create_error ();
     }
-  gcc_unreachable ();
+  rust_unreachable ();
   /*rust_error_at(
     t->get_locus(), "invalid token '%s' in simple path segment",
     t->get_token_description());*/
@@ -765,7 +765,7 @@ Parser<ManagedTokenSource>::parse_path_ident_segment ()
       // test prevent error
       return AST::PathIdentSegment::create_error ();
     }
-  gcc_unreachable ();
+  rust_unreachable ();
   // not necessarily an error
 }
 
@@ -876,7 +876,7 @@ Parser<ManagedTokenSource>::parse_attr_input ()
       skip_after_end_attribute ();
       return nullptr;
     }
-  gcc_unreachable ();
+  rust_unreachable ();
   // TODO: find out how to stop gcc error on "no return value"
 }
 
@@ -5534,7 +5534,7 @@ Parser<ManagedTokenSource>::parse_inherent_impl_item ()
          lexer.skip_token (1); // TODO: is this right thing to do?
          return nullptr;
        }
-      gcc_unreachable ();
+      rust_unreachable ();
     default:
       add_error (Error (t->get_locus (),
                        "unrecognised token %qs for item in inherent impl",
@@ -5718,7 +5718,7 @@ Parser<ManagedTokenSource>::parse_trait_impl_item ()
          lexer.skip_token (1); // TODO: is this right thing to do?
          return nullptr;
        }
-      gcc_unreachable ();
+      rust_unreachable ();
     default:
       break;
     }
@@ -6703,7 +6703,7 @@ Parser<ManagedTokenSource>::parse_type_path_segment ()
        new AST::TypePathSegment (std::move (ident_segment),
                                  has_separating_scope_resolution, locus));
     }
-  gcc_unreachable ();
+  rust_unreachable ();
 }
 
 // Parses a function call representation inside a type path.
@@ -9846,7 +9846,7 @@ Parser<ManagedTokenSource>::parse_reference_type ()
        new AST::ReferenceType (false, parse_reference_type_inner (locus),
                                locus));
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
@@ -12337,7 +12337,7 @@ Parser<ManagedTokenSource>::null_denotation_path (
       return std::unique_ptr<AST::PathInExpression> (
        new AST::PathInExpression (std::move (path)));
     }
-  gcc_unreachable ();
+  rust_unreachable ();
 }
 
 // Handling of expresions that do not start with a path for `null_denotation`.
@@ -12969,7 +12969,7 @@ get_lbp_for_arithmetic_or_logical_expr (
       return LBP_R_SHIFT;
     default:
       // WTF? should not happen, this is an error
-      gcc_unreachable ();
+      rust_unreachable ();
 
       return LBP_PLUS;
     }
@@ -13241,7 +13241,7 @@ get_lbp_for_comparison_expr (AST::ComparisonExpr::ExprType expr_type)
       return LBP_SMALLER_EQUAL;
     default:
       // WTF? should not happen, this is an error
-      gcc_unreachable ();
+      rust_unreachable ();
 
       return LBP_EQUAL;
     }
@@ -13512,7 +13512,7 @@ get_lbp_for_compound_assignment_expr (
       return LBP_R_SHIFT;
     default:
       // WTF? should not happen, this is an error
-      gcc_unreachable ();
+      rust_unreachable ();
 
       return LBP_PLUS;
     }
index 1b565bc8f456a5563bdad170f3f266472295dcee..6d67e78169f9e4d6e47496e028c32c45afe1f2a3 100644 (file)
@@ -278,7 +278,7 @@ peculiar_fragment_match_compatible (const AST::MacroMatchFragment &last_match,
            delim_id = LEFT_CURLY;
            break;
          default:
-           gcc_unreachable ();
+           rust_unreachable ();
            break;
          }
        if (contains (allowed_toks, delim_id))
index 918e0c67773383340e62bd0ef3b54821a1790992..ddbc544ce070c45303570042e03a2f6a574104ba 100644 (file)
@@ -231,7 +231,7 @@ ResolvePath::resolve_path (AST::PathInExpression *expr)
        }
       else
        {
-         gcc_unreachable ();
+         rust_unreachable ();
        }
     }
   return resolved_node_id;
@@ -407,7 +407,7 @@ ResolvePath::resolve_path (AST::SimplePath *expr)
        }
       else
        {
-         gcc_unreachable ();
+         rust_unreachable ();
        }
     }
   return resolved_node_id;
index 00d6cc71a7762eea5a1991332ff396c7a65cbf65..03f86f6a712351b0fa4436c3a5c7e5f1797cecc6 100644 (file)
@@ -96,7 +96,7 @@ PatternDeclaration::visit (AST::TupleStructPattern &pattern)
     {
       case AST::TupleStructItems::RANGE: {
        // TODO
-       gcc_unreachable ();
+       rust_unreachable ();
       }
       break;
 
@@ -125,7 +125,7 @@ PatternDeclaration::visit (AST::StructPattern &pattern)
        {
          case AST::StructPatternField::ItemType::TUPLE_PAT: {
            // TODO
-           gcc_unreachable ();
+           rust_unreachable ();
          }
          break;
 
index 2dacaee7abb137078b06803f128aaba687a59b2c..50681186556fd8199495dc3cd3210a01993e50d5 100644 (file)
@@ -264,7 +264,7 @@ ResolveRelativeTypePath::go (AST::TypePath &path, NodeId &resolved_node_id)
        }
       else
        {
-         gcc_unreachable ();
+         rust_unreachable ();
        }
     }
 
@@ -396,7 +396,7 @@ ResolveTypeToCanonicalPath::visit (AST::TypePath &path)
                    // constant or an ambiguous const generic?
                    // TODO: At that point, will all generics have been
                    // disambiguated? Can we thus canonical resolve types and
-                   // const and `gcc_unreachable` on ambiguous types?
+                   // const and `rust_unreachable` on ambiguous types?
                    // This is probably fine as we just want to canonicalize
                    // types, right?
                    if (generic.get_kind () == AST::GenericArg::Kind::Type)
@@ -500,7 +500,7 @@ void
 ResolveTypeToCanonicalPath::visit (AST::TraitObjectType &)
 {
   // FIXME is this actually allowed? dyn A+B
-  gcc_unreachable ();
+  rust_unreachable ();
 }
 
 ResolveTypeToCanonicalPath::ResolveTypeToCanonicalPath ()
@@ -556,7 +556,7 @@ ResolveGenericArgs::resolve_disambiguated_generic (AST::GenericArg &arg)
       ResolveType::go (arg.get_type ().get ());
       break;
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 void
index 608c770c22356492ab5c5030253dd53a7fc55890..1f5c9497d21f76fbad33577fa8004f98f9997691 100644 (file)
@@ -1229,7 +1229,7 @@ operator_to_tree_code (NegationOperator op)
     case NegationOperator::NOT:
       return TRUTH_NOT_EXPR;
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
@@ -1266,7 +1266,7 @@ operator_to_tree_code (ArithmeticOrLogicalOperator op, bool floating_point)
     case ArithmeticOrLogicalOperator::RIGHT_SHIFT:
       return RSHIFT_EXPR;
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
@@ -1288,7 +1288,7 @@ operator_to_tree_code (ComparisonOperator op)
     case ComparisonOperator::LESS_OR_EQUAL:
       return LE_EXPR;
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
@@ -1302,7 +1302,7 @@ operator_to_tree_code (LazyBooleanOperator op)
     case LazyBooleanOperator::LOGICAL_AND:
       return TRUTH_ANDIF_EXPR;
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
@@ -1430,7 +1430,7 @@ fetch_overflow_builtins (ArithmeticOrLogicalOperator op)
       builtin_ctx.lookup_simple_builtin ("mul_overflow", &builtin);
       break;
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
       break;
     };
 
@@ -2191,10 +2191,10 @@ Gcc_backend::non_zero_size_type (tree type)
       }
 
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 
-  gcc_unreachable ();
+  rust_unreachable ();
 }
 
 // Convert EXPR_TREE to TYPE_TREE.  Sometimes the same unnamed Rust type
@@ -2227,7 +2227,7 @@ Gcc_backend::convert_tree (tree type_tree, tree expr_tree, Location location)
                              expr_tree);
     }
 
-  gcc_unreachable ();
+  rust_unreachable ();
 }
 
 // Make a global variable.
index 631ecedb335c4b5b6b4da34d42c29ed2090b1e49..a6bee9ca835aa5b1378e5d536b4a16f273bc988d 100644 (file)
@@ -247,7 +247,7 @@ grs_langhook_type_for_mode (machine_mode mode, int unsignedp)
       return (unsignedp ? int_n_trees[i].unsigned_type
                        : int_n_trees[i].signed_type);
 
-  /* gcc_unreachable */
+  /* rust_unreachable */
   return NULL;
 }
 
@@ -264,7 +264,7 @@ static bool
 grs_langhook_global_bindings_p (void)
 {
   // return current_function_decl == NULL_TREE;
-  // gcc_unreachable();
+  // rust_unreachable();
   // return true;
   return false;
 }
@@ -278,7 +278,7 @@ grs_langhook_global_bindings_p (void)
 static tree
 grs_langhook_pushdecl (tree decl ATTRIBUTE_UNUSED)
 {
-  gcc_unreachable ();
+  rust_unreachable ();
   return NULL;
 }
 
@@ -288,7 +288,7 @@ grs_langhook_pushdecl (tree decl ATTRIBUTE_UNUSED)
 static tree
 grs_langhook_getdecls (void)
 {
-  // gcc_unreachable();
+  // rust_unreachable();
   return NULL;
 }
 
@@ -377,7 +377,7 @@ convert (tree type, tree expr)
       break;
     }
 
-  gcc_unreachable ();
+  rust_unreachable ();
 }
 
 /* FIXME: This is a hack to preserve trees that we create from the
index f42747b11990ce6a030f5c6f33c83604d4cae235..80dc01a843be1eea60f64472989aeb6fdd7e6a07 100644 (file)
@@ -74,8 +74,12 @@ constexpr static const char *file_separator = "/";
 // When using gcc, rust_assert is just gcc_assert.
 #define rust_assert(EXPR) gcc_assert (EXPR)
 
-// When using gcc, rust_unreachable is just gcc_unreachable.
-#define rust_unreachable() gcc_unreachable ()
+/**
+ * rust_unreachable is just a fancy abort which causes an internal compiler
+ * error. This macro is not equivalent to `__builtin_unreachable` and does not
+ * indicate optimizations for the compiler
+ */
+#define rust_unreachable() (fancy_abort (__FILE__, __LINE__, __FUNCTION__))
 
 extern void
 rust_preserve_from_gc (tree t);
index bdb1abc92d2fc9e6bd031f20b5e8cc53fefc7800..f9c759b6f3cdaf772c5063427c0c3a873f711e7d 100644 (file)
@@ -83,7 +83,7 @@ public:
       case AdjustmentType::UNSIZE:
        return "UNSIZE";
       }
-    gcc_unreachable ();
+    rust_unreachable ();
     return "";
   }
 
index 496f8109fdd7db60b3051d7ee23f2789748dc8cd..2885d35823753e5d45bd0e97088fa1da2d03f746 100644 (file)
@@ -339,7 +339,7 @@ PathProbeType::process_associated_trait_for_candidates (
 
     case TraitItemReference::TraitItemType::ERROR:
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
       break;
     }
 
@@ -389,7 +389,7 @@ PathProbeType::process_predicate_for_candidates (
 
     case TraitItemReference::TraitItemType::ERROR:
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
       break;
     }
 
index 6a33ec33ce6e1cddec21436003c7d9093d52ab5e..32a9f9189966904733bad0c0d99dbd0ad79c3bc4 100644 (file)
@@ -94,7 +94,7 @@ TraitItemReference::get_tyty () const
       return get_error ();
     }
 
-  gcc_unreachable ();
+  rust_unreachable ();
   return get_error ();
 }
 
index 6ef64e618a47aa9a4738d138d04c8a6e285d2562..622a8bb89a31ae7952a1a66ad8c9b8d8a7ff3104 100644 (file)
@@ -274,7 +274,7 @@ TypeCheckBase::resolve_literal (const Analysis::NodeMapping &expr_mappings,
       break;
 
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
       break;
     }
 
index e27bac1295841c1a9a77c91e75a0aefeaccff66a..863d998e869de1e75d68a2a9e0b726cdc2ef06af 100644 (file)
@@ -2046,7 +2046,7 @@ TypeCheckExpr::validate_arithmetic_type (
                     == TyTy::InferType::INTEGRAL));
     }
 
-  gcc_unreachable ();
+  rust_unreachable ();
   return false;
 }
 
index 5f931d8d517f951a1ea5b69958b630b684307bef..724eee8d9b55720688434bf3db8bf79eb641751f 100644 (file)
@@ -81,11 +81,17 @@ public:
   void visit (HIR::AsyncBlockExpr &) override {}
 
   // don't need to implement these see rust-hir-type-check-struct-field.h
-  void visit (HIR::StructExprFieldIdentifier &) override { gcc_unreachable (); }
-  void visit (HIR::StructExprFieldIndexValue &) override { gcc_unreachable (); }
+  void visit (HIR::StructExprFieldIdentifier &) override
+  {
+    rust_unreachable ();
+  }
+  void visit (HIR::StructExprFieldIndexValue &) override
+  {
+    rust_unreachable ();
+  }
   void visit (HIR::StructExprFieldIdentifierValue &) override
   {
-    gcc_unreachable ();
+    rust_unreachable ();
   }
 
 protected:
index 0c850e1cafefe0cb6978b6d5a8a59756cdbb369d..b8a73a731119f158f3b7abb5f4d709acd2b63ba2 100644 (file)
@@ -259,7 +259,7 @@ TypeCheckImplItem::visit (HIR::Function &function)
              break;
 
            default:
-             gcc_unreachable ();
+             rust_unreachable ();
              return;
            }
        }
index d9cdd338e196b3b814460e21df32e1046a539800..9c478766afe5f1453264884d7f63c4f1a94f8b09 100644 (file)
@@ -101,7 +101,7 @@ TypeCheckPattern::visit (HIR::TupleStructPattern &pattern)
     {
       case HIR::TupleStructItems::RANGE: {
        // TODO
-       gcc_unreachable ();
+       rust_unreachable ();
       }
       break;
 
@@ -201,7 +201,7 @@ TypeCheckPattern::visit (HIR::StructPattern &pattern)
        {
          case HIR::StructPatternField::ItemType::TUPLE_PAT: {
            // TODO
-           gcc_unreachable ();
+           rust_unreachable ();
          }
          break;
 
@@ -334,7 +334,7 @@ TypeCheckPattern::visit (HIR::TuplePattern &pattern)
        //   = *static_cast<HIR::TuplePatternItemsRanged *> (
        //     pattern.get_items ().get ());
        // TODO
-       gcc_unreachable ();
+       rust_unreachable ();
       }
       break;
     }
index 947d5ab49721baa05e32bc88be73b8bedad2b101..138780f9035e74d21609b4e6620b09beeeb74dd0 100644 (file)
@@ -52,7 +52,7 @@ public:
   // this seems like it should not be part of this visitor
   void visit (HIR::TypePathSegmentFunction &segment) override
   {
-    gcc_unreachable ();
+    rust_unreachable ();
   }
 
   // nothing to do for these
index 60231dc13641727138c2fb1c8156dd44ac584123..8f9286f1ef4f68a8f2eb6c7b85c9171d256f3cac 100644 (file)
@@ -246,7 +246,7 @@ TraitItemReference::get_type_from_fn (/*const*/ HIR::TraitItemFunc &fn) const
              break;
 
            default:
-             gcc_unreachable ();
+             rust_unreachable ();
              return nullptr;
            }
        }
index 533d61071b1c5a6f8341ba503f6504e80d8be69d..63cc6bcf2764ba02c699a48cb23ffc5733aa1580 100644 (file)
@@ -41,26 +41,26 @@ public:
   void visit (TyTy::ProjectionType &type) override;
 
   // nothing to do for these
-  void visit (TyTy::InferType &) override { gcc_unreachable (); }
-  void visit (TyTy::TupleType &) override { gcc_unreachable (); }
-  void visit (TyTy::FnPtr &) override { gcc_unreachable (); }
-  void visit (TyTy::ArrayType &) override { gcc_unreachable (); }
-  void visit (TyTy::SliceType &) override { gcc_unreachable (); }
-  void visit (TyTy::BoolType &) override { gcc_unreachable (); }
-  void visit (TyTy::IntType &) override { gcc_unreachable (); }
-  void visit (TyTy::UintType &) override { gcc_unreachable (); }
-  void visit (TyTy::FloatType &) override { gcc_unreachable (); }
-  void visit (TyTy::USizeType &) override { gcc_unreachable (); }
-  void visit (TyTy::ISizeType &) override { gcc_unreachable (); }
-  void visit (TyTy::ErrorType &) override { gcc_unreachable (); }
-  void visit (TyTy::CharType &) override { gcc_unreachable (); }
-  void visit (TyTy::ReferenceType &) override { gcc_unreachable (); }
-  void visit (TyTy::PointerType &) override { gcc_unreachable (); }
-  void visit (TyTy::ParamType &) override { gcc_unreachable (); }
-  void visit (TyTy::StrType &) override { gcc_unreachable (); }
-  void visit (TyTy::NeverType &) override { gcc_unreachable (); }
-  void visit (TyTy::DynamicObjectType &) override { gcc_unreachable (); }
-  void visit (TyTy::ClosureType &) override { gcc_unreachable (); }
+  void visit (TyTy::InferType &) override { rust_unreachable (); }
+  void visit (TyTy::TupleType &) override { rust_unreachable (); }
+  void visit (TyTy::FnPtr &) override { rust_unreachable (); }
+  void visit (TyTy::ArrayType &) override { rust_unreachable (); }
+  void visit (TyTy::SliceType &) override { rust_unreachable (); }
+  void visit (TyTy::BoolType &) override { rust_unreachable (); }
+  void visit (TyTy::IntType &) override { rust_unreachable (); }
+  void visit (TyTy::UintType &) override { rust_unreachable (); }
+  void visit (TyTy::FloatType &) override { rust_unreachable (); }
+  void visit (TyTy::USizeType &) override { rust_unreachable (); }
+  void visit (TyTy::ISizeType &) override { rust_unreachable (); }
+  void visit (TyTy::ErrorType &) override { rust_unreachable (); }
+  void visit (TyTy::CharType &) override { rust_unreachable (); }
+  void visit (TyTy::ReferenceType &) override { rust_unreachable (); }
+  void visit (TyTy::PointerType &) override { rust_unreachable (); }
+  void visit (TyTy::ParamType &) override { rust_unreachable (); }
+  void visit (TyTy::StrType &) override { rust_unreachable (); }
+  void visit (TyTy::NeverType &) override { rust_unreachable (); }
+  void visit (TyTy::DynamicObjectType &) override { rust_unreachable (); }
+  void visit (TyTy::ClosureType &) override { rust_unreachable (); }
 
 private:
   SubstMapper (HirId ref, HIR::GenericArgs *generics, Location locus);
@@ -121,27 +121,27 @@ public:
   void visit (TyTy::ADTType &type) override;
   void visit (TyTy::ClosureType &type) override;
 
-  void visit (TyTy::InferType &) override { gcc_unreachable (); }
-  void visit (TyTy::TupleType &) override { gcc_unreachable (); }
-  void visit (TyTy::FnPtr &) override { gcc_unreachable (); }
-  void visit (TyTy::ArrayType &) override { gcc_unreachable (); }
-  void visit (TyTy::SliceType &) override { gcc_unreachable (); }
-  void visit (TyTy::BoolType &) override { gcc_unreachable (); }
-  void visit (TyTy::IntType &) override { gcc_unreachable (); }
-  void visit (TyTy::UintType &) override { gcc_unreachable (); }
-  void visit (TyTy::FloatType &) override { gcc_unreachable (); }
-  void visit (TyTy::USizeType &) override { gcc_unreachable (); }
-  void visit (TyTy::ISizeType &) override { gcc_unreachable (); }
-  void visit (TyTy::ErrorType &) override { gcc_unreachable (); }
-  void visit (TyTy::CharType &) override { gcc_unreachable (); }
-  void visit (TyTy::ReferenceType &) override { gcc_unreachable (); }
-  void visit (TyTy::PointerType &) override { gcc_unreachable (); }
-  void visit (TyTy::ParamType &) override { gcc_unreachable (); }
-  void visit (TyTy::StrType &) override { gcc_unreachable (); }
-  void visit (TyTy::NeverType &) override { gcc_unreachable (); }
-  void visit (TyTy::PlaceholderType &) override { gcc_unreachable (); }
-  void visit (TyTy::ProjectionType &) override { gcc_unreachable (); }
-  void visit (TyTy::DynamicObjectType &) override { gcc_unreachable (); }
+  void visit (TyTy::InferType &) override { rust_unreachable (); }
+  void visit (TyTy::TupleType &) override { rust_unreachable (); }
+  void visit (TyTy::FnPtr &) override { rust_unreachable (); }
+  void visit (TyTy::ArrayType &) override { rust_unreachable (); }
+  void visit (TyTy::SliceType &) override { rust_unreachable (); }
+  void visit (TyTy::BoolType &) override { rust_unreachable (); }
+  void visit (TyTy::IntType &) override { rust_unreachable (); }
+  void visit (TyTy::UintType &) override { rust_unreachable (); }
+  void visit (TyTy::FloatType &) override { rust_unreachable (); }
+  void visit (TyTy::USizeType &) override { rust_unreachable (); }
+  void visit (TyTy::ISizeType &) override { rust_unreachable (); }
+  void visit (TyTy::ErrorType &) override { rust_unreachable (); }
+  void visit (TyTy::CharType &) override { rust_unreachable (); }
+  void visit (TyTy::ReferenceType &) override { rust_unreachable (); }
+  void visit (TyTy::PointerType &) override { rust_unreachable (); }
+  void visit (TyTy::ParamType &) override { rust_unreachable (); }
+  void visit (TyTy::StrType &) override { rust_unreachable (); }
+  void visit (TyTy::NeverType &) override { rust_unreachable (); }
+  void visit (TyTy::PlaceholderType &) override { rust_unreachable (); }
+  void visit (TyTy::ProjectionType &) override { rust_unreachable (); }
+  void visit (TyTy::DynamicObjectType &) override { rust_unreachable (); }
 
 private:
   SubstMapperFromExisting (TyTy::BaseType *concrete, TyTy::BaseType *receiver);
index 51ea87c99faf5f33d78d68bc8e174ae8c6abb2cb..bbd83a94a7f712ce1e722470ee556b757769d193 100644 (file)
@@ -638,7 +638,7 @@ TypeCheckContextItem::get_context_type ()
       break;
 
     case ERROR:
-      gcc_unreachable ();
+      rust_unreachable ();
       return nullptr;
     }
 
index 39e10fd3844702dc6d57120a5de5d789a7d544b1..e9764a1fbca125375f5ad6f5e7ed1c4de19cabea 100644 (file)
@@ -40,27 +40,27 @@ public:
     return checker.resolved;
   }
 
-  void visit (InferType &) override { gcc_unreachable (); }
-  void visit (TupleType &) override { gcc_unreachable (); }
-  void visit (ArrayType &) override { gcc_unreachable (); }
-  void visit (SliceType &) override { gcc_unreachable (); }
-  void visit (BoolType &) override { gcc_unreachable (); }
-  void visit (IntType &) override { gcc_unreachable (); }
-  void visit (UintType &) override { gcc_unreachable (); }
-  void visit (FloatType &) override { gcc_unreachable (); }
-  void visit (USizeType &) override { gcc_unreachable (); }
-  void visit (ISizeType &) override { gcc_unreachable (); }
-  void visit (ErrorType &) override { gcc_unreachable (); }
-  void visit (CharType &) override { gcc_unreachable (); }
-  void visit (ReferenceType &) override { gcc_unreachable (); }
-  void visit (PointerType &) override { gcc_unreachable (); }
-  void visit (ParamType &) override { gcc_unreachable (); }
-  void visit (StrType &) override { gcc_unreachable (); }
-  void visit (NeverType &) override { gcc_unreachable (); }
-  void visit (PlaceholderType &) override { gcc_unreachable (); }
-  void visit (ProjectionType &) override { gcc_unreachable (); }
-  void visit (DynamicObjectType &) override { gcc_unreachable (); }
-  void visit (ClosureType &type) override { gcc_unreachable (); }
+  void visit (InferType &) override { rust_unreachable (); }
+  void visit (TupleType &) override { rust_unreachable (); }
+  void visit (ArrayType &) override { rust_unreachable (); }
+  void visit (SliceType &) override { rust_unreachable (); }
+  void visit (BoolType &) override { rust_unreachable (); }
+  void visit (IntType &) override { rust_unreachable (); }
+  void visit (UintType &) override { rust_unreachable (); }
+  void visit (FloatType &) override { rust_unreachable (); }
+  void visit (USizeType &) override { rust_unreachable (); }
+  void visit (ISizeType &) override { rust_unreachable (); }
+  void visit (ErrorType &) override { rust_unreachable (); }
+  void visit (CharType &) override { rust_unreachable (); }
+  void visit (ReferenceType &) override { rust_unreachable (); }
+  void visit (PointerType &) override { rust_unreachable (); }
+  void visit (ParamType &) override { rust_unreachable (); }
+  void visit (StrType &) override { rust_unreachable (); }
+  void visit (NeverType &) override { rust_unreachable (); }
+  void visit (PlaceholderType &) override { rust_unreachable (); }
+  void visit (ProjectionType &) override { rust_unreachable (); }
+  void visit (DynamicObjectType &) override { rust_unreachable (); }
+  void visit (ClosureType &type) override { rust_unreachable (); }
 
   // tuple-structs
   void visit (ADTType &type) override;
index 14786cfd612a4656be83a8818db9a461b7da56eb..b64d0cccac80a6ee38a3dd325a114eef0e8f3fb9 100644 (file)
@@ -112,7 +112,7 @@ TypeKindFormat::to_string (TypeKind kind)
     case TypeKind::ERROR:
       return "ERROR";
     }
-  gcc_unreachable ();
+  rust_unreachable ();
 }
 
 bool
@@ -672,7 +672,7 @@ BaseType::monomorphized_clone () const
       break;
     }
 
-  gcc_unreachable ();
+  rust_unreachable ();
   return nullptr;
 }
 
@@ -1406,7 +1406,7 @@ VariantDef::variant_type_string (VariantType type)
     case STRUCT:
       return "struct";
     }
-  gcc_unreachable ();
+  rust_unreachable ();
   return "";
 }
 
@@ -2279,7 +2279,7 @@ ClosureType::clone () const
 ClosureType *
 ClosureType::handle_substitions (SubstitutionArgumentMappings &mappings)
 {
-  gcc_unreachable ();
+  rust_unreachable ();
   return nullptr;
 }
 
@@ -2588,7 +2588,7 @@ IntType::as_string () const
     case I128:
       return "i128";
     }
-  gcc_unreachable ();
+  rust_unreachable ();
   return "__unknown_int_type";
 }
 
@@ -2675,7 +2675,7 @@ UintType::as_string () const
     case U128:
       return "u128";
     }
-  gcc_unreachable ();
+  rust_unreachable ();
   return "__unknown_uint_type";
 }
 
@@ -2756,7 +2756,7 @@ FloatType::as_string () const
     case F64:
       return "f64";
     }
-  gcc_unreachable ();
+  rust_unreachable ();
   return "__unknown_float_type";
 }
 
index 2b47cafb037f9f2285247d48ce28fcf2a3f0fe0a..6a526e2e9bf762ae0af36abfc47aebb24106377c 100644 (file)
@@ -1631,7 +1631,7 @@ UnifyRules::expect_projection (TyTy::ProjectionType *ltype,
 
       // FIXME
     case TyTy::PROJECTION:
-      gcc_unreachable ();
+      rust_unreachable ();
       break;
 
     case TyTy::DYNAMIC:
index adc4626f6a0d0dc577bc0f4b08c7e0af75f24f87..3206cedda101b5639995c189f7a819ec711f9153 100644 (file)
@@ -250,7 +250,7 @@ convert (const std::vector<const_TokenPtr> &tokens)
          trees.push_back (ProcMacro::TokenStream::make_tokenstream ());
          break;
        default:
-         gcc_unreachable ();
+         rust_unreachable ();
        }
     }
   return trees.back ();
@@ -322,7 +322,7 @@ from_literal (const ProcMacro::Literal &literal,
     case ProcMacro::STR_RAW:
     case ProcMacro::BYTE_STR_RAW:
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
@@ -383,7 +383,7 @@ from_group (const ProcMacro::Group &g, std::vector<const_TokenPtr> &result)
       from_tokenstream (g.stream, result);
       break;
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }
 
@@ -414,7 +414,7 @@ from_tokentree (const ProcMacro::TokenTree &tt,
       from_literal (tt.payload.literal, result);
       break;
     default:
-      gcc_unreachable ();
+      rust_unreachable ();
     }
 }