Skip to content

Commit 6c5e1d0

Browse files
committed
rustc: feature-gate concat_idents!.
concat_idents! is not as useful as it could be, due to macros only being allowed in limited places, and hygiene, so lets feature gate it until we make a decision about it. cc #13294
1 parent bb31cb8 commit 6c5e1d0

File tree

5 files changed

+24
-2
lines changed

5 files changed

+24
-2
lines changed

src/librustc/front/feature_gate.rs

+7
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
4949
("macro_registrar", Active),
5050
("log_syntax", Active),
5151
("trace_macros", Active),
52+
("concat_idents", Active),
53+
5254
("simd", Active),
5355
("default_type_params", Active),
5456
("quote", Active),
@@ -229,6 +231,11 @@ impl<'a> Visitor<()> for Context<'a> {
229231
stable enough for use and is subject to change");
230232
}
231233

234+
else if id == token::str_to_ident("concat_idents") {
235+
self.gate_feature("concat_idents", path.span, "`concat_idents` is not \
236+
stable enough for use and is subject to change");
237+
}
238+
232239
else {
233240
for &quote in quotes.iter() {
234241
if id == token::str_to_ident(quote) {

src/libstd/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,15 @@
5252
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
5353
html_root_url = "http://static.rust-lang.org/doc/master")]
5454
#![feature(macro_rules, globs, asm, managed_boxes, thread_local, link_args,
55-
simd, linkage, default_type_params, phase)]
55+
simd, linkage, default_type_params, phase, concat_idents)]
5656

5757
// Don't link to std. We are std.
5858
#![no_std]
5959

6060
// #![deny(missing_doc)] // NOTE: uncomment after a stage0 snap
6161
#![allow(missing_doc)] // NOTE: remove after a stage0 snap
6262
#![allow(visible_private_types)] // NOTE: remove after a stage0 snap
63+
#![allow(unknown_features)] // NOTE: remove after a stage0 snap
6364

6465
// When testing libstd, bring in libuv as the I/O backend so tests can print
6566
// things and all of the std::io tests have an I/O interface to run on top
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
concat_idents!(a, b); //~ ERROR `concat_idents` is not stable enough
13+
}

src/test/compile-fail/macros-nonfatal-errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// immediately, so that we get more errors listed at a time.
1313

1414
#![feature(asm)]
15-
#![feature(trace_macros)]
15+
#![feature(trace_macros, concat_idents)]
1616

1717
#[deriving(Default, //~ ERROR
1818
Rand, //~ ERROR

src/test/compile-fail/syntax-extension-minor.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// this now fails (correctly, I claim) because hygiene prevents
1212
// the assembled identifier from being a reference to the binding.
13+
#![feature(concat_idents)]
1314

1415
pub fn main() {
1516
let asdf_fdsa = ~"<.<";

0 commit comments

Comments
 (0)