]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/rust/checks/errors/rust-feature.cc
1 // Copyright (C) 2020-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
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
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 #include "rust-feature.h"
20 #include "rust-session-manager.h"
25 Feature::create (Feature::Name name
)
29 case Feature::Name::ASSOCIATED_TYPE_BOUNDS
:
30 return Feature (Feature::Name::ASSOCIATED_TYPE_BOUNDS
,
31 Feature::State::ACCEPTED
, "associated_type_bounds",
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 (), "");
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
},
58 Optional
<Feature::Name
>
59 Feature::as_name (const std::string
&name
)
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 ();