From 947f6ca4a1b8a3decc535963addb67864b988277 Mon Sep 17 00:00:00 2001 From: Flavio Percoco Date: Tue, 27 Jan 2015 23:41:25 +0100 Subject: [PATCH] Feature gate macro_reexport. Fixes #20906 --- src/libstd/lib.rs | 2 +- src/libsyntax/feature_gate.rs | 7 +++++++ src/test/auxiliary/macro_reexport_2.rs | 1 + src/test/auxiliary/macro_reexport_2_no_use.rs | 1 + src/test/compile-fail/macro-reexport-malformed-1.rs | 2 ++ src/test/compile-fail/macro-reexport-malformed-2.rs | 2 ++ src/test/compile-fail/macro-reexport-malformed-3.rs | 2 ++ .../compile-fail/macro-reexport-not-locally-visible.rs | 2 ++ 8 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 3a745389e1e..cf93c561091 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -114,7 +114,6 @@ #![feature(old_impl_check)] #![feature(optin_builtin_traits)] #![feature(int_uint)] -#![feature(int_uint)] #![feature(core)] #![feature(libc)] #![feature(alloc)] @@ -123,6 +122,7 @@ #![feature(rand)] #![feature(hash)] #![cfg_attr(test, feature(test))] +#![feature(macro_reexport)] // Don't link to std. We are std. #![no_std] diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 6e797844c18..059838ceb64 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -109,6 +109,9 @@ static KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[ // int and uint are now deprecated ("int_uint", "1.0.0", Active), + // macro reexport needs more discusion and stabilization + ("macro_reexport", Active), + // These are used to test this portion of the compiler, they don't actually // mean anything ("test_accepted_feature", "1.0.0", Accepted), @@ -272,6 +275,10 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { self.gate_feature("plugin", i.span, "compiler plugins are experimental \ and possibly buggy"); + } else if attr::contains_name(&i.attrs[], "macro_reexport") { + self.gate_feature("macro_reexport", i.span, + "macros reexports are experimental \ + and possibly buggy"); } } diff --git a/src/test/auxiliary/macro_reexport_2.rs b/src/test/auxiliary/macro_reexport_2.rs index 15d9f9cc914..3918be88d86 100644 --- a/src/test/auxiliary/macro_reexport_2.rs +++ b/src/test/auxiliary/macro_reexport_2.rs @@ -9,6 +9,7 @@ // except according to those terms. #![crate_type = "dylib"] +#![feature(macro_reexport)] #[macro_reexport(reexported)] #[macro_use] #[no_link] diff --git a/src/test/auxiliary/macro_reexport_2_no_use.rs b/src/test/auxiliary/macro_reexport_2_no_use.rs index 63142b0a699..1d3dc26b0b4 100644 --- a/src/test/auxiliary/macro_reexport_2_no_use.rs +++ b/src/test/auxiliary/macro_reexport_2_no_use.rs @@ -9,6 +9,7 @@ // except according to those terms. #![crate_type = "dylib"] +#![feature(macro_reexport)] #[macro_reexport(reexported)] #[no_link] diff --git a/src/test/compile-fail/macro-reexport-malformed-1.rs b/src/test/compile-fail/macro-reexport-malformed-1.rs index b9f754b2778..6c85cf5c7f5 100644 --- a/src/test/compile-fail/macro-reexport-malformed-1.rs +++ b/src/test/compile-fail/macro-reexport-malformed-1.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(macro_reexport)] + #[macro_reexport] //~ ERROR bad macro reexport extern crate std; diff --git a/src/test/compile-fail/macro-reexport-malformed-2.rs b/src/test/compile-fail/macro-reexport-malformed-2.rs index 9ced5be8479..1dd0168181f 100644 --- a/src/test/compile-fail/macro-reexport-malformed-2.rs +++ b/src/test/compile-fail/macro-reexport-malformed-2.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(macro_reexport)] + #[macro_reexport="foo"] //~ ERROR bad macro reexport extern crate std; diff --git a/src/test/compile-fail/macro-reexport-malformed-3.rs b/src/test/compile-fail/macro-reexport-malformed-3.rs index c8bd0a0509c..7ae045f6e4f 100644 --- a/src/test/compile-fail/macro-reexport-malformed-3.rs +++ b/src/test/compile-fail/macro-reexport-malformed-3.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(macro_reexport)] + #[macro_reexport(foo="bar")] //~ ERROR bad macro reexport extern crate std; diff --git a/src/test/compile-fail/macro-reexport-not-locally-visible.rs b/src/test/compile-fail/macro-reexport-not-locally-visible.rs index cf0d79e0fef..6859ccfe3b7 100644 --- a/src/test/compile-fail/macro-reexport-not-locally-visible.rs +++ b/src/test/compile-fail/macro-reexport-not-locally-visible.rs @@ -11,6 +11,8 @@ // aux-build:macro_reexport_1.rs // ignore-stage1 +#![feature(macro_reexport)] + #[macro_reexport(reexported)] #[no_link] extern crate macro_reexport_1;