提交 00920c00 编写于 作者: J Jakub Kozlowski

Stabilize macro_vis_matcher

上级 b3559069
# `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
------------------------
......@@ -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;
......
......@@ -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)]
......
......@@ -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)]
......
......@@ -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)]
......
......@@ -26,7 +26,7 @@
#![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)]
......
......@@ -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))]
......
......@@ -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,
}
}
......
......@@ -342,9 +342,6 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
// 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 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
(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 @@ fn leveled_feature_err<'a>(sess: &'a ParseSess, feature: &str, span: Span, issue
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";
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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"]
......
......@@ -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 ==============================================================
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
// 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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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);
}
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`.
......@@ -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
......
......@@ -16,7 +16,7 @@
// compile-pass
#![feature(macro_vis_matcher)]
#![cfg_attr(stage0, feature(macro_vis_matcher))]
#![allow(unused)]
#![warn(unreachable_pub)]
......
......@@ -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)]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册