diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2015-07-13 17:10:44 -0700 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2015-08-17 14:41:37 -0700 |
| commit | e364f0eb5a51a96932ecd01dd2319eff4bdae2d1 (patch) | |
| tree | d57d4f8c970a18f7877151c4e449485c920b49e2 /src/test | |
| parent | c66554cab3518a9f5c36eafd622ca4c8a3fda631 (diff) | |
| download | rust-e364f0eb5a51a96932ecd01dd2319eff4bdae2d1.tar.gz rust-e364f0eb5a51a96932ecd01dd2319eff4bdae2d1.zip | |
feature gate `cfg(target_feature)`.
This is theoretically a breaking change, but GitHub search turns up no uses of it, and most non-built-in cfg's are passed via cargo features, which look like `feature = "..."`, and hence can't overlap.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/feature-gate-cfg-target-feature.rs | 21 | ||||
| -rw-r--r-- | src/test/run-fail-fulldeps/qquote.rs | 4 | ||||
| -rw-r--r-- | src/test/run-pass-fulldeps/qquote.rs | 4 |
3 files changed, 27 insertions, 2 deletions
diff --git a/src/test/compile-fail/feature-gate-cfg-target-feature.rs b/src/test/compile-fail/feature-gate-cfg-target-feature.rs new file mode 100644 index 00000000000..7832e1c7c51 --- /dev/null +++ b/src/test/compile-fail/feature-gate-cfg-target-feature.rs @@ -0,0 +1,21 @@ +// Copyright 2015 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. + +#[cfg(target_feature = "x")] //~ ERROR `cfg(target_feature)` is experimental +#[cfg_attr(target_feature = "x", x)] //~ ERROR `cfg(target_feature)` is experimental +struct Foo(u64, u64); + +#[cfg(not(any(all(target_feature = "x"))))] //~ ERROR `cfg(target_feature)` is experimental +fn foo() {} + +fn main() { + cfg!(target_feature = "x"); + //~^ ERROR `cfg(target_feature)` is experimental and subject to change +} diff --git a/src/test/run-fail-fulldeps/qquote.rs b/src/test/run-fail-fulldeps/qquote.rs index 4251579bbdc..eac38037b4b 100644 --- a/src/test/run-fail-fulldeps/qquote.rs +++ b/src/test/run-fail-fulldeps/qquote.rs @@ -23,9 +23,11 @@ use syntax::print::pprust; fn main() { let ps = syntax::parse::ParseSess::new(); + let mut feature_gated_cfgs = vec![]; let mut cx = syntax::ext::base::ExtCtxt::new( &ps, vec![], - syntax::ext::expand::ExpansionConfig::default("qquote".to_string())); + syntax::ext::expand::ExpansionConfig::default("qquote".to_string()), + &mut feature_gated_cfgs); cx.bt_push(syntax::codemap::ExpnInfo { call_site: DUMMY_SP, callee: syntax::codemap::NameAndSpan { diff --git a/src/test/run-pass-fulldeps/qquote.rs b/src/test/run-pass-fulldeps/qquote.rs index 6670f200ba7..e272a5fe4f6 100644 --- a/src/test/run-pass-fulldeps/qquote.rs +++ b/src/test/run-pass-fulldeps/qquote.rs @@ -19,9 +19,11 @@ use syntax::print::pprust::*; fn main() { let ps = syntax::parse::ParseSess::new(); + let mut feature_gated_cfgs = vec![]; let mut cx = syntax::ext::base::ExtCtxt::new( &ps, vec![], - syntax::ext::expand::ExpansionConfig::default("qquote".to_string())); + syntax::ext::expand::ExpansionConfig::default("qquote".to_string()), + &mut feature_gated_cfgs); cx.bt_push(syntax::codemap::ExpnInfo { call_site: DUMMY_SP, callee: syntax::codemap::NameAndSpan { |
