gccrs: Remove obsolete classes and functions.
[official-gcc.git] / gcc / rust / util / rust-common.h
blob299ae71e9092f3e171a98fd8f4f88d47ee93bf53
1 // Copyright (C) 2021-2024 Free Software Foundation, Inc.
3 // This file is part of GCC.
5 // GCC is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU General Public License as published by the Free
7 // Software Foundation; either version 3, or (at your option) any later
8 // version.
10 // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 // for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with GCC; see the file COPYING3. If not see
17 // <http://www.gnu.org/licenses/>.
19 // Common definitions useful throughout the Rust frontend.
21 #ifndef RUST_COMMON
22 #define RUST_COMMON
23 #include "rust-system.h"
24 #include <string>
26 namespace Rust {
28 enum class Mutability
30 Imm,
31 Mut
34 enum class Unsafety
36 Unsafe,
37 Normal
40 enum class Const
42 Yes,
43 No,
46 enum class Async
48 Yes,
52 enum BoundPolarity
54 RegularBound,
55 NegativeBound,
56 AntiBound,
59 enum AsyncConstStatus
61 NONE,
62 CONST_FN,
63 ASYNC_FN
66 inline std::string
67 enum_to_str (Mutability mut)
69 std::string str;
70 switch (mut)
72 case Mutability::Imm:
73 return "Imm";
74 case Mutability::Mut:
75 return "Mut";
77 gcc_unreachable ();
80 } // namespace Rust
82 #endif // RUST_COMMON