]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/rust/checks/errors/rust-feature.cc
Update copyright years.
[thirdparty/gcc.git] / gcc / rust / checks / errors / rust-feature.cc
1 // Copyright (C) 2020-2024 Free Software Foundation, Inc.
2
3 // This file is part of GCC.
4
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.
9
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.
14
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/>.
18
19 #include "rust-feature.h"
20 #include "rust-session-manager.h"
21
22 namespace Rust {
23
24 Feature
25 Feature::create (Feature::Name name)
26 {
27 switch (name)
28 {
29 case Feature::Name::ASSOCIATED_TYPE_BOUNDS:
30 return Feature (Feature::Name::ASSOCIATED_TYPE_BOUNDS,
31 Feature::State::ACCEPTED, "associated_type_bounds",
32 "1.34.0", 52662,
33 Optional<CompileOptions::Edition>::none (), "");
34 case Feature::Name::INTRINSICS:
35 return Feature (Feature::Name::INTRINSICS, Feature::State::ACCEPTED,
36 "intrinsics", "1.0.0", 0,
37 Optional<CompileOptions::Edition>::none (), "");
38 case Feature::Name::RUSTC_ATTRS:
39 return Feature (Feature::Name::RUSTC_ATTRS, Feature::State::ACCEPTED,
40 "rustc_attrs", "1.0.0", 0,
41 Optional<CompileOptions::Edition>::none (), "");
42 case Feature::Name::DECL_MACRO:
43 return Feature (Feature::Name::DECL_MACRO, Feature::State::ACCEPTED,
44 "decl_macro", "1.0.0", 0,
45 Optional<CompileOptions::Edition>::none (), "");
46 default:
47 gcc_unreachable ();
48 }
49 }
50
51 const std::map<std::string, Feature::Name> Feature::name_hash_map = {
52 {"associated_type_bounds", Feature::Name::ASSOCIATED_TYPE_BOUNDS},
53 {"intrinsics", Feature::Name::INTRINSICS},
54 {"rustc_attrs", Feature::Name::RUSTC_ATTRS},
55 {"decl_macro", Feature::Name::DECL_MACRO},
56 };
57
58 Optional<Feature::Name>
59 Feature::as_name (const std::string &name)
60 {
61 if (Feature::name_hash_map.count (name))
62 return Optional<Feature::Name>::some (Feature::name_hash_map.at (name));
63 return Optional<Feature::Name>::none ();
64 }
65
66 } // namespace Rust