From: Owen Avery <[email protected]>
Although this feature is active in rustc 1.50-1.53, our handling of its
feature gate is prone to false positives. Since a target version bump
directly to 1.54 or beyond (where this feature is accepted) would
involve removing our handling of this feature anyways, it makes sense to
do it now to simplify version bumping.
Incidentally removes all parse-time feature gating usage, but the
infrastructure (see Parser::collect_potential_gating_error) is left for
future use.
gcc/rust/ChangeLog:
* checks/errors/feature/rust-feature-collector.cc
(FeatureCollector::collect (Crate)): Do not automatically enable
extended_key_value_attributes when targetting rustc versions
before 1.50.
* checks/errors/feature/rust-feature-defs-rfl.h
(EXTENDED_KEY_VALUE_ATTRIBUTES): Remove feature definition.
* parse/rust-parse-impl-attribute.hxx
(Parser::parse_attr_input): Remove EXTENDED_KEY_VALUE_ATTRIBUTES
feature gate.
gcc/testsuite/ChangeLog:
* rust/compile/doc_macro.rs: Remove explicit enabling of
extended_key_value_attributes feature.
* rust/compile/issues/3661.rs: Likewise.
* rust/compile/early_feature_gate_in_macro.rs: Removed.
* rust/compile/parse_time_feature_gate.rs: Removed.
Signed-off-by: Owen Avery <[email protected]>
Tested on x86_64-pc-linux-gnu.
---
.../errors/feature/rust-feature-collector.cc | 5 ----
.../errors/feature/rust-feature-defs-rfl.h | 2 --
gcc/rust/parse/rust-parse-impl-attribute.hxx | 10 -------
gcc/testsuite/rust/compile/doc_macro.rs | 1 -
.../compile/early_feature_gate_in_macro.rs | 29 -------------------
gcc/testsuite/rust/compile/issues/3661.rs | 1 -
.../rust/compile/parse_time_feature_gate.rs | 18 ------------
7 files changed, 66 deletions(-)
delete mode 100644 gcc/testsuite/rust/compile/early_feature_gate_in_macro.rs
delete mode 100644 gcc/testsuite/rust/compile/parse_time_feature_gate.rs
diff --git a/gcc/rust/checks/errors/feature/rust-feature-collector.cc
b/gcc/rust/checks/errors/feature/rust-feature-collector.cc
index bd5a910d96c..ebef3e30768 100644
--- a/gcc/rust/checks/errors/feature/rust-feature-collector.cc
+++ b/gcc/rust/checks/errors/feature/rust-feature-collector.cc
@@ -33,11 +33,6 @@ FeatureCollector::collect (AST::Crate &crate)
features.valid_lib_features.clear ();
features.crate_id = crate.get_node_id ();
- // TODO: this is a hack, remove when possible
- if (Session::get_instance ().get_compat_version () < 50)
- features.valid_lang_features.insert (
- Feature::Name::EXTENDED_KEY_VALUE_ATTRIBUTES);
-
visit (crate);
return features;
diff --git a/gcc/rust/checks/errors/feature/rust-feature-defs-rfl.h
b/gcc/rust/checks/errors/feature/rust-feature-defs-rfl.h
index 03f54dff6a4..587461961ff 100644
--- a/gcc/rust/checks/errors/feature/rust-feature-defs-rfl.h
+++ b/gcc/rust/checks/errors/feature/rust-feature-defs-rfl.h
@@ -22,8 +22,6 @@
* available in the version targeted by the compiler.
*/
-FEATURE_ACTIVE ("extended_key_value_attributes", EXTENDED_KEY_VALUE_ATTRIBUTES,
- "1.50.0", ISSUE_SOME (78835), EDITION_NONE)
FEATURE_ACTIVE ("cfi_encoding", CFI_ENCODING, "1.71.0", ISSUE_SOME (89653),
EDITION_NONE)
// FIXME: We need to enable this when the compatibility mode is >= 1.60 I
guess?
diff --git a/gcc/rust/parse/rust-parse-impl-attribute.hxx
b/gcc/rust/parse/rust-parse-impl-attribute.hxx
index d473c9e2b9b..03ff4ea02f0 100644
--- a/gcc/rust/parse/rust-parse-impl-attribute.hxx
+++ b/gcc/rust/parse/rust-parse-impl-attribute.hxx
@@ -293,16 +293,6 @@ Parser<ManagedTokenSource>::parse_attr_input ()
t = lexer.peek_token ();
- /* Ensure token is a "literal expression" (literally only a literal
- * token of any type) */
- if (!t->is_literal ())
- {
- Error error (
- t->get_locus (),
- "arbitrary expressions in key-value attributes are unstable");
- collect_potential_gating_error (
- Feature::Name::EXTENDED_KEY_VALUE_ATTRIBUTES, std::move (error));
- }
// attempt to parse macro
// TODO: macros may/may not be allowed in attributes
// this is needed for "#[doc = include_str!(...)]"
diff --git a/gcc/testsuite/rust/compile/doc_macro.rs
b/gcc/testsuite/rust/compile/doc_macro.rs
index e2c84a7e1e0..0d74344f963 100644
--- a/gcc/testsuite/rust/compile/doc_macro.rs
+++ b/gcc/testsuite/rust/compile/doc_macro.rs
@@ -1,7 +1,6 @@
#![feature(rustc_attrs)]
#![feature(no_core)]
#![no_core]
-#![feature(extended_key_value_attributes)]
#![doc = concat!("AB")]
// This macro export should not be required for rust 1.49 because inner
diff --git a/gcc/testsuite/rust/compile/early_feature_gate_in_macro.rs
b/gcc/testsuite/rust/compile/early_feature_gate_in_macro.rs
deleted file mode 100644
index dd68b920e71..00000000000
--- a/gcc/testsuite/rust/compile/early_feature_gate_in_macro.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-// { dg-additional-options "-frust-compat-version=1.50" }
-#![feature(rustc_attrs)]
-#![feature(lang_items)]
-#![feature(no_core)]
-#![no_core]
-
-#[rustc_builtin_macro]
-macro_rules! concat {
- () => {{}};
-}
-
-#[rustc_builtin_macro]
-macro_rules! stringify {
- () => {{}};
-}
-
-macro_rules! prefix_symbol(
- ($prefix : tt, { $($ident: ident, )* }) => {
- $(
- // { dg-error "arbitrary expressions in key-value attributes are
unstable" "" { target *-*-* } .+1 }
- #[export_name = concat!(stringify!($prefix), stringify!($ident))]
- pub extern "C" fn $ident() {
- }
- )*
-});
-
-prefix_symbol!(a,{
- __func0,
-});
diff --git a/gcc/testsuite/rust/compile/issues/3661.rs
b/gcc/testsuite/rust/compile/issues/3661.rs
index 0c8eab3f2eb..253448274f0 100644
--- a/gcc/testsuite/rust/compile/issues/3661.rs
+++ b/gcc/testsuite/rust/compile/issues/3661.rs
@@ -1,6 +1,5 @@
#![feature(no_core)]
#![no_core]
-#![feature(extended_key_value_attributes)]
#![feature(rustc_attrs)]
#[rustc_builtin_macro]
diff --git a/gcc/testsuite/rust/compile/parse_time_feature_gate.rs
b/gcc/testsuite/rust/compile/parse_time_feature_gate.rs
deleted file mode 100644
index 1affcd81a5a..00000000000
--- a/gcc/testsuite/rust/compile/parse_time_feature_gate.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// { dg-additional-options "-frust-compat-version=1.50" }
-#![feature(no_core)]
-#![no_core]
-#![feature(rustc_attrs)]
-
-#[rustc_builtin_macro]
-macro_rules! concat {
- () => {{}};
-}
-
-#[rustc_builtin_macro]
-macro_rules! stringify {
- () => {{}};
-}
-
-// { dg-error "arbitrary expressions in key-value attributes are unstable" ""
{ target *-*-* } .+1 }
-#[export_name = concat!(stringify!(non), stringify!(literal))]
-pub extern "C" fn attribute_test_function() {}
--
2.55.0