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]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.
Commit on github:
https://github.com/Rust-GCC/gccrs/commit/47fe33b0af2cfb5dea2a4d173e0c72752d6211bc
The commit has NOT been mentioned in any issue.
The commit has been mentioned in the following pull-request(s):
- https://github.com/Rust-GCC/gccrs/pull/4952
.../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 bd5a910d9..ebef3e307 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 03f54dff6..587461961 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 d473c9e2b..03ff4ea02 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 e2c84a7e1..0d74344f9 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 dd68b920e..000000000
--- 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 0c8eab3f2..253448274 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 1affcd81a..000000000
--- 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() {}
base-commit: 2ba24ed657e97ef420bf1c51d3a7cc1c64dfbccd
--
2.55.0