From 94f77b9f88396c51efaf6991ed253e2a80a9394b Mon Sep 17 00:00:00 2001 From: Owen Avery Date: Wed, 27 Aug 2025 18:21:08 -0400 Subject: [PATCH 1/2] Create subdirectory checks/errors/feature gcc/rust/ChangeLog: * Make-lang.in: Handle source files in checks/errors/feature. * checks/errors/rust-feature-gate.cc: Move to... * checks/errors/feature/rust-feature-gate.cc: ...here. * checks/errors/rust-feature-gate.h: Move to... * checks/errors/feature/rust-feature-gate.h: ...here. * checks/errors/rust-feature.cc: Move to... * checks/errors/feature/rust-feature.cc: ...here. * checks/errors/rust-feature.h: Move to... * checks/errors/feature/rust-feature.h: ...here. Signed-off-by: Owen Avery --- gcc/rust/Make-lang.in | 6 ++++++ gcc/rust/checks/errors/{ => feature}/rust-feature-gate.cc | 0 gcc/rust/checks/errors/{ => feature}/rust-feature-gate.h | 0 gcc/rust/checks/errors/{ => feature}/rust-feature.cc | 0 gcc/rust/checks/errors/{ => feature}/rust-feature.h | 0 5 files changed, 6 insertions(+) rename gcc/rust/checks/errors/{ => feature}/rust-feature-gate.cc (100%) rename gcc/rust/checks/errors/{ => feature}/rust-feature-gate.h (100%) rename gcc/rust/checks/errors/{ => feature}/rust-feature.cc (100%) rename gcc/rust/checks/errors/{ => feature}/rust-feature.h (100%) diff --git a/gcc/rust/Make-lang.in b/gcc/rust/Make-lang.in index bbc3cc4903e4..d0c7b2c0e2a5 100644 --- a/gcc/rust/Make-lang.in +++ b/gcc/rust/Make-lang.in @@ -444,6 +444,7 @@ RUST_INCLUDES = -I $(srcdir)/rust \ -I $(srcdir)/rust/checks/errors \ -I $(srcdir)/rust/checks/errors/privacy \ -I $(srcdir)/rust/checks/errors/borrowck \ + -I $(srcdir)/rust/checks/errors/feature \ -I $(srcdir)/rust/util \ -I $(srcdir)/rust/metadata \ -I $(srcdir)/../libgrust @@ -516,6 +517,11 @@ rust/%.o: rust/checks/errors/%.cc $(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< $(POSTCOMPILE) +# build feature related files in rust folder +rust/%.o: rust/checks/errors/feature/%.cc + $(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< + $(POSTCOMPILE) + # build privacy pass files in rust folder rust/%.o: rust/checks/errors/privacy/%.cc $(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< diff --git a/gcc/rust/checks/errors/rust-feature-gate.cc b/gcc/rust/checks/errors/feature/rust-feature-gate.cc similarity index 100% rename from gcc/rust/checks/errors/rust-feature-gate.cc rename to gcc/rust/checks/errors/feature/rust-feature-gate.cc diff --git a/gcc/rust/checks/errors/rust-feature-gate.h b/gcc/rust/checks/errors/feature/rust-feature-gate.h similarity index 100% rename from gcc/rust/checks/errors/rust-feature-gate.h rename to gcc/rust/checks/errors/feature/rust-feature-gate.h diff --git a/gcc/rust/checks/errors/rust-feature.cc b/gcc/rust/checks/errors/feature/rust-feature.cc similarity index 100% rename from gcc/rust/checks/errors/rust-feature.cc rename to gcc/rust/checks/errors/feature/rust-feature.cc diff --git a/gcc/rust/checks/errors/rust-feature.h b/gcc/rust/checks/errors/feature/rust-feature.h similarity index 100% rename from gcc/rust/checks/errors/rust-feature.h rename to gcc/rust/checks/errors/feature/rust-feature.h From 0649f043eebf8cff29e61ff0562c06f8f72c6b14 Mon Sep 17 00:00:00 2001 From: Owen Avery Date: Sun, 17 Aug 2025 14:15:35 -0400 Subject: [PATCH 2/2] Improve feature handling This includes a program, written using flex and bison, to extract information on unstable features from rustc source code and save it to a header file. The script does fetch files from https://github.com/rust-lang/rust (the official rustc git repository), which should be alright, as it's only intended to be run by maintainers. See https://doc.rust-lang.org/unstable-book/ for information on unstable features. gcc/rust/ChangeLog: * checks/errors/feature/rust-feature-gate.cc (FeatureGate::gate): Handle removal of Feature::create. (FeatureGate::visit): Refer to AUTO_TRAITS as OPTIN_BUILTIN_TRAITS. * checks/errors/feature/rust-feature.cc (Feature::create): Remove. (Feature::feature_list): New static member variable. (Feature::name_hash_map): Use "rust-feature-defs.h" to define. (Feature::lookup): New member function definition. * checks/errors/feature/rust-feature.h (Feature::State): Add comments. (Feature::Name): Use "rust-feature-defs.h" to define. (Feature::as_string): Make const. (Feature::name): Likewise. (Feature::state): Likewise. (Feature::issue): Likewise. (Feature::description): Remove member function declaration. (Feature::create): Remove static member function declaration. (Feature::lookup): New member function declarations. (Feature::Feature): Adjust arguments. (Feature::m_rustc_since): Rename to... (Feature::m_rust_since): ...here. (Feature::m_description): Remove. (Feature::m_reason): New member variable. (Feature::feature_list): New static member variable. * checks/errors/feature/rust-feature-defs.h: New file. contrib/ChangeLog: * rust/feature-fetch/parse.y: New file. * rust/feature-fetch/scan.l: New file. * rust/feature-fetch/.gitignore: New file. * rust/feature-fetch/Makefile: New file. * rust/feature-fetch/fetch: New file. * rust/feature-fetch/regen: New file. * rust/feature-fetch/copyright-stub.h: New file. Signed-off-by: Owen Avery --- contrib/rust/feature-fetch/.gitignore | 1 + contrib/rust/feature-fetch/Makefile | 59 ++ contrib/rust/feature-fetch/copyright-stub.h | 17 + contrib/rust/feature-fetch/fetch | 30 + contrib/rust/feature-fetch/parse.y | 143 +++++ contrib/rust/feature-fetch/regen | 23 + contrib/rust/feature-fetch/scan.l | 55 ++ .../checks/errors/feature/rust-feature-defs.h | 598 ++++++++++++++++++ .../errors/feature/rust-feature-gate.cc | 4 +- .../checks/errors/feature/rust-feature.cc | 125 ++-- gcc/rust/checks/errors/feature/rust-feature.h | 68 +- 11 files changed, 1023 insertions(+), 100 deletions(-) create mode 100644 contrib/rust/feature-fetch/.gitignore create mode 100644 contrib/rust/feature-fetch/Makefile create mode 100644 contrib/rust/feature-fetch/copyright-stub.h create mode 100755 contrib/rust/feature-fetch/fetch create mode 100644 contrib/rust/feature-fetch/parse.y create mode 100755 contrib/rust/feature-fetch/regen create mode 100644 contrib/rust/feature-fetch/scan.l create mode 100644 gcc/rust/checks/errors/feature/rust-feature-defs.h diff --git a/contrib/rust/feature-fetch/.gitignore b/contrib/rust/feature-fetch/.gitignore new file mode 100644 index 000000000000..796b96d1c402 --- /dev/null +++ b/contrib/rust/feature-fetch/.gitignore @@ -0,0 +1 @@ +/build diff --git a/contrib/rust/feature-fetch/Makefile b/contrib/rust/feature-fetch/Makefile new file mode 100644 index 000000000000..9828e02e4e11 --- /dev/null +++ b/contrib/rust/feature-fetch/Makefile @@ -0,0 +1,59 @@ +# Copyright (C) 2025 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 +# . + +OUT = ../../../gcc/rust/checks/errors/feature/rust-feature-defs.h + +all: $(OUT) + +mk-build-dir: + mkdir -p build + +build/parse.c: parse.y mk-build-dir + $(YACC) $(YFLAGS) -o $@ --defines=build/parse.h $< + +build/parse.h: build/parse.c; + +build/scan.c: scan.l + $(LEX) $(LFLAGS) -o $@ -Ca --header-file=build/scan.h $< + +build/scan.h: build/scan.c; + +build/%.o: build/%.c build/parse.h build/scan.h + $(CC) $(CFLAGS) -c -Ibuild -o $@ $< + +build/feature-extract: build/parse.o build/scan.o + $(CC) $(LDFLAGS) $(LDLIBS) -o $@ $^ + +build/download.rs: fetch + ./$< $@ + +$(OUT): build/feature-extract build/download.rs + # add copyright header + newline + echo | \ + cat copyright-stub.h - | \ + sed "s/YYYY/$$(date +%Y)/" > build/rust-feature-defs.h + cat build/download.rs | ./$< >> build/rust-feature-defs.h + clang-format -i build/rust-feature-defs.h \ + --style=file:../../clang-format + mv build/rust-feature-defs.h $(OUT) + +clean: + $(RM) -r build + +clean-all: clean + $(RM) $(OUT) diff --git a/contrib/rust/feature-fetch/copyright-stub.h b/contrib/rust/feature-fetch/copyright-stub.h new file mode 100644 index 000000000000..4f3f9cbdf804 --- /dev/null +++ b/contrib/rust/feature-fetch/copyright-stub.h @@ -0,0 +1,17 @@ +// Copyright (C) YYYY 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 +// . diff --git a/contrib/rust/feature-fetch/fetch b/contrib/rust/feature-fetch/fetch new file mode 100755 index 000000000000..b26ed3c9dc69 --- /dev/null +++ b/contrib/rust/feature-fetch/fetch @@ -0,0 +1,30 @@ +#!/bin/sh + +# Copyright (C) 2025 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 +# . + +RUST_VERSION="1.49.0" + +[ $# = 1 ] || exit 1 + +# Fetches files from the official rustc git repository + +URL_PREFIX='https://raw.githubusercontent.com/rust-lang/rust/refs/tags' +URL_TEMPLATE="$URL_PREFIX/$RUST_VERSION/compiler/rustc_feature/src" + +wget -O $1 "$URL_TEMPLATE"/{accepted,active,removed}.rs diff --git a/contrib/rust/feature-fetch/parse.y b/contrib/rust/feature-fetch/parse.y new file mode 100644 index 000000000000..34c0138595b8 --- /dev/null +++ b/contrib/rust/feature-fetch/parse.y @@ -0,0 +1,143 @@ +/* Copyright (C) 2025 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 +. */ + +%{ + +#include +#include +#include + +int yylex (void); +void yyerror (char const *); + +#include "scan.h" + +// expands to three %s parameters +#define UNWRAP_OPT_STR(prefix, s) (s ? prefix "_SOME (" : prefix "_NONE"), (s ? s : ""), (s ? ")" : "") + +%} + +%union +{ + char *str; +}; + +%token IDENT STR NUM +%token SCOPE +%token K_SOME K_NONE +%token K_ACTIVE K_ACCEPTED K_REMOVED K_STABLE_REMOVED +%token K_E_START K_E_2018 + +%type issue +%type edition +%type reason + +%% + +multi_database: multi_database database +| database +; + +database: '(' entry_list ')'; + +entry_list: entry_list entry ',' +| entry ',' +; + +entry: '(' K_ACTIVE ',' IDENT ',' STR ',' issue ',' edition ')' { + char *ident_upper = strdup ($4); + for (size_t i = 0; ident_upper[i]; i++) + ident_upper[i] = toupper (ident_upper[i]); + printf ("FEATURE_ACTIVE (\"%s\", %s, %s, %s%s%s, EDITION_%s)\n", $4, ident_upper, $6, UNWRAP_OPT_STR ("ISSUE", $8), $10 ? $10 : "NONE"); + free ($4); + free (ident_upper); + free ($6); + free ($8); +} +| '(' K_ACCEPTED ',' IDENT ',' STR ',' issue ',' K_NONE ')' { + char *ident_upper = strdup ($4); + for (size_t i = 0; ident_upper[i]; i++) + ident_upper[i] = toupper (ident_upper[i]); + printf ("FEATURE_ACCEPTED (\"%s\", %s, %s, %s%s%s)\n", $4, ident_upper, $6, UNWRAP_OPT_STR ("ISSUE", $8)); + free ($4); + free (ident_upper); + free ($6); + free ($8); +} +| '(' K_REMOVED ',' IDENT ',' STR ',' issue ',' K_NONE ',' reason ')' { + char *ident_upper; + // HACK: convert no_debug to F_NO_DEBUG instead + // since NO_DEBUG is used as an unrelated macro + if (!strcmp ($4, "no_debug")) + { + ident_upper = strdup ("F_NO_DEBUG"); + } + else + { + ident_upper = strdup ($4); + for (size_t i = 0; ident_upper[i]; i++) + ident_upper[i] = toupper (ident_upper[i]); + } + printf ("FEATURE_REMOVED (\"%s\", %s, %s, %s%s%s, %s%s%s)\n", $4, ident_upper, $6, UNWRAP_OPT_STR ("ISSUE", $8), UNWRAP_OPT_STR ("REASON", $12)); + free ($4); + free (ident_upper); + free ($6); + free ($8); + free ($12); +} +| '(' K_STABLE_REMOVED ',' IDENT ',' STR ',' issue ',' K_NONE ')' { + char *ident_upper = strdup ($4); + for (size_t i = 0; ident_upper[i]; i++) + ident_upper[i] = toupper (ident_upper[i]); + printf ("FEATURE_STABLE_REMOVED (\"%s\", %s, %s, %s%s%s)\n", $4, ident_upper, $6, UNWRAP_OPT_STR ("ISSUE", $8)); + free ($4); + free (ident_upper); + free ($6); + free ($8); +} +; + +issue: K_SOME '(' NUM ')' { $$ = $3; } +| K_NONE { $$ = NULL; } +; + +/* TODO: expand this as needed */ +edition: K_NONE { $$ = NULL; } +| K_SOME '(' K_E_START SCOPE K_E_2018 ')' { $$ = "2018"; } +; + +reason: K_SOME '(' STR ')' { $$ = $3; } +| K_NONE { $$ = NULL; } +; + +%% + +void yyerror (const char *msg) +{ + fprintf (stderr, "%s\n", msg); +} + +int yywrap (void) +{ + return 1; +} + +int main (void) +{ + return yyparse (); +} diff --git a/contrib/rust/feature-fetch/regen b/contrib/rust/feature-fetch/regen new file mode 100755 index 000000000000..409f330bca4d --- /dev/null +++ b/contrib/rust/feature-fetch/regen @@ -0,0 +1,23 @@ +#!/bin/sh + +# Copyright (C) 2025 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 +# . + +cd "$(dirname "$0")" +rm -f ../../../gcc/rust/checks/errors/feature/rust-feature-defs.h +make all diff --git a/contrib/rust/feature-fetch/scan.l b/contrib/rust/feature-fetch/scan.l new file mode 100644 index 000000000000..768f4c7f02cc --- /dev/null +++ b/contrib/rust/feature-fetch/scan.l @@ -0,0 +1,55 @@ +/* Copyright (C) 2025 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 +. */ + +%{ + +#include "parse.h" + +static int p_count = 0; + +%} + +%x INSIDE COMMENT + +%% + +declare_features! BEGIN (INSIDE); +.|\n /* ignore */ + +\( p_count++; return '('; +\) if (!--p_count) { BEGIN (0); } return ')'; +, return ','; +:: return SCOPE; +Some return K_SOME; +None return K_NONE; +active return K_ACTIVE; +accepted return K_ACCEPTED; +removed return K_REMOVED; +stable_removed return K_STABLE_REMOVED; +Edition return K_E_START; +Edition2018 return K_E_2018; + +[A-Za-z_][A-Za-z0-9_]* yylval.str = strdup (yytext); return IDENT; +[1-9][0-9]* yylval.str = strdup (yytext); return NUM; +\"[^"]+\" yylval.str = strdup (yytext); return STR; +"/""/" BEGIN (COMMENT); +[ \n] /* ignore */ +. { fprintf (stderr, "unrecognized character %u\n", (unsigned int) yytext[0]); exit (1); } + +. /* skip */ +\n BEGIN (INSIDE); diff --git a/gcc/rust/checks/errors/feature/rust-feature-defs.h b/gcc/rust/checks/errors/feature/rust-feature-defs.h new file mode 100644 index 000000000000..d74e77ccff3e --- /dev/null +++ b/gcc/rust/checks/errors/feature/rust-feature-defs.h @@ -0,0 +1,598 @@ +// Copyright (C) 2025 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 +// . + +FEATURE_ACCEPTED ("issue_5723_bootstrap", ISSUE_5723_BOOTSTRAP, "1.0.0", + ISSUE_NONE) +FEATURE_ACCEPTED ("test_accepted_feature", TEST_ACCEPTED_FEATURE, "1.0.0", + ISSUE_NONE) +FEATURE_ACCEPTED ("associated_types", ASSOCIATED_TYPES, "1.0.0", ISSUE_NONE) +FEATURE_ACCEPTED ("default_type_params", DEFAULT_TYPE_PARAMS, "1.0.0", + ISSUE_NONE) +FEATURE_ACCEPTED ("globs", GLOBS, "1.0.0", ISSUE_NONE) +FEATURE_ACCEPTED ("macro_rules", MACRO_RULES, "1.0.0", ISSUE_NONE) +FEATURE_ACCEPTED ("slicing_syntax", SLICING_SYNTAX, "1.0.0", ISSUE_NONE) +FEATURE_ACCEPTED ("struct_variant", STRUCT_VARIANT, "1.0.0", ISSUE_NONE) +FEATURE_ACCEPTED ("tuple_indexing", TUPLE_INDEXING, "1.0.0", ISSUE_NONE) +FEATURE_ACCEPTED ("if_let", IF_LET, "1.0.0", ISSUE_NONE) +FEATURE_ACCEPTED ("while_let", WHILE_LET, "1.0.0", ISSUE_NONE) +FEATURE_ACCEPTED ("no_std", NO_STD, "1.6.0", ISSUE_NONE) +FEATURE_ACCEPTED ("augmented_assignments", AUGMENTED_ASSIGNMENTS, "1.8.0", + ISSUE_SOME (28235)) +FEATURE_ACCEPTED ("braced_empty_structs", BRACED_EMPTY_STRUCTS, "1.8.0", + ISSUE_SOME (29720)) +FEATURE_ACCEPTED ("deprecated", DEPRECATED, "1.9.0", ISSUE_SOME (29935)) +FEATURE_ACCEPTED ("type_macros", TYPE_MACROS, "1.13.0", ISSUE_SOME (27245)) +FEATURE_ACCEPTED ("question_mark", QUESTION_MARK, "1.13.0", ISSUE_SOME (31436)) +FEATURE_ACCEPTED ("dotdot_in_tuple_patterns", DOTDOT_IN_TUPLE_PATTERNS, + "1.14.0", ISSUE_SOME (33627)) +FEATURE_ACCEPTED ("item_like_imports", ITEM_LIKE_IMPORTS, "1.15.0", + ISSUE_SOME (35120)) +FEATURE_ACCEPTED ("more_struct_aliases", MORE_STRUCT_ALIASES, "1.16.0", + ISSUE_SOME (37544)) +FEATURE_ACCEPTED ("static_in_const", STATIC_IN_CONST, "1.17.0", + ISSUE_SOME (35897)) +FEATURE_ACCEPTED ("field_init_shorthand", FIELD_INIT_SHORTHAND, "1.17.0", + ISSUE_SOME (37340)) +FEATURE_ACCEPTED ("static_recursion", STATIC_RECURSION, "1.17.0", + ISSUE_SOME (29719)) +FEATURE_ACCEPTED ("pub_restricted", PUB_RESTRICTED, "1.18.0", + ISSUE_SOME (32409)) +FEATURE_ACCEPTED ("windows_subsystem", WINDOWS_SUBSYSTEM, "1.18.0", + ISSUE_SOME (37499)) +FEATURE_ACCEPTED ("loop_break_value", LOOP_BREAK_VALUE, "1.19.0", + ISSUE_SOME (37339)) +FEATURE_ACCEPTED ("relaxed_adts", RELAXED_ADTS, "1.19.0", ISSUE_SOME (35626)) +FEATURE_ACCEPTED ("closure_to_fn_coercion", CLOSURE_TO_FN_COERCION, "1.19.0", + ISSUE_SOME (39817)) +FEATURE_ACCEPTED ("struct_field_attributes", STRUCT_FIELD_ATTRIBUTES, "1.20.0", + ISSUE_SOME (38814)) +FEATURE_ACCEPTED ("associated_consts", ASSOCIATED_CONSTS, "1.20.0", + ISSUE_SOME (29646)) +FEATURE_ACCEPTED ("compile_error", COMPILE_ERROR, "1.20.0", ISSUE_SOME (40872)) +FEATURE_ACCEPTED ("rvalue_static_promotion", RVALUE_STATIC_PROMOTION, "1.21.0", + ISSUE_SOME (38865)) +FEATURE_ACCEPTED ("drop_types_in_const", DROP_TYPES_IN_CONST, "1.22.0", + ISSUE_SOME (33156)) +FEATURE_ACCEPTED ("abi_sysv64", ABI_SYSV64, "1.24.0", ISSUE_SOME (36167)) +FEATURE_ACCEPTED ("repr_align", REPR_ALIGN, "1.25.0", ISSUE_SOME (33626)) +FEATURE_ACCEPTED ("match_beginning_vert", MATCH_BEGINNING_VERT, "1.25.0", + ISSUE_SOME (44101)) +FEATURE_ACCEPTED ("use_nested_groups", USE_NESTED_GROUPS, "1.25.0", + ISSUE_SOME (44494)) +FEATURE_ACCEPTED ("const_indexing", CONST_INDEXING, "1.26.0", + ISSUE_SOME (29947)) +FEATURE_ACCEPTED ("inclusive_range_syntax", INCLUSIVE_RANGE_SYNTAX, "1.26.0", + ISSUE_SOME (28237)) +FEATURE_ACCEPTED ("dotdoteq_in_patterns", DOTDOTEQ_IN_PATTERNS, "1.26.0", + ISSUE_SOME (28237)) +FEATURE_ACCEPTED ("termination_trait", TERMINATION_TRAIT, "1.26.0", + ISSUE_SOME (43301)) +FEATURE_ACCEPTED ("clone_closures", CLONE_CLOSURES, "1.26.0", + ISSUE_SOME (44490)) +FEATURE_ACCEPTED ("copy_closures", COPY_CLOSURES, "1.26.0", ISSUE_SOME (44490)) +FEATURE_ACCEPTED ("universal_impl_trait", UNIVERSAL_IMPL_TRAIT, "1.26.0", + ISSUE_SOME (34511)) +FEATURE_ACCEPTED ("conservative_impl_trait", CONSERVATIVE_IMPL_TRAIT, "1.26.0", + ISSUE_SOME (34511)) +FEATURE_ACCEPTED ("i128_type", I128_TYPE, "1.26.0", ISSUE_SOME (35118)) +FEATURE_ACCEPTED ("match_default_bindings", MATCH_DEFAULT_BINDINGS, "1.26.0", + ISSUE_SOME (42640)) +FEATURE_ACCEPTED ("underscore_lifetimes", UNDERSCORE_LIFETIMES, "1.26.0", + ISSUE_SOME (44524)) +FEATURE_ACCEPTED ("generic_param_attrs", GENERIC_PARAM_ATTRS, "1.27.0", + ISSUE_SOME (48848)) +FEATURE_ACCEPTED ("cfg_target_feature", CFG_TARGET_FEATURE, "1.27.0", + ISSUE_SOME (29717)) +FEATURE_ACCEPTED ("target_feature", TARGET_FEATURE, "1.27.0", ISSUE_NONE) +FEATURE_ACCEPTED ("dyn_trait", DYN_TRAIT, "1.27.0", ISSUE_SOME (44662)) +FEATURE_ACCEPTED ("fn_must_use", FN_MUST_USE, "1.27.0", ISSUE_SOME (43302)) +FEATURE_ACCEPTED ("macro_lifetime_matcher", MACRO_LIFETIME_MATCHER, "1.27.0", + ISSUE_SOME (34303)) +FEATURE_ACCEPTED ("termination_trait_test", TERMINATION_TRAIT_TEST, "1.27.0", + ISSUE_SOME (48854)) +FEATURE_ACCEPTED ("global_allocator", GLOBAL_ALLOCATOR, "1.28.0", + ISSUE_SOME (27389)) +FEATURE_ACCEPTED ("repr_transparent", REPR_TRANSPARENT, "1.28.0", + ISSUE_SOME (43036)) +FEATURE_ACCEPTED ("proc_macro", PROC_MACRO, "1.29.0", ISSUE_SOME (38356)) +FEATURE_ACCEPTED ("non_modrs_mods", NON_MODRS_MODS, "1.30.0", + ISSUE_SOME (44660)) +FEATURE_ACCEPTED ("macro_vis_matcher", MACRO_VIS_MATCHER, "1.30.0", + ISSUE_SOME (41022)) +FEATURE_ACCEPTED ("use_extern_macros", USE_EXTERN_MACROS, "1.30.0", + ISSUE_SOME (35896)) +FEATURE_ACCEPTED ("raw_identifiers", RAW_IDENTIFIERS, "1.30.0", + ISSUE_SOME (48589)) +FEATURE_ACCEPTED ("tool_attributes", TOOL_ATTRIBUTES, "1.30.0", + ISSUE_SOME (44690)) +FEATURE_ACCEPTED ("proc_macro_path_invoc", PROC_MACRO_PATH_INVOC, "1.30.0", + ISSUE_SOME (38356)) +FEATURE_ACCEPTED ("attr_literals", ATTR_LITERALS, "1.30.0", ISSUE_SOME (34981)) +FEATURE_ACCEPTED ("infer_outlives_requirements", INFER_OUTLIVES_REQUIREMENTS, + "1.30.0", ISSUE_SOME (44493)) +FEATURE_ACCEPTED ("panic_handler", PANIC_HANDLER, "1.30.0", ISSUE_SOME (44489)) +FEATURE_ACCEPTED ("used", USED, "1.30.0", ISSUE_SOME (40289)) +FEATURE_ACCEPTED ("crate_in_paths", CRATE_IN_PATHS, "1.30.0", + ISSUE_SOME (45477)) +FEATURE_ACCEPTED ("extern_absolute_paths", EXTERN_ABSOLUTE_PATHS, "1.30.0", + ISSUE_SOME (44660)) +FEATURE_ACCEPTED ("extern_prelude", EXTERN_PRELUDE, "1.30.0", + ISSUE_SOME (44660)) +FEATURE_ACCEPTED ("pattern_parentheses", PATTERN_PARENTHESES, "1.31.0", + ISSUE_SOME (51087)) +FEATURE_ACCEPTED ("min_const_fn", MIN_CONST_FN, "1.31.0", ISSUE_SOME (53555)) +FEATURE_ACCEPTED ("tool_lints", TOOL_LINTS, "1.31.0", ISSUE_SOME (44690)) +FEATURE_ACCEPTED ("impl_header_lifetime_elision", IMPL_HEADER_LIFETIME_ELISION, + "1.31.0", ISSUE_SOME (15872)) +FEATURE_ACCEPTED ("extern_crate_item_prelude", EXTERN_CRATE_ITEM_PRELUDE, + "1.31.0", ISSUE_SOME (55599)) +FEATURE_ACCEPTED ("macro_literal_matcher", MACRO_LITERAL_MATCHER, "1.32.0", + ISSUE_SOME (35625)) +FEATURE_ACCEPTED ("macro_at_most_once_rep", MACRO_AT_MOST_ONCE_REP, "1.32.0", + ISSUE_SOME (48075)) +FEATURE_ACCEPTED ("self_struct_ctor", SELF_STRUCT_CTOR, "1.32.0", + ISSUE_SOME (51994)) +FEATURE_ACCEPTED ("self_in_typedefs", SELF_IN_TYPEDEFS, "1.32.0", + ISSUE_SOME (49303)) +FEATURE_ACCEPTED ("uniform_paths", UNIFORM_PATHS, "1.32.0", ISSUE_SOME (53130)) +FEATURE_ACCEPTED ("exhaustive_integer_patterns", EXHAUSTIVE_INTEGER_PATTERNS, + "1.33.0", ISSUE_SOME (50907)) +FEATURE_ACCEPTED ("underscore_imports", UNDERSCORE_IMPORTS, "1.33.0", + ISSUE_SOME (48216)) +FEATURE_ACCEPTED ("repr_packed", REPR_PACKED, "1.33.0", ISSUE_SOME (33158)) +FEATURE_ACCEPTED ("irrefutable_let_patterns", IRREFUTABLE_LET_PATTERNS, + "1.33.0", ISSUE_SOME (44495)) +FEATURE_ACCEPTED ("min_const_unsafe_fn", MIN_CONST_UNSAFE_FN, "1.33.0", + ISSUE_SOME (55607)) +FEATURE_ACCEPTED ("const_let", CONST_LET, "1.33.0", ISSUE_SOME (48821)) +FEATURE_ACCEPTED ("cfg_attr_multi", CFG_ATTR_MULTI, "1.33.0", + ISSUE_SOME (54881)) +FEATURE_ACCEPTED ("if_while_or_patterns", IF_WHILE_OR_PATTERNS, "1.33.0", + ISSUE_SOME (48215)) +FEATURE_ACCEPTED ("cfg_target_vendor", CFG_TARGET_VENDOR, "1.33.0", + ISSUE_SOME (29718)) +FEATURE_ACCEPTED ("extern_crate_self", EXTERN_CRATE_SELF, "1.34.0", + ISSUE_SOME (56409)) +FEATURE_ACCEPTED ("unrestricted_attribute_tokens", + UNRESTRICTED_ATTRIBUTE_TOKENS, "1.34.0", ISSUE_SOME (55208)) +FEATURE_ACCEPTED ("type_alias_enum_variants", TYPE_ALIAS_ENUM_VARIANTS, + "1.37.0", ISSUE_SOME (49683)) +FEATURE_ACCEPTED ("repr_align_enum", REPR_ALIGN_ENUM, "1.37.0", + ISSUE_SOME (57996)) +FEATURE_ACCEPTED ("underscore_const_names", UNDERSCORE_CONST_NAMES, "1.37.0", + ISSUE_SOME (54912)) +FEATURE_ACCEPTED ("async_await", ASYNC_AWAIT, "1.39.0", ISSUE_SOME (50547)) +FEATURE_ACCEPTED ("bind_by_move_pattern_guards", BIND_BY_MOVE_PATTERN_GUARDS, + "1.39.0", ISSUE_SOME (15287)) +FEATURE_ACCEPTED ("param_attrs", PARAM_ATTRS, "1.39.0", ISSUE_SOME (60406)) +FEATURE_ACCEPTED ("macros_in_extern", MACROS_IN_EXTERN, "1.40.0", + ISSUE_SOME (49476)) +FEATURE_ACCEPTED ("non_exhaustive", NON_EXHAUSTIVE, "1.40.0", + ISSUE_SOME (44109)) +FEATURE_ACCEPTED ("const_constructor", CONST_CONSTRUCTOR, "1.40.0", + ISSUE_SOME (61456)) +FEATURE_ACCEPTED ("cfg_doctest", CFG_DOCTEST, "1.40.0", ISSUE_SOME (62210)) +FEATURE_ACCEPTED ("re_rebalance_coherence", RE_REBALANCE_COHERENCE, "1.41.0", + ISSUE_SOME (55437)) +FEATURE_ACCEPTED ("transparent_enums", TRANSPARENT_ENUMS, "1.42.0", + ISSUE_SOME (60405)) +FEATURE_ACCEPTED ("slice_patterns", SLICE_PATTERNS, "1.42.0", + ISSUE_SOME (62254)) +FEATURE_ACCEPTED ("const_if_match", CONST_IF_MATCH, "1.46.0", + ISSUE_SOME (49146)) +FEATURE_ACCEPTED ("const_loop", CONST_LOOP, "1.46.0", ISSUE_SOME (52000)) +FEATURE_ACCEPTED ("track_caller", TRACK_CALLER, "1.46.0", ISSUE_SOME (47809)) +FEATURE_ACCEPTED ("doc_alias", DOC_ALIAS, "1.48.0", ISSUE_SOME (50146)) +FEATURE_ACCEPTED ("move_ref_pattern", MOVE_REF_PATTERN, "1.48.0", + ISSUE_SOME (68354)) +FEATURE_ACTIVE ("rustc_attrs", RUSTC_ATTRS, "1.0.0", ISSUE_NONE, EDITION_NONE) +FEATURE_ACTIVE ("rustc_private", RUSTC_PRIVATE, "1.0.0", ISSUE_SOME (27812), + EDITION_NONE) +FEATURE_ACTIVE ("intrinsics", INTRINSICS, "1.0.0", ISSUE_NONE, EDITION_NONE) +FEATURE_ACTIVE ("lang_items", LANG_ITEMS, "1.0.0", ISSUE_NONE, EDITION_NONE) +FEATURE_ACTIVE ("staged_api", STAGED_API, "1.0.0", ISSUE_NONE, EDITION_NONE) +FEATURE_ACTIVE ("allow_internal_unstable", ALLOW_INTERNAL_UNSTABLE, "1.0.0", + ISSUE_NONE, EDITION_NONE) +FEATURE_ACTIVE ("allow_internal_unsafe", ALLOW_INTERNAL_UNSAFE, "1.0.0", + ISSUE_NONE, EDITION_NONE) +FEATURE_ACTIVE ("link_llvm_intrinsics", LINK_LLVM_INTRINSICS, "1.0.0", + ISSUE_SOME (29602), EDITION_NONE) +FEATURE_ACTIVE ("box_syntax", BOX_SYNTAX, "1.0.0", ISSUE_SOME (49733), + EDITION_NONE) +FEATURE_ACTIVE ("main", MAIN, "1.0.0", ISSUE_SOME (29634), EDITION_NONE) +FEATURE_ACTIVE ("start", START, "1.0.0", ISSUE_SOME (29633), EDITION_NONE) +FEATURE_ACTIVE ("fundamental", FUNDAMENTAL, "1.0.0", ISSUE_SOME (29635), + EDITION_NONE) +FEATURE_ACTIVE ("unboxed_closures", UNBOXED_CLOSURES, "1.0.0", + ISSUE_SOME (29625), EDITION_NONE) +FEATURE_ACTIVE ("linkage", LINKAGE, "1.0.0", ISSUE_SOME (29603), EDITION_NONE) +FEATURE_ACTIVE ("optin_builtin_traits", OPTIN_BUILTIN_TRAITS, "1.0.0", + ISSUE_SOME (13231), EDITION_NONE) +FEATURE_ACTIVE ("box_patterns", BOX_PATTERNS, "1.0.0", ISSUE_SOME (29641), + EDITION_NONE) +FEATURE_ACTIVE ("prelude_import", PRELUDE_IMPORT, "1.2.0", ISSUE_NONE, + EDITION_NONE) +FEATURE_ACTIVE ("omit_gdb_pretty_printer_section", + OMIT_GDB_PRETTY_PRINTER_SECTION, "1.5.0", ISSUE_NONE, + EDITION_NONE) +FEATURE_ACTIVE ("abi_vectorcall", ABI_VECTORCALL, "1.7.0", ISSUE_NONE, + EDITION_NONE) +FEATURE_ACTIVE ("structural_match", STRUCTURAL_MATCH, "1.8.0", + ISSUE_SOME (31434), EDITION_NONE) +FEATURE_ACTIVE ("dropck_eyepatch", DROPCK_EYEPATCH, "1.10.0", + ISSUE_SOME (34761), EDITION_NONE) +FEATURE_ACTIVE ("panic_runtime", PANIC_RUNTIME, "1.10.0", ISSUE_SOME (32837), + EDITION_NONE) +FEATURE_ACTIVE ("needs_panic_runtime", NEEDS_PANIC_RUNTIME, "1.10.0", + ISSUE_SOME (32837), EDITION_NONE) +FEATURE_ACTIVE ("compiler_builtins", COMPILER_BUILTINS, "1.13.0", ISSUE_NONE, + EDITION_NONE) +FEATURE_ACTIVE ("abi_unadjusted", ABI_UNADJUSTED, "1.16.0", ISSUE_NONE, + EDITION_NONE) +FEATURE_ACTIVE ("profiler_runtime", PROFILER_RUNTIME, "1.18.0", ISSUE_NONE, + EDITION_NONE) +FEATURE_ACTIVE ("abi_thiscall", ABI_THISCALL, "1.19.0", ISSUE_NONE, + EDITION_NONE) +FEATURE_ACTIVE ("allocator_internals", ALLOCATOR_INTERNALS, "1.20.0", + ISSUE_NONE, EDITION_NONE) +FEATURE_ACTIVE ("test_2018_feature", TEST_2018_FEATURE, "1.31.0", ISSUE_NONE, + EDITION_2018) +FEATURE_ACTIVE ("no_niche", NO_NICHE, "1.42.0", ISSUE_NONE, EDITION_NONE) +FEATURE_ACTIVE ("rustc_allow_const_fn_unstable", RUSTC_ALLOW_CONST_FN_UNSTABLE, + "1.49.0", ISSUE_SOME (69399), EDITION_NONE) +FEATURE_ACTIVE ("arm_target_feature", ARM_TARGET_FEATURE, "1.27.0", + ISSUE_SOME (44839), EDITION_NONE) +FEATURE_ACTIVE ("aarch64_target_feature", AARCH64_TARGET_FEATURE, "1.27.0", + ISSUE_SOME (44839), EDITION_NONE) +FEATURE_ACTIVE ("hexagon_target_feature", HEXAGON_TARGET_FEATURE, "1.27.0", + ISSUE_SOME (44839), EDITION_NONE) +FEATURE_ACTIVE ("powerpc_target_feature", POWERPC_TARGET_FEATURE, "1.27.0", + ISSUE_SOME (44839), EDITION_NONE) +FEATURE_ACTIVE ("mips_target_feature", MIPS_TARGET_FEATURE, "1.27.0", + ISSUE_SOME (44839), EDITION_NONE) +FEATURE_ACTIVE ("avx512_target_feature", AVX512_TARGET_FEATURE, "1.27.0", + ISSUE_SOME (44839), EDITION_NONE) +FEATURE_ACTIVE ("sse4a_target_feature", SSE4A_TARGET_FEATURE, "1.27.0", + ISSUE_SOME (44839), EDITION_NONE) +FEATURE_ACTIVE ("tbm_target_feature", TBM_TARGET_FEATURE, "1.27.0", + ISSUE_SOME (44839), EDITION_NONE) +FEATURE_ACTIVE ("wasm_target_feature", WASM_TARGET_FEATURE, "1.30.0", + ISSUE_SOME (44839), EDITION_NONE) +FEATURE_ACTIVE ("adx_target_feature", ADX_TARGET_FEATURE, "1.32.0", + ISSUE_SOME (44839), EDITION_NONE) +FEATURE_ACTIVE ("cmpxchg16b_target_feature", CMPXCHG16B_TARGET_FEATURE, + "1.32.0", ISSUE_SOME (44839), EDITION_NONE) +FEATURE_ACTIVE ("movbe_target_feature", MOVBE_TARGET_FEATURE, "1.34.0", + ISSUE_SOME (44839), EDITION_NONE) +FEATURE_ACTIVE ("rtm_target_feature", RTM_TARGET_FEATURE, "1.35.0", + ISSUE_SOME (44839), EDITION_NONE) +FEATURE_ACTIVE ("f16c_target_feature", F16C_TARGET_FEATURE, "1.36.0", + ISSUE_SOME (44839), EDITION_NONE) +FEATURE_ACTIVE ("riscv_target_feature", RISCV_TARGET_FEATURE, "1.45.0", + ISSUE_SOME (44839), EDITION_NONE) +FEATURE_ACTIVE ("ermsb_target_feature", ERMSB_TARGET_FEATURE, "1.49.0", + ISSUE_SOME (44839), EDITION_NONE) +FEATURE_ACTIVE ("link_args", LINK_ARGS, "1.0.0", ISSUE_SOME (29596), + EDITION_NONE) +FEATURE_ACTIVE ("non_ascii_idents", NON_ASCII_IDENTS, "1.0.0", + ISSUE_SOME (55467), EDITION_NONE) +FEATURE_ACTIVE ("plugin_registrar", PLUGIN_REGISTRAR, "1.0.0", + ISSUE_SOME (29597), EDITION_NONE) +FEATURE_ACTIVE ("plugin", PLUGIN, "1.0.0", ISSUE_SOME (29597), EDITION_NONE) +FEATURE_ACTIVE ("thread_local", THREAD_LOCAL, "1.0.0", ISSUE_SOME (29594), + EDITION_NONE) +FEATURE_ACTIVE ("simd_ffi", SIMD_FFI, "1.0.0", ISSUE_SOME (27731), EDITION_NONE) +FEATURE_ACTIVE ("nll", NLL, "1.0.0", ISSUE_SOME (43234), EDITION_NONE) +FEATURE_ACTIVE ("const_fn", CONST_FN, "1.2.0", ISSUE_SOME (57563), EDITION_NONE) +FEATURE_ACTIVE ("associated_type_defaults", ASSOCIATED_TYPE_DEFAULTS, "1.2.0", + ISSUE_SOME (29661), EDITION_NONE) +FEATURE_ACTIVE ("no_core", NO_CORE, "1.3.0", ISSUE_SOME (29639), EDITION_NONE) +FEATURE_ACTIVE ("default_type_parameter_fallback", + DEFAULT_TYPE_PARAMETER_FALLBACK, "1.3.0", ISSUE_SOME (27336), + EDITION_NONE) +FEATURE_ACTIVE ("repr_simd", REPR_SIMD, "1.4.0", ISSUE_SOME (27731), + EDITION_NONE) +FEATURE_ACTIVE ("platform_intrinsics", PLATFORM_INTRINSICS, "1.4.0", + ISSUE_SOME (27731), EDITION_NONE) +FEATURE_ACTIVE ("unwind_attributes", UNWIND_ATTRIBUTES, "1.4.0", + ISSUE_SOME (58760), EDITION_NONE) +FEATURE_ACTIVE ("stmt_expr_attributes", STMT_EXPR_ATTRIBUTES, "1.6.0", + ISSUE_SOME (15701), EDITION_NONE) +FEATURE_ACTIVE ("type_ascription", TYPE_ASCRIPTION, "1.6.0", ISSUE_SOME (23416), + EDITION_NONE) +FEATURE_ACTIVE ("cfg_target_thread_local", CFG_TARGET_THREAD_LOCAL, "1.7.0", + ISSUE_SOME (29594), EDITION_NONE) +FEATURE_ACTIVE ("specialization", SPECIALIZATION, "1.7.0", ISSUE_SOME (31844), + EDITION_NONE) +FEATURE_ACTIVE ("min_specialization", MIN_SPECIALIZATION, "1.7.0", + ISSUE_SOME (31844), EDITION_NONE) +FEATURE_ACTIVE ("naked_functions", NAKED_FUNCTIONS, "1.9.0", ISSUE_SOME (32408), + EDITION_NONE) +FEATURE_ACTIVE ("cfg_target_has_atomic", CFG_TARGET_HAS_ATOMIC, "1.9.0", + ISSUE_SOME (32976), EDITION_NONE) +FEATURE_ACTIVE ("exclusive_range_pattern", EXCLUSIVE_RANGE_PATTERN, "1.11.0", + ISSUE_SOME (37854), EDITION_NONE) +FEATURE_ACTIVE ("never_type", NEVER_TYPE, "1.13.0", ISSUE_SOME (35121), + EDITION_NONE) +FEATURE_ACTIVE ("exhaustive_patterns", EXHAUSTIVE_PATTERNS, "1.13.0", + ISSUE_SOME (51085), EDITION_NONE) +FEATURE_ACTIVE ("untagged_unions", UNTAGGED_UNIONS, "1.13.0", + ISSUE_SOME (55149), EDITION_NONE) +FEATURE_ACTIVE ("link_cfg", LINK_CFG, "1.14.0", ISSUE_SOME (37406), + EDITION_NONE) +FEATURE_ACTIVE ("abi_ptx", ABI_PTX, "1.15.0", ISSUE_SOME (38788), EDITION_NONE) +FEATURE_ACTIVE ("repr128", REPR128, "1.16.0", ISSUE_SOME (56071), EDITION_NONE) +FEATURE_ACTIVE ("static_nobundle", STATIC_NOBUNDLE, "1.16.0", + ISSUE_SOME (37403), EDITION_NONE) +FEATURE_ACTIVE ("abi_msp430_interrupt", ABI_MSP430_INTERRUPT, "1.16.0", + ISSUE_SOME (38487), EDITION_NONE) +FEATURE_ACTIVE ("decl_macro", DECL_MACRO, "1.17.0", ISSUE_SOME (39412), + EDITION_NONE) +FEATURE_ACTIVE ("abi_x86_interrupt", ABI_X86_INTERRUPT, "1.17.0", + ISSUE_SOME (40180), EDITION_NONE) +FEATURE_ACTIVE ("allow_fail", ALLOW_FAIL, "1.19.0", ISSUE_SOME (46488), + EDITION_NONE) +FEATURE_ACTIVE ("unsized_tuple_coercion", UNSIZED_TUPLE_COERCION, "1.20.0", + ISSUE_SOME (42877), EDITION_NONE) +FEATURE_ACTIVE ("generators", GENERATORS, "1.21.0", ISSUE_SOME (43122), + EDITION_NONE) +FEATURE_ACTIVE ("doc_cfg", DOC_CFG, "1.21.0", ISSUE_SOME (43781), EDITION_NONE) +FEATURE_ACTIVE ("doc_masked", DOC_MASKED, "1.21.0", ISSUE_SOME (44027), + EDITION_NONE) +FEATURE_ACTIVE ("doc_spotlight", DOC_SPOTLIGHT, "1.22.0", ISSUE_SOME (45040), + EDITION_NONE) +FEATURE_ACTIVE ("external_doc", EXTERNAL_DOC, "1.22.0", ISSUE_SOME (44732), + EDITION_NONE) +FEATURE_ACTIVE ("crate_visibility_modifier", CRATE_VISIBILITY_MODIFIER, + "1.23.0", ISSUE_SOME (53120), EDITION_NONE) +FEATURE_ACTIVE ("extern_types", EXTERN_TYPES, "1.23.0", ISSUE_SOME (43467), + EDITION_NONE) +FEATURE_ACTIVE ("arbitrary_self_types", ARBITRARY_SELF_TYPES, "1.23.0", + ISSUE_SOME (44874), EDITION_NONE) +FEATURE_ACTIVE ("in_band_lifetimes", IN_BAND_LIFETIMES, "1.23.0", + ISSUE_SOME (44524), EDITION_NONE) +FEATURE_ACTIVE ("generic_associated_types", GENERIC_ASSOCIATED_TYPES, "1.23.0", + ISSUE_SOME (44265), EDITION_NONE) +FEATURE_ACTIVE ("trait_alias", TRAIT_ALIAS, "1.24.0", ISSUE_SOME (41517), + EDITION_NONE) +FEATURE_ACTIVE ("infer_static_outlives_requirements", + INFER_STATIC_OUTLIVES_REQUIREMENTS, "1.26.0", + ISSUE_SOME (54185), EDITION_NONE) +FEATURE_ACTIVE ("const_fn_union", CONST_FN_UNION, "1.27.0", ISSUE_SOME (51909), + EDITION_NONE) +FEATURE_ACTIVE ("const_raw_ptr_to_usize_cast", CONST_RAW_PTR_TO_USIZE_CAST, + "1.27.0", ISSUE_SOME (51910), EDITION_NONE) +FEATURE_ACTIVE ("const_raw_ptr_deref", CONST_RAW_PTR_DEREF, "1.27.0", + ISSUE_SOME (51911), EDITION_NONE) +FEATURE_ACTIVE ("trivial_bounds", TRIVIAL_BOUNDS, "1.28.0", ISSUE_SOME (48214), + EDITION_NONE) +FEATURE_ACTIVE ("label_break_value", LABEL_BREAK_VALUE, "1.28.0", + ISSUE_SOME (48594), EDITION_NONE) +FEATURE_ACTIVE ("doc_keyword", DOC_KEYWORD, "1.28.0", ISSUE_SOME (51315), + EDITION_NONE) +FEATURE_ACTIVE ("try_blocks", TRY_BLOCKS, "1.29.0", ISSUE_SOME (31436), + EDITION_NONE) +FEATURE_ACTIVE ("alloc_error_handler", ALLOC_ERROR_HANDLER, "1.29.0", + ISSUE_SOME (51540), EDITION_NONE) +FEATURE_ACTIVE ("abi_amdgpu_kernel", ABI_AMDGPU_KERNEL, "1.29.0", + ISSUE_SOME (51575), EDITION_NONE) +FEATURE_ACTIVE ("const_panic", CONST_PANIC, "1.30.0", ISSUE_SOME (51999), + EDITION_NONE) +FEATURE_ACTIVE ("marker_trait_attr", MARKER_TRAIT_ATTR, "1.30.0", + ISSUE_SOME (29864), EDITION_NONE) +FEATURE_ACTIVE ("proc_macro_hygiene", PROC_MACRO_HYGIENE, "1.30.0", + ISSUE_SOME (54727), EDITION_NONE) +FEATURE_ACTIVE ("unsized_locals", UNSIZED_LOCALS, "1.30.0", ISSUE_SOME (48055), + EDITION_NONE) +FEATURE_ACTIVE ("custom_test_frameworks", CUSTOM_TEST_FRAMEWORKS, "1.30.0", + ISSUE_SOME (50297), EDITION_NONE) +FEATURE_ACTIVE ("custom_inner_attributes", CUSTOM_INNER_ATTRIBUTES, "1.30.0", + ISSUE_SOME (54726), EDITION_NONE) +FEATURE_ACTIVE ("impl_trait_in_bindings", IMPL_TRAIT_IN_BINDINGS, "1.30.0", + ISSUE_SOME (63065), EDITION_NONE) +FEATURE_ACTIVE ("lint_reasons", LINT_REASONS, "1.31.0", ISSUE_SOME (54503), + EDITION_NONE) +FEATURE_ACTIVE ("precise_pointer_size_matching", PRECISE_POINTER_SIZE_MATCHING, + "1.32.0", ISSUE_SOME (56354), EDITION_NONE) +FEATURE_ACTIVE ("ffi_returns_twice", FFI_RETURNS_TWICE, "1.34.0", + ISSUE_SOME (58314), EDITION_NONE) +FEATURE_ACTIVE ("const_generics", CONST_GENERICS, "1.34.0", ISSUE_SOME (44580), + EDITION_NONE) +FEATURE_ACTIVE ("optimize_attribute", OPTIMIZE_ATTRIBUTE, "1.34.0", + ISSUE_SOME (54882), EDITION_NONE) +FEATURE_ACTIVE ("c_variadic", C_VARIADIC, "1.34.0", ISSUE_SOME (44930), + EDITION_NONE) +FEATURE_ACTIVE ("associated_type_bounds", ASSOCIATED_TYPE_BOUNDS, "1.34.0", + ISSUE_SOME (52662), EDITION_NONE) +FEATURE_ACTIVE ("let_chains", LET_CHAINS, "1.37.0", ISSUE_SOME (53667), + EDITION_NONE) +FEATURE_ACTIVE ("transparent_unions", TRANSPARENT_UNIONS, "1.37.0", + ISSUE_SOME (60405), EDITION_NONE) +FEATURE_ACTIVE ("arbitrary_enum_discriminant", ARBITRARY_ENUM_DISCRIMINANT, + "1.37.0", ISSUE_SOME (60553), EDITION_NONE) +FEATURE_ACTIVE ("member_constraints", MEMBER_CONSTRAINTS, "1.37.0", + ISSUE_SOME (61997), EDITION_NONE) +FEATURE_ACTIVE ("async_closure", ASYNC_CLOSURE, "1.37.0", ISSUE_SOME (62290), + EDITION_NONE) +FEATURE_ACTIVE ("const_in_array_repeat_expressions", + CONST_IN_ARRAY_REPEAT_EXPRESSIONS, "1.37.0", ISSUE_SOME (49147), + EDITION_NONE) +FEATURE_ACTIVE ("type_alias_impl_trait", TYPE_ALIAS_IMPL_TRAIT, "1.38.0", + ISSUE_SOME (63063), EDITION_NONE) +FEATURE_ACTIVE ("or_patterns", OR_PATTERNS, "1.38.0", ISSUE_SOME (54883), + EDITION_NONE) +FEATURE_ACTIVE ("const_extern_fn", CONST_EXTERN_FN, "1.40.0", + ISSUE_SOME (64926), EDITION_NONE) +FEATURE_ACTIVE ("raw_dylib", RAW_DYLIB, "1.40.0", ISSUE_SOME (58713), + EDITION_NONE) +FEATURE_ACTIVE ("object_safe_for_dispatch", OBJECT_SAFE_FOR_DISPATCH, "1.40.0", + ISSUE_SOME (43561), EDITION_NONE) +FEATURE_ACTIVE ("abi_efiapi", ABI_EFIAPI, "1.40.0", ISSUE_SOME (65815), + EDITION_NONE) +FEATURE_ACTIVE ("raw_ref_op", RAW_REF_OP, "1.41.0", ISSUE_SOME (64490), + EDITION_NONE) +FEATURE_ACTIVE ("never_type_fallback", NEVER_TYPE_FALLBACK, "1.41.0", + ISSUE_SOME (65992), EDITION_NONE) +FEATURE_ACTIVE ("register_attr", REGISTER_ATTR, "1.41.0", ISSUE_SOME (66080), + EDITION_NONE) +FEATURE_ACTIVE ("register_tool", REGISTER_TOOL, "1.41.0", ISSUE_SOME (66079), + EDITION_NONE) +FEATURE_ACTIVE ("cfg_sanitize", CFG_SANITIZE, "1.41.0", ISSUE_SOME (39699), + EDITION_NONE) +FEATURE_ACTIVE ("half_open_range_patterns", HALF_OPEN_RANGE_PATTERNS, "1.41.0", + ISSUE_SOME (67264), EDITION_NONE) +FEATURE_ACTIVE ("const_mut_refs", CONST_MUT_REFS, "1.41.0", ISSUE_SOME (57349), + EDITION_NONE) +FEATURE_ACTIVE ("bindings_after_at", BINDINGS_AFTER_AT, "1.41.0", + ISSUE_SOME (65490), EDITION_NONE) +FEATURE_ACTIVE ("const_trait_impl", CONST_TRAIT_IMPL, "1.42.0", + ISSUE_SOME (67792), EDITION_NONE) +FEATURE_ACTIVE ("const_trait_bound_opt_out", CONST_TRAIT_BOUND_OPT_OUT, + "1.42.0", ISSUE_SOME (67794), EDITION_NONE) +FEATURE_ACTIVE ("no_sanitize", NO_SANITIZE, "1.42.0", ISSUE_SOME (39699), + EDITION_NONE) +FEATURE_ACTIVE ("const_eval_limit", CONST_EVAL_LIMIT, "1.43.0", + ISSUE_SOME (67217), EDITION_NONE) +FEATURE_ACTIVE ("negative_impls", NEGATIVE_IMPLS, "1.44.0", ISSUE_SOME (68318), + EDITION_NONE) +FEATURE_ACTIVE ("target_feature_11", TARGET_FEATURE_11, "1.45.0", + ISSUE_SOME (69098), EDITION_NONE) +FEATURE_ACTIVE ("cfg_version", CFG_VERSION, "1.45.0", ISSUE_SOME (64796), + EDITION_NONE) +FEATURE_ACTIVE ("ffi_pure", FFI_PURE, "1.45.0", ISSUE_SOME (58329), + EDITION_NONE) +FEATURE_ACTIVE ("ffi_const", FFI_CONST, "1.45.0", ISSUE_SOME (58328), + EDITION_NONE) +FEATURE_ACTIVE ("unsafe_block_in_unsafe_fn", UNSAFE_BLOCK_IN_UNSAFE_FN, + "1.45.0", ISSUE_SOME (71668), EDITION_NONE) +FEATURE_ACTIVE ("abi_avr_interrupt", ABI_AVR_INTERRUPT, "1.45.0", + ISSUE_SOME (69664), EDITION_NONE) +FEATURE_ACTIVE ("const_precise_live_drops", CONST_PRECISE_LIVE_DROPS, "1.46.0", + ISSUE_SOME (73255), EDITION_NONE) +FEATURE_ACTIVE ("format_args_capture", FORMAT_ARGS_CAPTURE, "1.46.0", + ISSUE_SOME (67984), EDITION_NONE) +FEATURE_ACTIVE ("lazy_normalization_consts", LAZY_NORMALIZATION_CONSTS, + "1.46.0", ISSUE_SOME (72219), EDITION_NONE) +FEATURE_ACTIVE ("const_fn_transmute", CONST_FN_TRANSMUTE, "1.46.0", + ISSUE_SOME (53605), EDITION_NONE) +FEATURE_ACTIVE ("min_const_generics", MIN_CONST_GENERICS, "1.47.0", + ISSUE_SOME (74878), EDITION_NONE) +FEATURE_ACTIVE ("if_let_guard", IF_LET_GUARD, "1.47.0", ISSUE_SOME (51114), + EDITION_NONE) +FEATURE_ACTIVE ("const_evaluatable_checked", CONST_EVALUATABLE_CHECKED, + "1.48.0", ISSUE_SOME (76560), EDITION_NONE) +FEATURE_ACTIVE ("const_fn_floating_point_arithmetic", + CONST_FN_FLOATING_POINT_ARITHMETIC, "1.48.0", + ISSUE_SOME (57241), EDITION_NONE) +FEATURE_ACTIVE ("const_fn_fn_ptr_basics", CONST_FN_FN_PTR_BASICS, "1.48.0", + ISSUE_SOME (57563), EDITION_NONE) +FEATURE_ACTIVE ("cmse_nonsecure_entry", CMSE_NONSECURE_ENTRY, "1.48.0", + ISSUE_SOME (75835), EDITION_NONE) +FEATURE_ACTIVE ("default_alloc_error_handler", DEFAULT_ALLOC_ERROR_HANDLER, + "1.48.0", ISSUE_SOME (66741), EDITION_NONE) +FEATURE_ACTIVE ("const_impl_trait", CONST_IMPL_TRAIT, "1.48.0", + ISSUE_SOME (77463), EDITION_NONE) +FEATURE_ACTIVE ("isa_attribute", ISA_ATTRIBUTE, "1.48.0", ISSUE_SOME (74727), + EDITION_NONE) +FEATURE_ACTIVE ("inline_const", INLINE_CONST, "1.49.0", ISSUE_SOME (76001), + EDITION_NONE) +FEATURE_ACTIVE ("unsized_fn_params", UNSIZED_FN_PARAMS, "1.49.0", + ISSUE_SOME (48055), EDITION_NONE) +FEATURE_ACTIVE ("destructuring_assignment", DESTRUCTURING_ASSIGNMENT, "1.49.0", + ISSUE_SOME (71126), EDITION_NONE) +FEATURE_ACTIVE ("cfg_panic", CFG_PANIC, "1.49.0", ISSUE_SOME (77443), + EDITION_NONE) +FEATURE_REMOVED ("import_shadowing", IMPORT_SHADOWING, "1.0.0", ISSUE_NONE, + REASON_NONE) +FEATURE_REMOVED ("managed_boxes", MANAGED_BOXES, "1.0.0", ISSUE_NONE, + REASON_NONE) +FEATURE_REMOVED ("negate_unsigned", NEGATE_UNSIGNED, "1.0.0", + ISSUE_SOME (29645), REASON_NONE) +FEATURE_REMOVED ("reflect", REFLECT, "1.0.0", ISSUE_SOME (27749), REASON_NONE) +FEATURE_REMOVED ("opt_out_copy", OPT_OUT_COPY, "1.0.0", ISSUE_NONE, REASON_NONE) +FEATURE_REMOVED ("quad_precision_float", QUAD_PRECISION_FLOAT, "1.0.0", + ISSUE_NONE, REASON_NONE) +FEATURE_REMOVED ("struct_inherit", STRUCT_INHERIT, "1.0.0", ISSUE_NONE, + REASON_NONE) +FEATURE_REMOVED ("test_removed_feature", TEST_REMOVED_FEATURE, "1.0.0", + ISSUE_NONE, REASON_NONE) +FEATURE_REMOVED ("visible_private_types", VISIBLE_PRIVATE_TYPES, "1.0.0", + ISSUE_NONE, REASON_NONE) +FEATURE_REMOVED ("unsafe_no_drop_flag", UNSAFE_NO_DROP_FLAG, "1.0.0", + ISSUE_NONE, REASON_NONE) +FEATURE_REMOVED ("unmarked_api", UNMARKED_API, "1.0.0", ISSUE_NONE, REASON_NONE) +FEATURE_REMOVED ("allocator", ALLOCATOR, "1.0.0", ISSUE_NONE, REASON_NONE) +FEATURE_REMOVED ("simd", SIMD, "1.0.0", ISSUE_SOME (27731), + REASON_SOME ("removed in favor of `#[repr(simd)]`")) +FEATURE_REMOVED ("advanced_slice_patterns", ADVANCED_SLICE_PATTERNS, "1.0.0", + ISSUE_SOME (62254), + REASON_SOME ("merged into `#![feature(slice_patterns)]`")) +FEATURE_REMOVED ("macro_reexport", MACRO_REEXPORT, "1.0.0", ISSUE_SOME (29638), + REASON_SOME ("subsumed by `pub use`")) +FEATURE_REMOVED ( + "custom_attribute", CUSTOM_ATTRIBUTE, "1.0.0", ISSUE_SOME (29642), + REASON_SOME ( + "removed in favor of `#![register_tool]` and `#![register_attr]`")) +FEATURE_REMOVED ("pushpop_unsafe", PUSHPOP_UNSAFE, "1.2.0", ISSUE_NONE, + REASON_NONE) +FEATURE_REMOVED ("needs_allocator", NEEDS_ALLOCATOR, "1.4.0", + ISSUE_SOME (27389), + REASON_SOME ("subsumed by `#![feature(allocator_internals)]`")) +FEATURE_REMOVED ("sanitizer_runtime", SANITIZER_RUNTIME, "1.17.0", ISSUE_NONE, + REASON_NONE) +FEATURE_REMOVED ("proc_macro_mod", PROC_MACRO_MOD, "1.27.0", ISSUE_SOME (54727), + REASON_SOME ("subsumed by `#![feature(proc_macro_hygiene)]`")) +FEATURE_REMOVED ("proc_macro_expr", PROC_MACRO_EXPR, "1.27.0", + ISSUE_SOME (54727), + REASON_SOME ("subsumed by `#![feature(proc_macro_hygiene)]`")) +FEATURE_REMOVED ("proc_macro_non_items", PROC_MACRO_NON_ITEMS, "1.27.0", + ISSUE_SOME (54727), + REASON_SOME ("subsumed by `#![feature(proc_macro_hygiene)]`")) +FEATURE_REMOVED ("proc_macro_gen", PROC_MACRO_GEN, "1.27.0", ISSUE_SOME (54727), + REASON_SOME ("subsumed by `#![feature(proc_macro_hygiene)]`")) +FEATURE_REMOVED ("panic_implementation", PANIC_IMPLEMENTATION, "1.28.0", + ISSUE_SOME (44489), + REASON_SOME ("subsumed by `#[panic_handler]`")) +FEATURE_REMOVED ("custom_derive", CUSTOM_DERIVE, "1.32.0", ISSUE_SOME (29644), + REASON_SOME ("subsumed by `#[proc_macro_derive]`")) +FEATURE_REMOVED ("extern_in_paths", EXTERN_IN_PATHS, "1.33.0", + ISSUE_SOME (55600), + REASON_SOME ("subsumed by `::foo::bar` paths")) +FEATURE_REMOVED ("quote", QUOTE, "1.33.0", ISSUE_SOME (29601), REASON_NONE) +FEATURE_REMOVED ("dropck_parametricity", DROPCK_PARAMETRICITY, "1.38.0", + ISSUE_SOME (28498), REASON_NONE) +FEATURE_REMOVED ("await_macro", AWAIT_MACRO, "1.38.0", ISSUE_SOME (50547), + REASON_SOME ("subsumed by `.await` syntax")) +FEATURE_REMOVED ( + "existential_type", EXISTENTIAL_TYPE, "1.38.0", ISSUE_SOME (63063), + REASON_SOME ("removed in favor of `#![feature(type_alias_impl_trait)]`")) +FEATURE_REMOVED ("rustc_diagnostic_macros", RUSTC_DIAGNOSTIC_MACROS, "1.38.0", + ISSUE_NONE, REASON_NONE) +FEATURE_REMOVED ("on_unimplemented", ON_UNIMPLEMENTED, "1.40.0", ISSUE_NONE, + REASON_NONE) +FEATURE_REMOVED ( + "overlapping_marker_traits", OVERLAPPING_MARKER_TRAITS, "1.42.0", + ISSUE_SOME (29864), + REASON_SOME ("removed in favor of `#![feature(marker_trait_attr)]`")) +FEATURE_REMOVED ("no_debug", F_NO_DEBUG, "1.43.0", ISSUE_SOME (29721), + REASON_SOME ("removed due to lack of demand")) +FEATURE_REMOVED ( + "const_compare_raw_pointers", CONST_COMPARE_RAW_POINTERS, "1.46.0", + ISSUE_SOME (53020), + REASON_SOME ("cannot be allowed in const eval in any meaningful way")) +FEATURE_STABLE_REMOVED ("no_stack_check", NO_STACK_CHECK, "1.0.0", ISSUE_NONE) diff --git a/gcc/rust/checks/errors/feature/rust-feature-gate.cc b/gcc/rust/checks/errors/feature/rust-feature-gate.cc index 44007f99e5cf..b2a6b6c64812 100644 --- a/gcc/rust/checks/errors/feature/rust-feature-gate.cc +++ b/gcc/rust/checks/errors/feature/rust-feature-gate.cc @@ -82,7 +82,7 @@ FeatureGate::gate (Feature::Name name, location_t loc, { if (!valid_features.count (name)) { - auto feature = Feature::create (name); + auto &feature = Feature::lookup (name); if (auto issue = feature.issue ()) { auto issue_number = issue.value (); @@ -184,7 +184,7 @@ void FeatureGate::visit (AST::Trait &trait) { if (trait.is_auto ()) - gate (Feature::Name::AUTO_TRAITS, trait.get_locus (), + gate (Feature::Name::OPTIN_BUILTIN_TRAITS, trait.get_locus (), "auto traits are experimental and possibly buggy"); AST::DefaultASTVisitor::visit (trait); } diff --git a/gcc/rust/checks/errors/feature/rust-feature.cc b/gcc/rust/checks/errors/feature/rust-feature.cc index 071d3f8c0d97..7fc5cb047975 100644 --- a/gcc/rust/checks/errors/feature/rust-feature.cc +++ b/gcc/rust/checks/errors/feature/rust-feature.cc @@ -20,70 +20,58 @@ namespace Rust { -Feature -Feature::create (Feature::Name f) -{ - switch (f) - { - case Feature::Name::ASSOCIATED_TYPE_BOUNDS: - return Feature (Feature::Name::ASSOCIATED_TYPE_BOUNDS, - Feature::State::ACCEPTED, "associated_type_bounds", - "1.34.0", 52662); - case Feature::Name::INTRINSICS: - return Feature (f, Feature::State::ACCEPTED, "intrinsics", "1.0.0"); - case Feature::Name::RUSTC_ATTRS: - return Feature (f, Feature::State::ACCEPTED, "rustc_attrs", "1.0.0"); - case Feature::Name::DECL_MACRO: - return Feature (f, Feature::State::ACCEPTED, "decl_macro", "1.0.0", - 39412); - case Feature::Name::EXTERN_TYPES: - return Feature (f, Feature::State::ACTIVE, "extern_types", "1.23.0", - 43467); - case Feature::Name::NEGATIVE_IMPLS: - return Feature (f, Feature::State::ACTIVE, "negative_impls", "1.0.0", - 68318); - case Feature::Name::BOX_SYNTAX: - return Feature (f, Feature::State::ACTIVE, "box_syntax", "1.0.0", 49733); - case Feature::Name::DROPCK_EYEPATCH: - return Feature (f, Feature::State::ACTIVE, "dropck_eyepatch", "1.10.0", - 34761); - case Feature::Name::RAW_REF_OP: - return Feature (f, Feature::State::ACTIVE, "raw_ref_op", "1.41.0", 64490); - case Feature::Name::EXCLUSIVE_RANGE_PATTERN: - return Feature (Feature::Name::EXCLUSIVE_RANGE_PATTERN, - Feature::State::ACTIVE, "exclusive_range_pattern", - "1.11.0", 37854); - case Feature::Name::PRELUDE_IMPORT: - return Feature (f, Feature::State::ACTIVE, "prelude_import", "1.0.0"); - case Feature::Name::MIN_SPECIALIZATION: - return Feature (f, Feature::State::ACTIVE, "min_specialization", - "1.0.0" /* FIXME: What version here? */, 31844); - case Feature::Name::AUTO_TRAITS: - return Feature (f, Feature::State::ACTIVE, "optin_builtin_traits", - "1.0.0", 13231); - default: - rust_unreachable (); - } -} +Feature Feature::feature_list[] = { +#define ISSUE_SOME(n) n +#define ISSUE_NONE tl::nullopt +#define EDITION_2018 Edition::E2018 +#define EDITION_NONE tl::nullopt +#define REASON_SOME(r) r +#define REASON_NONE tl::nullopt + +#define FEATURE_BASE(state, name_str, name, rust_since, issue, ...) \ + Feature (Feature::Name::name, Feature::State::state, name_str, rust_since, \ + issue, __VA_ARGS__), + +#define FEATURE_ACTIVE(a, b, c, d, edition) \ + FEATURE_BASE (ACTIVE, a, b, c, d, edition, tl::nullopt) + +#define FEATURE_ACCEPTED(a, b, c, d) \ + FEATURE_BASE (ACCEPTED, a, b, c, d, tl::nullopt, tl::nullopt) + +#define FEATURE_REMOVED(a, b, c, d, reason) \ + FEATURE_BASE (REMOVED, a, b, c, d, tl::nullopt, reason) + +#define FEATURE_STABLE_REMOVED(a, b, c, d) \ + FEATURE_BASE (ACCEPTED, a, b, c, d, tl::nullopt, tl::nullopt) + +#include "rust-feature-defs.h" + +#undef ISSUE_SOME +#undef ISSUE_NONE +#undef EDITION_2018 +#undef EDITION_NONE +#undef REASON_SOME +#undef REASON_NONE + +#undef FEATURE_BASE +#undef FEATURE_ACTIVE +#undef FEATURE_ACCEPTED +#undef FEATURE_REMOVED +#undef FEATURE_STABLE_REMOVED +}; const std::map Feature::name_hash_map = { - {"associated_type_bounds", Feature::Name::ASSOCIATED_TYPE_BOUNDS}, - {"intrinsics", Feature::Name::INTRINSICS}, - {"rustc_attrs", Feature::Name::RUSTC_ATTRS}, - {"decl_macro", Feature::Name::DECL_MACRO}, - {"negative_impls", Feature::Name::NEGATIVE_IMPLS}, - // TODO: Rename to "auto_traits" when supporting - // later Rust versions - {"optin_builtin_traits", Feature::Name::AUTO_TRAITS}, - {"extern_types", Feature::Name::EXTERN_TYPES}, - {"lang_items", Feature::Name::LANG_ITEMS}, - {"no_core", Feature::Name::NO_CORE}, - {"box_syntax", Feature::Name::BOX_SYNTAX}, - {"dropck_eyepatch", Feature::Name::DROPCK_EYEPATCH}, - {"raw_ref_op", Feature::Name::RAW_REF_OP}, - {"exclusive_range_pattern", Feature::Name::EXCLUSIVE_RANGE_PATTERN}, - {"prelude_import", Feature::Name::PRELUDE_IMPORT}, - {"min_specialization", Feature::Name::MIN_SPECIALIZATION}, +#define FEATURE(s, name, ...) {s, Feature::Name::name}, +#define FEATURE_ACTIVE(...) FEATURE (__VA_ARGS__) +#define FEATURE_ACCEPTED(...) FEATURE (__VA_ARGS__) +#define FEATURE_REMOVED(...) FEATURE (__VA_ARGS__) +#define FEATURE_STABLE_REMOVED(...) FEATURE (__VA_ARGS__) +#include "rust-feature-defs.h" +#undef FEATURE +#undef FEATURE_ACTIVE +#undef FEATURE_ACCEPTED +#undef FEATURE_REMOVED +#undef FEATURE_STABLE_REMOVED }; tl::optional @@ -95,4 +83,17 @@ Feature::as_name (const std::string &name) return tl::nullopt; } +tl::optional> +Feature::lookup (const std::string &name) +{ + return as_name (name).map ( + [] (Name n) { return std::ref (Feature::lookup (n)); }); +} + +const Feature & +Feature::lookup (Feature::Name name) +{ + return feature_list[static_cast (name)]; +} + } // namespace Rust diff --git a/gcc/rust/checks/errors/feature/rust-feature.h b/gcc/rust/checks/errors/feature/rust-feature.h index e7cb0afc6895..8686cf4b3b76 100644 --- a/gcc/rust/checks/errors/feature/rust-feature.h +++ b/gcc/rust/checks/errors/feature/rust-feature.h @@ -29,59 +29,55 @@ class Feature public: enum class State { - ACCEPTED, - ACTIVE, - REMOVED, - STABILIZED, + ACCEPTED, // stabilized + ACTIVE, // unstable + REMOVED, // removed + STABILIZED, // removed after stabilization }; enum class Name { - ASSOCIATED_TYPE_BOUNDS, - INTRINSICS, - NEGATIVE_IMPLS, - RUSTC_ATTRS, - DECL_MACRO, - AUTO_TRAITS, - EXTERN_TYPES, - LANG_ITEMS, - NO_CORE, - BOX_SYNTAX, - DROPCK_EYEPATCH, - RAW_REF_OP, - EXCLUSIVE_RANGE_PATTERN, - PRELUDE_IMPORT, - MIN_SPECIALIZATION, +#define FEATURE_ACTIVE(x, name, ...) name, +#define FEATURE_ACCEPTED(x, name, ...) name, +#define FEATURE_REMOVED(x, name, ...) name, +#define FEATURE_STABLE_REMOVED(x, name, ...) name, +#include "rust-feature-defs.h" +#undef FEATURE_ACTIVE +#undef FEATURE_ACCEPTED +#undef FEATURE_REMOVED +#undef FEATURE_STABLE_REMOVED }; - const std::string &as_string () { return m_name_str; } - Name name () { return m_name; } - const std::string &description () { return m_description; } - State state () { return m_state; } - tl::optional issue () { return m_issue; } + const std::string &as_string () const { return m_name_str; } + + Name name () const { return m_name; } + State state () const { return m_state; } + tl::optional issue () const { return m_issue; } static tl::optional as_name (const std::string &name); - static Feature create (Name name); + + static tl::optional> + lookup (const std::string &name); + static const Feature &lookup (Name name); private: - Feature (Name name, State state, const char *name_str, - const char *rustc_since, - tl::optional issue_number = tl::nullopt, - const tl::optional &edition = tl::nullopt, - const char *description = "") - : m_state (state), m_name (name), m_name_str (name_str), - m_rustc_since (rustc_since), m_issue (issue_number), edition (edition), - m_description (description) + Feature (Name name, State state, const char *name_str, const char *rust_since, + tl::optional issue_number, tl::optional edition, + tl::optional reason) + : m_name (name), m_state (state), m_name_str (name_str), + m_rust_since (rust_since), m_issue (issue_number), edition (edition), + m_reason (reason) {} - State m_state; Name m_name; + State m_state; std::string m_name_str; - std::string m_rustc_since; + std::string m_rust_since; tl::optional m_issue; tl::optional edition; - std::string m_description; // TODO: Switch to optional? + tl::optional m_reason; + static Feature feature_list[]; static const std::map name_hash_map; };