+++ /dev/null
-# `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
-
-------------------------
```rust,ignore
#![feature(plugin_registrar)]
#![feature(box_syntax, rustc_private)]
-#![feature(macro_vis_matcher)]
#![feature(macro_at_most_once_rep)]
extern crate syntax;
#![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)]
#![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)]
#![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)]
#![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)]
#![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))]
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") {
}
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,
}
}
// 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),
(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),
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";
#![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;
#![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
#![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;
#![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;
// 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"]
// 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 ==============================================================
// 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
#![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
#![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;
#![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;
+++ /dev/null
-// 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);
-}
+++ /dev/null
-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`.
// 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
// compile-pass
-#![feature(macro_vis_matcher)]
+#![cfg_attr(stage0, feature(macro_vis_matcher))]
#![allow(unused)]
#![warn(unreachable_pub)]
// compile-pass
#![feature(crate_visibility_modifier)]
-#![feature(macro_vis_matcher)]
+#![cfg_attr(stage0, feature(macro_vis_matcher))]
#![allow(unused)]
#![warn(unreachable_pub)]