Skip to content

Commit

Permalink
Rollup merge of rust-lang#57465 - jethrogb:jb/stablize-cfg-target-ven…
Browse files Browse the repository at this point in the history
…dor, r=joshtriplett,Centril

Stabilize cfg_target_vendor

This stabilizes the use of `cfg(target_vendor = "...")` and removes the corresponding `cfg_target_vendor` feature. Other unstable cfgs remain behind their existing feature gates.

This functionality was added back in 2015 in rust-lang#28612 to complete the coverage of target tuples (`<arch><sub>-<vendor>-<os>-<env>`). [RFC 131](https://github.com/rust-lang/rfcs/blob/master/text/0131-target-specification.md) governs the target specification, not including `target_vendor` seems to have just been an oversight. `target_os`, `target_family`, and `target_arch` are stable as of 1.0.0. `target_env` was also not mentioned in RFC 131, was added in rust-lang#24777, never behind a feature_gate, and insta-stable at 1.1.0.

The functionality is tested in [test/run-pass/cfg/cfg-target-vendor.rs](https://github.com/rust-lang/rust/blob/master/src/test/run-pass/cfg/cfg-target-vendor.rs).

Closes rust-lang#29718
  • Loading branch information
Centril authored Jan 14, 2019
2 parents 3e869d7 + 972bba7 commit 44a41b4
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 56 deletions.
2 changes: 1 addition & 1 deletion src/libpanic_abort/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 2 additions & 0 deletions src/librustdoc/clean/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
6 changes: 2 additions & 4 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)),
Expand Down
2 changes: 1 addition & 1 deletion src/libtest/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/libunwind/lib.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/cfg/cfg-target-vendor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// run-pass
#![feature(cfg_target_vendor)]

#[cfg(target_vendor = "unknown")]
pub fn main() {
}
Expand Down
11 changes: 0 additions & 11 deletions src/test/ui/feature-gates/feature-gate-cfg-target-vendor.rs

This file was deleted.

35 changes: 0 additions & 35 deletions src/test/ui/feature-gates/feature-gate-cfg-target-vendor.stderr

This file was deleted.

0 comments on commit 44a41b4

Please sign in to comment.