Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc: feature-gate concat_idents!. #13295

Merged
merged 1 commit into from
Apr 4, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/librustc/front/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
("macro_registrar", Active),
("log_syntax", Active),
("trace_macros", Active),
("concat_idents", Active),

("simd", Active),
("default_type_params", Active),
("quote", Active),
Expand Down Expand Up @@ -229,6 +231,11 @@ impl<'a> Visitor<()> for Context<'a> {
stable enough for use and is subject to change");
}

else if id == token::str_to_ident("concat_idents") {
self.gate_feature("concat_idents", path.span, "`concat_idents` is not \
stable enough for use and is subject to change");
}

else {
for &quote in quotes.iter() {
if id == token::str_to_ident(quote) {
Expand Down
3 changes: 2 additions & 1 deletion src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://static.rust-lang.org/doc/master")]
#![feature(macro_rules, globs, asm, managed_boxes, thread_local, link_args,
simd, linkage, default_type_params, phase)]
simd, linkage, default_type_params, phase, concat_idents)]

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

// #![deny(missing_doc)] // NOTE: uncomment after a stage0 snap
#![allow(missing_doc)] // NOTE: remove after a stage0 snap
#![allow(visible_private_types)] // NOTE: remove after a stage0 snap
#![allow(unknown_features)] // NOTE: remove after a stage0 snap

// When testing libstd, bring in libuv as the I/O backend so tests can print
// things and all of the std::io tests have an I/O interface to run on top
Expand Down
13 changes: 13 additions & 0 deletions src/test/compile-fail/gated-concat_idents.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2014 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.

fn main() {
concat_idents!(a, b); //~ ERROR `concat_idents` is not stable enough
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/macros-nonfatal-errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// immediately, so that we get more errors listed at a time.

#![feature(asm)]
#![feature(trace_macros)]
#![feature(trace_macros, concat_idents)]

#[deriving(Default, //~ ERROR
Rand, //~ ERROR
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/syntax-extension-minor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

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

pub fn main() {
let asdf_fdsa = ~"<.<";
Expand Down