From 608031888354d95fa613de6d487311b527d804d1 Mon Sep 17 00:00:00 2001 From: Jethro Beekman Date: Wed, 9 Jan 2019 13:29:45 +0530 Subject: [PATCH 1/2] Add additional human-readable cfg strings to rustdoc --- src/librustdoc/clean/cfg.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/librustdoc/clean/cfg.rs b/src/librustdoc/clean/cfg.rs index 0cfe6be7efbf3..c74a561e5a0d5 100644 --- a/src/librustdoc/clean/cfg.rs +++ b/src/librustdoc/clean/cfg.rs @@ -370,6 +370,7 @@ impl<'a> fmt::Display for Html<'a> { "pc" => "PC", "rumprun" => "Rumprun", "sun" => "Sun", + "fortanix" => "Fortanix", _ => "" }, ("target_env", Some(env)) => match &*env.as_str() { @@ -378,6 +379,7 @@ impl<'a> fmt::Display for Html<'a> { "musl" => "musl", "newlib" => "Newlib", "uclibc" => "uClibc", + "sgx" => "SGX", _ => "", }, ("target_endian", Some(endian)) => return write!(fmt, "{}-endian", endian), From 972bba7071d0e6b04194fa3c1108b991262dd502 Mon Sep 17 00:00:00 2001 From: Jethro Beekman Date: Wed, 9 Jan 2019 13:30:34 +0530 Subject: [PATCH 2/2] Stabilize `cfg_target_vendor`, #29718 --- src/libpanic_abort/lib.rs | 2 +- src/libstd/lib.rs | 2 +- src/libsyntax/feature_gate.rs | 6 ++-- src/libtest/lib.rs | 2 +- src/libunwind/lib.rs | 2 +- src/test/run-pass/cfg/cfg-target-vendor.rs | 2 -- .../feature-gate-cfg-target-vendor.rs | 11 ------ .../feature-gate-cfg-target-vendor.stderr | 35 ------------------- 8 files changed, 6 insertions(+), 56 deletions(-) delete mode 100644 src/test/ui/feature-gates/feature-gate-cfg-target-vendor.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-cfg-target-vendor.stderr diff --git a/src/libpanic_abort/lib.rs b/src/libpanic_abort/lib.rs index d8dd2e0a11337..8832a16d4ca4e 100644 --- a/src/libpanic_abort/lib.rs +++ b/src/libpanic_abort/lib.rs @@ -12,7 +12,7 @@ #![panic_runtime] #![allow(unused_features)] -#![feature(cfg_target_vendor)] +#![cfg_attr(stage0, feature(cfg_target_vendor))] #![feature(core_intrinsics)] #![feature(libc)] #![feature(nll)] diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index e220080844946..41f1ac867ed15 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -238,7 +238,7 @@ #![feature(c_variadic)] #![feature(cfg_target_has_atomic)] #![feature(cfg_target_thread_local)] -#![feature(cfg_target_vendor)] +#![cfg_attr(stage0, feature(cfg_target_vendor))] #![feature(char_error_internals)] #![feature(compiler_builtins_lib)] #![feature(concat_idents)] diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 9b4231d8803a3..ac20a62f11787 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -244,9 +244,6 @@ declare_features! ( // rustc internal (active, omit_gdb_pretty_printer_section, "1.5.0", None, None), - // Allows `cfg(target_vendor = "...")`. - (active, cfg_target_vendor, "1.5.0", Some(29718), None), - // Allows attributes on expressions and non-item statements. (active, stmt_expr_attributes, "1.6.0", Some(15701), None), @@ -686,6 +683,8 @@ declare_features! ( (accepted, if_while_or_patterns, "1.33.0", Some(48215), None), // Allows `use x::y;` to search `x` in the current scope. (accepted, uniform_paths, "1.32.0", Some(53130), None), + // Allows `cfg(target_vendor = "...")`. + (accepted, cfg_target_vendor, "1.33.0", Some(29718), None), ); // If you change this, please modify `src/doc/unstable-book` as well. You must @@ -1181,7 +1180,6 @@ pub const BUILTIN_ATTRIBUTES: &[(&str, AttributeType, AttributeGate)] = &[ // cfg(...)'s that are feature gated const GATED_CFGS: &[(&str, &str, fn(&Features) -> bool)] = &[ // (name in cfg, feature, function to check if the feature is enabled) - ("target_vendor", "cfg_target_vendor", cfg_fn!(cfg_target_vendor)), ("target_thread_local", "cfg_target_thread_local", cfg_fn!(cfg_target_thread_local)), ("target_has_atomic", "cfg_target_has_atomic", cfg_fn!(cfg_target_has_atomic)), ("rustdoc", "doc_cfg", cfg_fn!(doc_cfg)), diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index ec96ea067082f..2cc80ddea2df4 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -23,7 +23,7 @@ html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))] #![feature(asm)] -#![feature(cfg_target_vendor)] +#![cfg_attr(stage0, feature(cfg_target_vendor))] #![feature(fnbox)] #![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc))] #![feature(nll)] diff --git a/src/libunwind/lib.rs b/src/libunwind/lib.rs index 5e51995145461..7ed7837268dcd 100644 --- a/src/libunwind/lib.rs +++ b/src/libunwind/lib.rs @@ -1,7 +1,7 @@ #![no_std] #![unstable(feature = "panic_unwind", issue = "32837")] -#![feature(cfg_target_vendor)] +#![cfg_attr(stage0, feature(cfg_target_vendor))] #![feature(link_cfg)] #![feature(nll)] #![feature(staged_api)] diff --git a/src/test/run-pass/cfg/cfg-target-vendor.rs b/src/test/run-pass/cfg/cfg-target-vendor.rs index 01b904874be04..7824585162e5c 100644 --- a/src/test/run-pass/cfg/cfg-target-vendor.rs +++ b/src/test/run-pass/cfg/cfg-target-vendor.rs @@ -1,6 +1,4 @@ // run-pass -#![feature(cfg_target_vendor)] - #[cfg(target_vendor = "unknown")] pub fn main() { } diff --git a/src/test/ui/feature-gates/feature-gate-cfg-target-vendor.rs b/src/test/ui/feature-gates/feature-gate-cfg-target-vendor.rs deleted file mode 100644 index acd310e7e2e07..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-cfg-target-vendor.rs +++ /dev/null @@ -1,11 +0,0 @@ -#[cfg(target_vendor = "x")] //~ ERROR `cfg(target_vendor)` is experimental -#[cfg_attr(target_vendor = "x", x)] //~ ERROR `cfg(target_vendor)` is experimental -struct Foo(u64, u64); - -#[cfg(not(any(all(target_vendor = "x"))))] //~ ERROR `cfg(target_vendor)` is experimental -fn foo() {} - -fn main() { - cfg!(target_vendor = "x"); - //~^ ERROR `cfg(target_vendor)` is experimental and subject to change -} diff --git a/src/test/ui/feature-gates/feature-gate-cfg-target-vendor.stderr b/src/test/ui/feature-gates/feature-gate-cfg-target-vendor.stderr deleted file mode 100644 index dd514a5d90a03..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-cfg-target-vendor.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0658]: `cfg(target_vendor)` is experimental and subject to change (see issue #29718) - --> $DIR/feature-gate-cfg-target-vendor.rs:2:12 - | -LL | #[cfg_attr(target_vendor = "x", x)] //~ ERROR `cfg(target_vendor)` is experimental - | ^^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(cfg_target_vendor)] to the crate attributes to enable - -error[E0658]: `cfg(target_vendor)` is experimental and subject to change (see issue #29718) - --> $DIR/feature-gate-cfg-target-vendor.rs:1:7 - | -LL | #[cfg(target_vendor = "x")] //~ ERROR `cfg(target_vendor)` is experimental - | ^^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(cfg_target_vendor)] to the crate attributes to enable - -error[E0658]: `cfg(target_vendor)` is experimental and subject to change (see issue #29718) - --> $DIR/feature-gate-cfg-target-vendor.rs:5:19 - | -LL | #[cfg(not(any(all(target_vendor = "x"))))] //~ ERROR `cfg(target_vendor)` is experimental - | ^^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(cfg_target_vendor)] to the crate attributes to enable - -error[E0658]: `cfg(target_vendor)` is experimental and subject to change (see issue #29718) - --> $DIR/feature-gate-cfg-target-vendor.rs:9:10 - | -LL | cfg!(target_vendor = "x"); - | ^^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(cfg_target_vendor)] to the crate attributes to enable - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0658`.