Stabilize macro_vis_matcher
This commit is contained in:
parent
b355906919
commit
00920c0024
24 changed files with 22 additions and 82 deletions
|
@ -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
|
|
||||||
|
|
||||||
------------------------
|
|
|
@ -183,7 +183,6 @@ that warns about any item named `lintme`.
|
||||||
```rust,ignore
|
```rust,ignore
|
||||||
#![feature(plugin_registrar)]
|
#![feature(plugin_registrar)]
|
||||||
#![feature(box_syntax, rustc_private)]
|
#![feature(box_syntax, rustc_private)]
|
||||||
#![feature(macro_vis_matcher)]
|
|
||||||
#![feature(macro_at_most_once_rep)]
|
#![feature(macro_at_most_once_rep)]
|
||||||
|
|
||||||
extern crate syntax;
|
extern crate syntax;
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#![feature(drain_filter)]
|
#![feature(drain_filter)]
|
||||||
#![feature(iterator_find_map)]
|
#![feature(iterator_find_map)]
|
||||||
#![cfg_attr(windows, feature(libc))]
|
#![cfg_attr(windows, feature(libc))]
|
||||||
#![feature(macro_vis_matcher)]
|
#![cfg_attr(stage0, feature(macro_vis_matcher))]
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
#![feature(exhaustive_patterns)]
|
#![feature(exhaustive_patterns)]
|
||||||
#![feature(extern_types)]
|
#![feature(extern_types)]
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#![feature(unsize)]
|
#![feature(unsize)]
|
||||||
#![feature(specialization)]
|
#![feature(specialization)]
|
||||||
#![feature(optin_builtin_traits)]
|
#![feature(optin_builtin_traits)]
|
||||||
#![feature(macro_vis_matcher)]
|
#![cfg_attr(stage0, feature(macro_vis_matcher))]
|
||||||
#![cfg_attr(not(stage0), feature(nll))]
|
#![cfg_attr(not(stage0), feature(nll))]
|
||||||
#![feature(allow_internal_unstable)]
|
#![feature(allow_internal_unstable)]
|
||||||
#![feature(vec_resize_with)]
|
#![feature(vec_resize_with)]
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#![cfg_attr(test, feature(test))]
|
#![cfg_attr(test, feature(test))]
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(macro_vis_matcher)]
|
#![cfg_attr(stage0, feature(macro_vis_matcher))]
|
||||||
#![cfg_attr(not(stage0), feature(nll))]
|
#![cfg_attr(not(stage0), feature(nll))]
|
||||||
#![feature(quote)]
|
#![feature(quote)]
|
||||||
#![feature(rustc_diagnostic_macros)]
|
#![feature(rustc_diagnostic_macros)]
|
||||||
|
|
|
@ -26,7 +26,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
#![feature(decl_macro)]
|
#![feature(decl_macro)]
|
||||||
#![feature(macro_vis_matcher)]
|
#![cfg_attr(stage0, feature(macro_vis_matcher))]
|
||||||
#![feature(exhaustive_patterns)]
|
#![feature(exhaustive_patterns)]
|
||||||
#![feature(range_contains)]
|
#![feature(range_contains)]
|
||||||
#![feature(rustc_diagnostic_macros)]
|
#![feature(rustc_diagnostic_macros)]
|
||||||
|
|
|
@ -270,7 +270,7 @@
|
||||||
#![feature(libc)]
|
#![feature(libc)]
|
||||||
#![feature(link_args)]
|
#![feature(link_args)]
|
||||||
#![feature(linkage)]
|
#![feature(linkage)]
|
||||||
#![feature(macro_vis_matcher)]
|
#![cfg_attr(stage0, feature(macro_vis_matcher))]
|
||||||
#![feature(needs_panic_runtime)]
|
#![feature(needs_panic_runtime)]
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
#![cfg_attr(not(stage0), feature(nll))]
|
#![cfg_attr(not(stage0), feature(nll))]
|
||||||
|
|
|
@ -964,7 +964,7 @@ fn is_legal_fragment_specifier(sess: &ParseSess,
|
||||||
frag_span: Span) -> bool {
|
frag_span: Span) -> bool {
|
||||||
match frag_name {
|
match frag_name {
|
||||||
"item" | "block" | "stmt" | "expr" | "pat" | "lifetime" |
|
"item" | "block" | "stmt" | "expr" | "pat" | "lifetime" |
|
||||||
"path" | "ty" | "ident" | "meta" | "tt" | "" => true,
|
"path" | "ty" | "ident" | "meta" | "tt" | "vis" | "" => true,
|
||||||
"literal" => {
|
"literal" => {
|
||||||
if !features.macro_literal_matcher &&
|
if !features.macro_literal_matcher &&
|
||||||
!attr::contains_name(attrs, "allow_internal_unstable") {
|
!attr::contains_name(attrs, "allow_internal_unstable") {
|
||||||
|
@ -977,18 +977,6 @@ fn is_legal_fragment_specifier(sess: &ParseSess,
|
||||||
}
|
}
|
||||||
true
|
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,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -342,9 +342,6 @@ declare_features! (
|
||||||
// Allows overlapping impls of marker traits
|
// Allows overlapping impls of marker traits
|
||||||
(active, overlapping_marker_traits, "1.18.0", Some(29864), None),
|
(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
|
// rustc internal
|
||||||
(active, abi_thiscall, "1.19.0", None, None),
|
(active, abi_thiscall, "1.19.0", None, None),
|
||||||
|
|
||||||
|
@ -648,6 +645,8 @@ declare_features! (
|
||||||
(accepted, repr_transparent, "1.28.0", Some(43036), None),
|
(accepted, repr_transparent, "1.28.0", Some(43036), None),
|
||||||
// Defining procedural macros in `proc-macro` crates
|
// Defining procedural macros in `proc-macro` crates
|
||||||
(accepted, proc_macro, "1.29.0", Some(38356), None),
|
(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`,
|
// Allows importing and reexporting macros with `use`,
|
||||||
// enables macro modularization in general.
|
// enables macro modularization in general.
|
||||||
(accepted, use_extern_macros, "1.30.0", Some(35896), None),
|
(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 =
|
pub const EXPLAIN_DERIVE_UNDERSCORE: &'static str =
|
||||||
"attributes of the form `#[derive_*]` are reserved for the compiler";
|
"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 =
|
pub const EXPLAIN_LITERAL_MATCHER: &'static str =
|
||||||
":literal fragment specifier is experimental and subject to change";
|
":literal fragment specifier is experimental and subject to change";
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#![feature(plugin_registrar, rustc_private)]
|
#![feature(plugin_registrar, rustc_private)]
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(macro_vis_matcher)]
|
#![cfg_attr(stage0, feature(macro_vis_matcher))]
|
||||||
#![feature(macro_at_most_once_rep)]
|
#![feature(macro_at_most_once_rep)]
|
||||||
|
|
||||||
#[macro_use] extern crate rustc;
|
#[macro_use] extern crate rustc;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#![feature(plugin_registrar)]
|
#![feature(plugin_registrar)]
|
||||||
#![feature(box_syntax, rustc_private)]
|
#![feature(box_syntax, rustc_private)]
|
||||||
#![feature(macro_vis_matcher)]
|
#![cfg_attr(stage0, feature(macro_vis_matcher))]
|
||||||
#![feature(macro_at_most_once_rep)]
|
#![feature(macro_at_most_once_rep)]
|
||||||
|
|
||||||
// Load rustc as a plugin to get macros
|
// Load rustc as a plugin to get macros
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#![feature(plugin_registrar)]
|
#![feature(plugin_registrar)]
|
||||||
#![feature(box_syntax, rustc_private)]
|
#![feature(box_syntax, rustc_private)]
|
||||||
#![feature(macro_vis_matcher)]
|
#![cfg_attr(stage0, feature(macro_vis_matcher))]
|
||||||
#![feature(macro_at_most_once_rep)]
|
#![feature(macro_at_most_once_rep)]
|
||||||
|
|
||||||
extern crate syntax;
|
extern crate syntax;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#![feature(plugin_registrar, rustc_private)]
|
#![feature(plugin_registrar, rustc_private)]
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(macro_vis_matcher)]
|
#![cfg_attr(stage0, feature(macro_vis_matcher))]
|
||||||
#![feature(macro_at_most_once_rep)]
|
#![feature(macro_at_most_once_rep)]
|
||||||
|
|
||||||
#[macro_use] extern crate rustc;
|
#[macro_use] extern crate rustc;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(box_syntax, plugin, plugin_registrar, rustc_private)]
|
#![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)]
|
#![feature(macro_at_most_once_rep)]
|
||||||
#![crate_type = "dylib"]
|
#![crate_type = "dylib"]
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(macro_vis_matcher)]
|
#![cfg_attr(stage0, feature(macro_vis_matcher))]
|
||||||
|
|
||||||
//{{{ issue 40569 ==============================================================
|
//{{{ issue 40569 ==============================================================
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![allow(dead_code, unused_imports)]
|
#![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
|
Ensure that `:vis` matches can be captured in existing positions, and passed
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#![feature(plugin_registrar)]
|
#![feature(plugin_registrar)]
|
||||||
#![feature(box_syntax, rustc_private)]
|
#![feature(box_syntax, rustc_private)]
|
||||||
#![feature(macro_vis_matcher)]
|
#![cfg_attr(stage0, feature(macro_vis_matcher))]
|
||||||
#![feature(macro_at_most_once_rep)]
|
#![feature(macro_at_most_once_rep)]
|
||||||
|
|
||||||
// Load rustc as a plugin to get macros
|
// Load rustc as a plugin to get macros
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#![feature(plugin_registrar)]
|
#![feature(plugin_registrar)]
|
||||||
#![feature(box_syntax, rustc_private)]
|
#![feature(box_syntax, rustc_private)]
|
||||||
#![feature(macro_vis_matcher)]
|
#![cfg_attr(stage0, feature(macro_vis_matcher))]
|
||||||
#![feature(macro_at_most_once_rep)]
|
#![feature(macro_at_most_once_rep)]
|
||||||
|
|
||||||
extern crate syntax;
|
extern crate syntax;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#![feature(plugin_registrar)]
|
#![feature(plugin_registrar)]
|
||||||
#![feature(box_syntax, rustc_private)]
|
#![feature(box_syntax, rustc_private)]
|
||||||
#![feature(macro_vis_matcher)]
|
#![cfg_attr(stage0, feature(macro_vis_matcher))]
|
||||||
#![feature(macro_at_most_once_rep)]
|
#![feature(macro_at_most_once_rep)]
|
||||||
|
|
||||||
extern crate syntax;
|
extern crate syntax;
|
||||||
|
|
|
@ -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 <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);
|
|
||||||
}
|
|
|
@ -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`.
|
|
|
@ -8,7 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(macro_vis_matcher)]
|
#![cfg_attr(stage0, feature(macro_vis_matcher))]
|
||||||
|
|
||||||
macro_rules! foo {
|
macro_rules! foo {
|
||||||
($($p:vis)*) => {} //~ ERROR repetition matches empty token tree
|
($($p:vis)*) => {} //~ ERROR repetition matches empty token tree
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
// compile-pass
|
// compile-pass
|
||||||
|
|
||||||
#![feature(macro_vis_matcher)]
|
#![cfg_attr(stage0, feature(macro_vis_matcher))]
|
||||||
|
|
||||||
#![allow(unused)]
|
#![allow(unused)]
|
||||||
#![warn(unreachable_pub)]
|
#![warn(unreachable_pub)]
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// compile-pass
|
// compile-pass
|
||||||
|
|
||||||
#![feature(crate_visibility_modifier)]
|
#![feature(crate_visibility_modifier)]
|
||||||
#![feature(macro_vis_matcher)]
|
#![cfg_attr(stage0, feature(macro_vis_matcher))]
|
||||||
|
|
||||||
#![allow(unused)]
|
#![allow(unused)]
|
||||||
#![warn(unreachable_pub)]
|
#![warn(unreachable_pub)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue