From 00920c0024860cec91b71a8a1fe57d1af37938f9 Mon Sep 17 00:00:00 2001 From: Jakub Kozlowski Date: Wed, 15 Aug 2018 00:24:55 +0100 Subject: [PATCH] Stabilize macro_vis_matcher --- .../language-features/macro-vis-matcher.md | 14 -------------- .../src/language-features/plugin.md | 1 - src/librustc/lib.rs | 2 +- src/librustc_data_structures/lib.rs | 2 +- src/librustc_lint/lib.rs | 2 +- src/librustc_mir/lib.rs | 2 +- src/libstd/lib.rs | 2 +- src/libsyntax/ext/tt/macro_rules.rs | 14 +------------- src/libsyntax/feature_gate.rs | 8 ++------ .../auxiliary/lint_for_crate.rs | 2 +- .../auxiliary/lint_group_plugin_test.rs | 2 +- .../auxiliary/lint_plugin_test.rs | 2 +- .../auxiliary/lint_for_crate.rs | 2 +- .../auxiliary/issue-40001-plugin.rs | 2 +- src/test/run-pass/macro-first-set.rs | 2 +- src/test/run-pass/macro-pub-matcher.rs | 3 ++- .../auxiliary/lint_group_plugin_test.rs | 2 +- .../ui-fulldeps/auxiliary/lint_plugin_test.rs | 2 +- .../ui-fulldeps/auxiliary/lint_tool_test.rs | 2 +- .../feature-gate-macro-vis-matcher.rs | 19 ------------------- .../feature-gate-macro-vis-matcher.stderr | 11 ----------- src/test/ui/issues/issue-42755.rs | 2 +- src/test/ui/lint/unreachable_pub-pub_crate.rs | 2 +- src/test/ui/lint/unreachable_pub.rs | 2 +- 24 files changed, 22 insertions(+), 82 deletions(-) delete mode 100644 src/doc/unstable-book/src/language-features/macro-vis-matcher.md delete mode 100644 src/test/ui/feature-gates/feature-gate-macro-vis-matcher.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-macro-vis-matcher.stderr diff --git a/src/doc/unstable-book/src/language-features/macro-vis-matcher.md b/src/doc/unstable-book/src/language-features/macro-vis-matcher.md deleted file mode 100644 index 7918a356843..00000000000 --- a/src/doc/unstable-book/src/language-features/macro-vis-matcher.md +++ /dev/null @@ -1,14 +0,0 @@ -# `macro_vis_matcher` - -The tracking issue for this feature is: [#41022] - -With this feature gate enabled, the [list of fragment specifiers][frags] gains one more entry: - -* `vis`: a visibility qualifier. Examples: nothing (default visibility); `pub`; `pub(crate)`. - -A `vis` variable may be followed by a comma, ident, type, or path. - -[#41022]: https://github.com/rust-lang/rust/issues/41022 -[frags]: ../book/first-edition/macros.html#syntactic-requirements - ------------------------- diff --git a/src/doc/unstable-book/src/language-features/plugin.md b/src/doc/unstable-book/src/language-features/plugin.md index 19ece095090..b408d5d0805 100644 --- a/src/doc/unstable-book/src/language-features/plugin.md +++ b/src/doc/unstable-book/src/language-features/plugin.md @@ -183,7 +183,6 @@ that warns about any item named `lintme`. ```rust,ignore #![feature(plugin_registrar)] #![feature(box_syntax, rustc_private)] -#![feature(macro_vis_matcher)] #![feature(macro_at_most_once_rep)] extern crate syntax; diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index b6f4bd6dc40..c92f7eb5954 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -47,7 +47,7 @@ #![feature(drain_filter)] #![feature(iterator_find_map)] #![cfg_attr(windows, feature(libc))] -#![feature(macro_vis_matcher)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] #![feature(never_type)] #![feature(exhaustive_patterns)] #![feature(extern_types)] diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs index 5699512326a..c3ee48d20f6 100644 --- a/src/librustc_data_structures/lib.rs +++ b/src/librustc_data_structures/lib.rs @@ -25,7 +25,7 @@ #![feature(unsize)] #![feature(specialization)] #![feature(optin_builtin_traits)] -#![feature(macro_vis_matcher)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] #![cfg_attr(not(stage0), feature(nll))] #![feature(allow_internal_unstable)] #![feature(vec_resize_with)] diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 801604d1379..15eb4730c1d 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -26,7 +26,7 @@ #![cfg_attr(test, feature(test))] #![feature(box_patterns)] #![feature(box_syntax)] -#![feature(macro_vis_matcher)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] #![cfg_attr(not(stage0), feature(nll))] #![feature(quote)] #![feature(rustc_diagnostic_macros)] diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index bda80ff562c..19fc087f128 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -26,7 +26,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment! #![feature(const_fn)] #![feature(core_intrinsics)] #![feature(decl_macro)] -#![feature(macro_vis_matcher)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] #![feature(exhaustive_patterns)] #![feature(range_contains)] #![feature(rustc_diagnostic_macros)] diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index b0069f826ee..ade297219d2 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -270,7 +270,7 @@ #![feature(libc)] #![feature(link_args)] #![feature(linkage)] -#![feature(macro_vis_matcher)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] #![feature(needs_panic_runtime)] #![feature(never_type)] #![cfg_attr(not(stage0), feature(nll))] diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 770561fe326..2c738ac2a04 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -964,7 +964,7 @@ fn is_legal_fragment_specifier(sess: &ParseSess, frag_span: Span) -> bool { match frag_name { "item" | "block" | "stmt" | "expr" | "pat" | "lifetime" | - "path" | "ty" | "ident" | "meta" | "tt" | "" => true, + "path" | "ty" | "ident" | "meta" | "tt" | "vis" | "" => true, "literal" => { if !features.macro_literal_matcher && !attr::contains_name(attrs, "allow_internal_unstable") { @@ -977,18 +977,6 @@ fn is_legal_fragment_specifier(sess: &ParseSess, } true }, - "vis" => { - if !features.macro_vis_matcher && - !attr::contains_name(attrs, "allow_internal_unstable") { - let explain = feature_gate::EXPLAIN_VIS_MATCHER; - emit_feature_err(sess, - "macro_vis_matcher", - frag_span, - GateIssue::Language, - explain); - } - true - }, _ => false, } } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index e8245a553eb..9e80564f579 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -342,9 +342,6 @@ declare_features! ( // Allows overlapping impls of marker traits (active, overlapping_marker_traits, "1.18.0", Some(29864), None), - // Allows use of the :vis macro fragment specifier - (active, macro_vis_matcher, "1.18.0", Some(41022), None), - // rustc internal (active, abi_thiscall, "1.19.0", None, None), @@ -648,6 +645,8 @@ declare_features! ( (accepted, repr_transparent, "1.28.0", Some(43036), None), // Defining procedural macros in `proc-macro` crates (accepted, proc_macro, "1.29.0", Some(38356), None), + // Allows use of the :vis macro fragment specifier + (accepted, macro_vis_matcher, "1.29.0", Some(41022), None), // Allows importing and reexporting macros with `use`, // enables macro modularization in general. (accepted, use_extern_macros, "1.30.0", Some(35896), None), @@ -1363,9 +1362,6 @@ pub const EXPLAIN_DEPR_CUSTOM_DERIVE: &'static str = pub const EXPLAIN_DERIVE_UNDERSCORE: &'static str = "attributes of the form `#[derive_*]` are reserved for the compiler"; -pub const EXPLAIN_VIS_MATCHER: &'static str = - ":vis fragment specifier is experimental and subject to change"; - pub const EXPLAIN_LITERAL_MATCHER: &'static str = ":literal fragment specifier is experimental and subject to change"; diff --git a/src/test/compile-fail-fulldeps/auxiliary/lint_for_crate.rs b/src/test/compile-fail-fulldeps/auxiliary/lint_for_crate.rs index 7303af73cac..c965a3ed86c 100644 --- a/src/test/compile-fail-fulldeps/auxiliary/lint_for_crate.rs +++ b/src/test/compile-fail-fulldeps/auxiliary/lint_for_crate.rs @@ -12,7 +12,7 @@ #![feature(plugin_registrar, rustc_private)] #![feature(box_syntax)] -#![feature(macro_vis_matcher)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] #![feature(macro_at_most_once_rep)] #[macro_use] extern crate rustc; diff --git a/src/test/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs b/src/test/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs index 3f3997726c9..8ccb5878c40 100644 --- a/src/test/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs +++ b/src/test/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs @@ -12,7 +12,7 @@ #![feature(plugin_registrar)] #![feature(box_syntax, rustc_private)] -#![feature(macro_vis_matcher)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] #![feature(macro_at_most_once_rep)] // Load rustc as a plugin to get macros diff --git a/src/test/compile-fail-fulldeps/auxiliary/lint_plugin_test.rs b/src/test/compile-fail-fulldeps/auxiliary/lint_plugin_test.rs index ab39709c529..315dad7eea5 100644 --- a/src/test/compile-fail-fulldeps/auxiliary/lint_plugin_test.rs +++ b/src/test/compile-fail-fulldeps/auxiliary/lint_plugin_test.rs @@ -12,7 +12,7 @@ #![feature(plugin_registrar)] #![feature(box_syntax, rustc_private)] -#![feature(macro_vis_matcher)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] #![feature(macro_at_most_once_rep)] extern crate syntax; diff --git a/src/test/run-pass-fulldeps/auxiliary/lint_for_crate.rs b/src/test/run-pass-fulldeps/auxiliary/lint_for_crate.rs index fa208e14b7d..601003827c6 100644 --- a/src/test/run-pass-fulldeps/auxiliary/lint_for_crate.rs +++ b/src/test/run-pass-fulldeps/auxiliary/lint_for_crate.rs @@ -12,7 +12,7 @@ #![feature(plugin_registrar, rustc_private)] #![feature(box_syntax)] -#![feature(macro_vis_matcher)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] #![feature(macro_at_most_once_rep)] #[macro_use] extern crate rustc; diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs index 56c163b8ce3..fe9ac5fd635 100644 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs +++ b/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs @@ -9,7 +9,7 @@ // except according to those terms. #![feature(box_syntax, plugin, plugin_registrar, rustc_private)] -#![feature(macro_vis_matcher)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] #![feature(macro_at_most_once_rep)] #![crate_type = "dylib"] diff --git a/src/test/run-pass/macro-first-set.rs b/src/test/run-pass/macro-first-set.rs index c371a33257f..9216040ab6e 100644 --- a/src/test/run-pass/macro-first-set.rs +++ b/src/test/run-pass/macro-first-set.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(macro_vis_matcher)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] //{{{ issue 40569 ============================================================== diff --git a/src/test/run-pass/macro-pub-matcher.rs b/src/test/run-pass/macro-pub-matcher.rs index 32145277252..db8331358b9 100644 --- a/src/test/run-pass/macro-pub-matcher.rs +++ b/src/test/run-pass/macro-pub-matcher.rs @@ -9,7 +9,8 @@ // except according to those terms. #![allow(dead_code, unused_imports)] -#![feature(macro_vis_matcher, crate_visibility_modifier)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] +#![feature(crate_visibility_modifier)] /** Ensure that `:vis` matches can be captured in existing positions, and passed diff --git a/src/test/ui-fulldeps/auxiliary/lint_group_plugin_test.rs b/src/test/ui-fulldeps/auxiliary/lint_group_plugin_test.rs index 3f3997726c9..8ccb5878c40 100644 --- a/src/test/ui-fulldeps/auxiliary/lint_group_plugin_test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint_group_plugin_test.rs @@ -12,7 +12,7 @@ #![feature(plugin_registrar)] #![feature(box_syntax, rustc_private)] -#![feature(macro_vis_matcher)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] #![feature(macro_at_most_once_rep)] // Load rustc as a plugin to get macros diff --git a/src/test/ui-fulldeps/auxiliary/lint_plugin_test.rs b/src/test/ui-fulldeps/auxiliary/lint_plugin_test.rs index ab39709c529..315dad7eea5 100644 --- a/src/test/ui-fulldeps/auxiliary/lint_plugin_test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint_plugin_test.rs @@ -12,7 +12,7 @@ #![feature(plugin_registrar)] #![feature(box_syntax, rustc_private)] -#![feature(macro_vis_matcher)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] #![feature(macro_at_most_once_rep)] extern crate syntax; diff --git a/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs b/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs index 01fa2f3459e..d7895bd8781 100644 --- a/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs @@ -10,7 +10,7 @@ #![feature(plugin_registrar)] #![feature(box_syntax, rustc_private)] -#![feature(macro_vis_matcher)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] #![feature(macro_at_most_once_rep)] extern crate syntax; diff --git a/src/test/ui/feature-gates/feature-gate-macro-vis-matcher.rs b/src/test/ui/feature-gates/feature-gate-macro-vis-matcher.rs deleted file mode 100644 index 5d6f2acea83..00000000000 --- a/src/test/ui/feature-gates/feature-gate-macro-vis-matcher.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that the MSP430 interrupt ABI cannot be used when msp430_interrupt -// feature gate is not used. - -macro_rules! m { ($v:vis) => {} } -//~^ ERROR :vis fragment specifier is experimental and subject to change - -fn main() { - m!(pub); -} diff --git a/src/test/ui/feature-gates/feature-gate-macro-vis-matcher.stderr b/src/test/ui/feature-gates/feature-gate-macro-vis-matcher.stderr deleted file mode 100644 index 9d98091674e..00000000000 --- a/src/test/ui/feature-gates/feature-gate-macro-vis-matcher.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0658]: :vis fragment specifier is experimental and subject to change (see issue #41022) - --> $DIR/feature-gate-macro-vis-matcher.rs:14:19 - | -LL | macro_rules! m { ($v:vis) => {} } - | ^^^^^^ - | - = help: add #![feature(macro_vis_matcher)] to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/issues/issue-42755.rs b/src/test/ui/issues/issue-42755.rs index 7547c4a17be..dd53a1c71a5 100644 --- a/src/test/ui/issues/issue-42755.rs +++ b/src/test/ui/issues/issue-42755.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(macro_vis_matcher)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] macro_rules! foo { ($($p:vis)*) => {} //~ ERROR repetition matches empty token tree diff --git a/src/test/ui/lint/unreachable_pub-pub_crate.rs b/src/test/ui/lint/unreachable_pub-pub_crate.rs index 0a1926f8ae5..0089617b11c 100644 --- a/src/test/ui/lint/unreachable_pub-pub_crate.rs +++ b/src/test/ui/lint/unreachable_pub-pub_crate.rs @@ -16,7 +16,7 @@ // compile-pass -#![feature(macro_vis_matcher)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] #![allow(unused)] #![warn(unreachable_pub)] diff --git a/src/test/ui/lint/unreachable_pub.rs b/src/test/ui/lint/unreachable_pub.rs index 5bb67670d85..7fd4a901090 100644 --- a/src/test/ui/lint/unreachable_pub.rs +++ b/src/test/ui/lint/unreachable_pub.rs @@ -11,7 +11,7 @@ // compile-pass #![feature(crate_visibility_modifier)] -#![feature(macro_vis_matcher)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] #![allow(unused)] #![warn(unreachable_pub)]