Skip to content

Commit 74cc0be

Browse files
authoredJan 14, 2019
Rollup merge of rust-lang#57465 - jethrogb:jb/stablize-cfg-target-vendor, 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
2 parents 36d68f5 + 972bba7 commit 74cc0be

File tree

9 files changed

+8
-56
lines changed

9 files changed

+8
-56
lines changed
 

‎src/libpanic_abort/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#![panic_runtime]
1313
#![allow(unused_features)]
1414

15-
#![feature(cfg_target_vendor)]
15+
#![cfg_attr(stage0, feature(cfg_target_vendor))]
1616
#![feature(core_intrinsics)]
1717
#![feature(libc)]
1818
#![feature(nll)]

‎src/librustdoc/clean/cfg.rs

+2
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ impl<'a> fmt::Display for Html<'a> {
370370
"pc" => "PC",
371371
"rumprun" => "Rumprun",
372372
"sun" => "Sun",
373+
"fortanix" => "Fortanix",
373374
_ => ""
374375
},
375376
("target_env", Some(env)) => match &*env.as_str() {
@@ -378,6 +379,7 @@ impl<'a> fmt::Display for Html<'a> {
378379
"musl" => "musl",
379380
"newlib" => "Newlib",
380381
"uclibc" => "uClibc",
382+
"sgx" => "SGX",
381383
_ => "",
382384
},
383385
("target_endian", Some(endian)) => return write!(fmt, "{}-endian", endian),

‎src/libstd/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@
238238
#![feature(c_variadic)]
239239
#![feature(cfg_target_has_atomic)]
240240
#![feature(cfg_target_thread_local)]
241-
#![feature(cfg_target_vendor)]
241+
#![cfg_attr(stage0, feature(cfg_target_vendor))]
242242
#![feature(char_error_internals)]
243243
#![feature(compiler_builtins_lib)]
244244
#![feature(concat_idents)]

‎src/libsyntax/feature_gate.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,6 @@ declare_features! (
244244
// rustc internal
245245
(active, omit_gdb_pretty_printer_section, "1.5.0", None, None),
246246

247-
// Allows `cfg(target_vendor = "...")`.
248-
(active, cfg_target_vendor, "1.5.0", Some(29718), None),
249-
250247
// Allows attributes on expressions and non-item statements.
251248
(active, stmt_expr_attributes, "1.6.0", Some(15701), None),
252249

@@ -686,6 +683,8 @@ declare_features! (
686683
(accepted, if_while_or_patterns, "1.33.0", Some(48215), None),
687684
// Allows `use x::y;` to search `x` in the current scope.
688685
(accepted, uniform_paths, "1.32.0", Some(53130), None),
686+
// Allows `cfg(target_vendor = "...")`.
687+
(accepted, cfg_target_vendor, "1.33.0", Some(29718), None),
689688
);
690689

691690
// 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)] = &[
11811180
// cfg(...)'s that are feature gated
11821181
const GATED_CFGS: &[(&str, &str, fn(&Features) -> bool)] = &[
11831182
// (name in cfg, feature, function to check if the feature is enabled)
1184-
("target_vendor", "cfg_target_vendor", cfg_fn!(cfg_target_vendor)),
11851183
("target_thread_local", "cfg_target_thread_local", cfg_fn!(cfg_target_thread_local)),
11861184
("target_has_atomic", "cfg_target_has_atomic", cfg_fn!(cfg_target_has_atomic)),
11871185
("rustdoc", "doc_cfg", cfg_fn!(doc_cfg)),

‎src/libtest/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2424
html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))]
2525
#![feature(asm)]
26-
#![feature(cfg_target_vendor)]
26+
#![cfg_attr(stage0, feature(cfg_target_vendor))]
2727
#![feature(fnbox)]
2828
#![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc))]
2929
#![feature(nll)]

‎src/libunwind/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![no_std]
22
#![unstable(feature = "panic_unwind", issue = "32837")]
33

4-
#![feature(cfg_target_vendor)]
4+
#![cfg_attr(stage0, feature(cfg_target_vendor))]
55
#![feature(link_cfg)]
66
#![feature(nll)]
77
#![feature(staged_api)]

‎src/test/run-pass/cfg/cfg-target-vendor.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
// run-pass
2-
#![feature(cfg_target_vendor)]
3-
42
#[cfg(target_vendor = "unknown")]
53
pub fn main() {
64
}

‎src/test/ui/feature-gates/feature-gate-cfg-target-vendor.rs

-11
This file was deleted.

‎src/test/ui/feature-gates/feature-gate-cfg-target-vendor.stderr

-35
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.