2020-10-09 17:35:17 +00:00
|
|
|
use rustc_hir::def_id::LOCAL_CRATE;
|
|
|
|
use rustc_middle::ty::query::Providers;
|
2020-10-04 09:12:56 +00:00
|
|
|
use rustc_session::Session;
|
|
|
|
use rustc_span::symbol::sym;
|
|
|
|
use rustc_span::symbol::Symbol;
|
|
|
|
|
2021-07-23 13:19:22 +00:00
|
|
|
/// Features that control behaviour of rustc, rather than the codegen.
|
|
|
|
pub const RUSTC_SPECIFIC_FEATURES: &[&str] = &["crt-static"];
|
|
|
|
|
2020-10-25 15:53:25 +00:00
|
|
|
// When adding features to the below lists
|
|
|
|
// check whether they're named already elsewhere in rust
|
|
|
|
// e.g. in stdarch and whether the given name matches LLVM's
|
|
|
|
// if it doesn't, to_llvm_feature in llvm_util in rustc_codegen_llvm needs to be adapted
|
|
|
|
|
2020-10-04 09:12:56 +00:00
|
|
|
const ARM_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
|
|
|
|
("aclass", Some(sym::arm_target_feature)),
|
|
|
|
("mclass", Some(sym::arm_target_feature)),
|
|
|
|
("rclass", Some(sym::arm_target_feature)),
|
|
|
|
("dsp", Some(sym::arm_target_feature)),
|
|
|
|
("neon", Some(sym::arm_target_feature)),
|
|
|
|
("crc", Some(sym::arm_target_feature)),
|
|
|
|
("crypto", Some(sym::arm_target_feature)),
|
2021-05-19 15:13:23 +00:00
|
|
|
("aes", Some(sym::arm_target_feature)),
|
|
|
|
("sha2", Some(sym::arm_target_feature)),
|
2021-10-25 07:10:14 +00:00
|
|
|
("i8mm", Some(sym::arm_target_feature)),
|
2021-11-08 08:24:50 +00:00
|
|
|
("dotprod", Some(sym::arm_target_feature)),
|
2020-10-04 09:12:56 +00:00
|
|
|
("v5te", Some(sym::arm_target_feature)),
|
|
|
|
("v6", Some(sym::arm_target_feature)),
|
|
|
|
("v6k", Some(sym::arm_target_feature)),
|
|
|
|
("v6t2", Some(sym::arm_target_feature)),
|
|
|
|
("v7", Some(sym::arm_target_feature)),
|
|
|
|
("v8", Some(sym::arm_target_feature)),
|
|
|
|
("vfp2", Some(sym::arm_target_feature)),
|
|
|
|
("vfp3", Some(sym::arm_target_feature)),
|
|
|
|
("vfp4", Some(sym::arm_target_feature)),
|
2021-04-03 07:50:59 +00:00
|
|
|
("fp-armv8", Some(sym::arm_target_feature)),
|
2020-10-04 09:12:56 +00:00
|
|
|
// This is needed for inline assembly, but shouldn't be stabilized as-is
|
|
|
|
// since it should be enabled per-function using #[instruction_set], not
|
|
|
|
// #[target_feature].
|
|
|
|
("thumb-mode", Some(sym::arm_target_feature)),
|
2021-11-11 12:42:38 +00:00
|
|
|
("thumb2", Some(sym::arm_target_feature)),
|
2022-02-24 22:37:53 +00:00
|
|
|
("d32", Some(sym::arm_target_feature)),
|
2020-10-04 09:12:56 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
const AARCH64_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
|
Fold aarch64 feature +fp into +neon
Arm's FEAT_FP and Feat_AdvSIMD describe the same thing on AArch64:
The Neon unit, which handles both floating point and SIMD instructions.
Moreover, a configuration for AArch64 must include both or neither.
Arm says "entirely proprietary" toolchains may omit floating point:
https://developer.arm.com/documentation/102374/0101/Data-processing---floating-point
In the Programmer's Guide for Armv8-A, Arm says AArch64 can have
both FP and Neon or neither in custom implementations:
https://developer.arm.com/documentation/den0024/a/AArch64-Floating-point-and-NEON
In "Bare metal boot code for Armv8-A", enabling Neon and FP
is just disabling the same trap flag:
https://developer.arm.com/documentation/dai0527/a
In an unlikely future where "Neon and FP" become unrelated,
we can add "[+-]fp" as its own feature flag.
Until then, we can simplify programming with Rust on AArch64 by
folding both into "[+-]neon", which is valid as it supersets both.
"[+-]neon" is retained for niche uses such as firmware, kernels,
"I just hate floats", and so on.
2021-12-04 01:56:59 +00:00
|
|
|
// FEAT_AdvSimd & FEAT_FP
|
2022-02-10 16:43:45 +00:00
|
|
|
("neon", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_FP16
|
2022-02-10 16:43:45 +00:00
|
|
|
("fp16", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_SVE
|
2022-02-10 16:43:45 +00:00
|
|
|
("sve", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_CRC
|
2022-02-10 16:43:45 +00:00
|
|
|
("crc", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_RAS
|
2022-02-10 16:43:45 +00:00
|
|
|
("ras", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_LSE
|
2022-02-10 16:43:45 +00:00
|
|
|
("lse", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_RDM
|
2022-02-10 16:43:45 +00:00
|
|
|
("rdm", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_RCPC
|
2022-02-10 16:43:45 +00:00
|
|
|
("rcpc", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_RCPC2
|
2022-02-10 16:43:45 +00:00
|
|
|
("rcpc2", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_DotProd
|
2022-02-10 16:43:45 +00:00
|
|
|
("dotprod", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_TME
|
2022-02-10 16:43:45 +00:00
|
|
|
("tme", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_FHM
|
2022-02-10 16:43:45 +00:00
|
|
|
("fhm", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_DIT
|
2022-02-10 16:43:45 +00:00
|
|
|
("dit", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_FLAGM
|
2022-02-10 16:43:45 +00:00
|
|
|
("flagm", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_SSBS
|
2022-02-10 16:43:45 +00:00
|
|
|
("ssbs", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_SB
|
2022-02-10 16:43:45 +00:00
|
|
|
("sb", None),
|
2022-01-31 13:04:27 +00:00
|
|
|
// FEAT_PAUTH (address authentication)
|
2022-02-10 16:43:45 +00:00
|
|
|
("paca", None),
|
2022-01-31 13:04:27 +00:00
|
|
|
// FEAT_PAUTH (generic authentication)
|
2022-02-10 16:43:45 +00:00
|
|
|
("pacg", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_DPB
|
2022-02-10 16:43:45 +00:00
|
|
|
("dpb", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_DPB2
|
2022-02-10 16:43:45 +00:00
|
|
|
("dpb2", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_SVE2
|
2022-02-10 16:43:45 +00:00
|
|
|
("sve2", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_SVE2_AES
|
2022-02-10 16:43:45 +00:00
|
|
|
("sve2-aes", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_SVE2_SM4
|
2022-02-10 16:43:45 +00:00
|
|
|
("sve2-sm4", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_SVE2_SHA3
|
2022-02-10 16:43:45 +00:00
|
|
|
("sve2-sha3", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_SVE2_BitPerm
|
2022-02-10 16:43:45 +00:00
|
|
|
("sve2-bitperm", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_FRINTTS
|
2022-02-10 16:43:45 +00:00
|
|
|
("frintts", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_I8MM
|
2022-02-10 16:43:45 +00:00
|
|
|
("i8mm", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_F32MM
|
2022-02-10 16:43:45 +00:00
|
|
|
("f32mm", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_F64MM
|
2022-02-10 16:43:45 +00:00
|
|
|
("f64mm", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_BF16
|
2022-02-10 16:43:45 +00:00
|
|
|
("bf16", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_RAND
|
2022-02-10 16:43:45 +00:00
|
|
|
("rand", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_BTI
|
2022-02-10 16:43:45 +00:00
|
|
|
("bti", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_MTE
|
2022-02-10 16:43:45 +00:00
|
|
|
("mte", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_JSCVT
|
2022-02-10 16:43:45 +00:00
|
|
|
("jsconv", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_FCMA
|
2022-02-10 16:43:45 +00:00
|
|
|
("fcma", None),
|
2021-05-19 15:13:23 +00:00
|
|
|
// FEAT_AES
|
2022-02-10 16:43:45 +00:00
|
|
|
("aes", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_SHA1 & FEAT_SHA256
|
2022-02-10 16:43:45 +00:00
|
|
|
("sha2", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_SHA512 & FEAT_SHA3
|
2022-02-10 16:43:45 +00:00
|
|
|
("sha3", None),
|
2021-04-28 16:54:44 +00:00
|
|
|
// FEAT_SM3 & FEAT_SM4
|
2022-02-10 16:43:45 +00:00
|
|
|
("sm4", None),
|
2021-11-01 16:22:29 +00:00
|
|
|
// FEAT_PAN
|
2022-02-10 16:43:45 +00:00
|
|
|
("pan", None),
|
2021-11-01 16:22:29 +00:00
|
|
|
// FEAT_LOR
|
2022-02-10 16:43:45 +00:00
|
|
|
("lor", None),
|
2021-11-01 16:22:29 +00:00
|
|
|
// FEAT_VHE
|
2022-02-10 16:43:45 +00:00
|
|
|
("vh", None),
|
2021-11-01 16:22:29 +00:00
|
|
|
// FEAT_PMUv3
|
2022-02-10 16:43:45 +00:00
|
|
|
("pmuv3", None),
|
2021-11-01 16:22:29 +00:00
|
|
|
// FEAT_SPE
|
2022-02-10 16:43:45 +00:00
|
|
|
("spe", None),
|
|
|
|
("v8.1a", Some(sym::aarch64_ver_target_feature)),
|
|
|
|
("v8.2a", Some(sym::aarch64_ver_target_feature)),
|
|
|
|
("v8.3a", Some(sym::aarch64_ver_target_feature)),
|
|
|
|
("v8.4a", Some(sym::aarch64_ver_target_feature)),
|
|
|
|
("v8.5a", Some(sym::aarch64_ver_target_feature)),
|
|
|
|
("v8.6a", Some(sym::aarch64_ver_target_feature)),
|
|
|
|
("v8.7a", Some(sym::aarch64_ver_target_feature)),
|
2020-10-04 09:12:56 +00:00
|
|
|
];
|
|
|
|
|
2022-02-10 16:43:45 +00:00
|
|
|
const AARCH64_TIED_FEATURES: &[&[&str]] = &[
|
|
|
|
&["paca", "pacg"], // Together these represent `pauth` in LLVM
|
|
|
|
];
|
2022-01-31 13:04:27 +00:00
|
|
|
|
2020-10-04 09:12:56 +00:00
|
|
|
const X86_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
|
2022-02-07 19:22:21 +00:00
|
|
|
("adx", None),
|
2020-10-04 09:12:56 +00:00
|
|
|
("aes", None),
|
|
|
|
("avx", None),
|
|
|
|
("avx2", None),
|
2020-11-15 10:34:08 +00:00
|
|
|
("avx512bf16", Some(sym::avx512_target_feature)),
|
2020-10-25 15:53:25 +00:00
|
|
|
("avx512bitalg", Some(sym::avx512_target_feature)),
|
2020-10-04 09:12:56 +00:00
|
|
|
("avx512bw", Some(sym::avx512_target_feature)),
|
|
|
|
("avx512cd", Some(sym::avx512_target_feature)),
|
|
|
|
("avx512dq", Some(sym::avx512_target_feature)),
|
|
|
|
("avx512er", Some(sym::avx512_target_feature)),
|
|
|
|
("avx512f", Some(sym::avx512_target_feature)),
|
2020-10-25 15:53:25 +00:00
|
|
|
("avx512gfni", Some(sym::avx512_target_feature)),
|
2020-10-04 09:12:56 +00:00
|
|
|
("avx512ifma", Some(sym::avx512_target_feature)),
|
|
|
|
("avx512pf", Some(sym::avx512_target_feature)),
|
2020-10-25 15:53:25 +00:00
|
|
|
("avx512vaes", Some(sym::avx512_target_feature)),
|
2020-10-04 09:12:56 +00:00
|
|
|
("avx512vbmi", Some(sym::avx512_target_feature)),
|
2020-10-25 15:53:25 +00:00
|
|
|
("avx512vbmi2", Some(sym::avx512_target_feature)),
|
2020-10-04 09:12:56 +00:00
|
|
|
("avx512vl", Some(sym::avx512_target_feature)),
|
2020-10-25 15:53:25 +00:00
|
|
|
("avx512vnni", Some(sym::avx512_target_feature)),
|
2020-11-15 10:34:08 +00:00
|
|
|
("avx512vp2intersect", Some(sym::avx512_target_feature)),
|
2020-10-25 15:53:25 +00:00
|
|
|
("avx512vpclmulqdq", Some(sym::avx512_target_feature)),
|
2020-10-04 09:12:56 +00:00
|
|
|
("avx512vpopcntdq", Some(sym::avx512_target_feature)),
|
|
|
|
("bmi1", None),
|
|
|
|
("bmi2", None),
|
|
|
|
("cmpxchg16b", Some(sym::cmpxchg16b_target_feature)),
|
2020-10-26 10:46:54 +00:00
|
|
|
("ermsb", Some(sym::ermsb_target_feature)),
|
2020-10-04 09:12:56 +00:00
|
|
|
("f16c", Some(sym::f16c_target_feature)),
|
|
|
|
("fma", None),
|
|
|
|
("fxsr", None),
|
|
|
|
("lzcnt", None),
|
|
|
|
("movbe", Some(sym::movbe_target_feature)),
|
|
|
|
("pclmulqdq", None),
|
|
|
|
("popcnt", None),
|
|
|
|
("rdrand", None),
|
|
|
|
("rdseed", None),
|
|
|
|
("rtm", Some(sym::rtm_target_feature)),
|
|
|
|
("sha", None),
|
|
|
|
("sse", None),
|
|
|
|
("sse2", None),
|
|
|
|
("sse3", None),
|
|
|
|
("sse4.1", None),
|
|
|
|
("sse4.2", None),
|
|
|
|
("sse4a", Some(sym::sse4a_target_feature)),
|
|
|
|
("ssse3", None),
|
|
|
|
("tbm", Some(sym::tbm_target_feature)),
|
|
|
|
("xsave", None),
|
|
|
|
("xsavec", None),
|
|
|
|
("xsaveopt", None),
|
|
|
|
("xsaves", None),
|
|
|
|
];
|
|
|
|
|
|
|
|
const HEXAGON_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
|
|
|
|
("hvx", Some(sym::hexagon_target_feature)),
|
|
|
|
("hvx-length128b", Some(sym::hexagon_target_feature)),
|
|
|
|
];
|
|
|
|
|
|
|
|
const POWERPC_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
|
|
|
|
("altivec", Some(sym::powerpc_target_feature)),
|
|
|
|
("power8-altivec", Some(sym::powerpc_target_feature)),
|
|
|
|
("power9-altivec", Some(sym::powerpc_target_feature)),
|
|
|
|
("power8-vector", Some(sym::powerpc_target_feature)),
|
|
|
|
("power9-vector", Some(sym::powerpc_target_feature)),
|
|
|
|
("vsx", Some(sym::powerpc_target_feature)),
|
|
|
|
];
|
|
|
|
|
|
|
|
const MIPS_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] =
|
|
|
|
&[("fp64", Some(sym::mips_target_feature)), ("msa", Some(sym::mips_target_feature))];
|
|
|
|
|
|
|
|
const RISCV_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
|
|
|
|
("m", Some(sym::riscv_target_feature)),
|
|
|
|
("a", Some(sym::riscv_target_feature)),
|
|
|
|
("c", Some(sym::riscv_target_feature)),
|
|
|
|
("f", Some(sym::riscv_target_feature)),
|
|
|
|
("d", Some(sym::riscv_target_feature)),
|
|
|
|
("e", Some(sym::riscv_target_feature)),
|
2022-03-16 08:57:36 +00:00
|
|
|
("v", Some(sym::riscv_target_feature)),
|
|
|
|
("zfinx", Some(sym::riscv_target_feature)),
|
|
|
|
("zdinx", Some(sym::riscv_target_feature)),
|
|
|
|
("zhinx", Some(sym::riscv_target_feature)),
|
|
|
|
("zhinxmin", Some(sym::riscv_target_feature)),
|
|
|
|
("zfh", Some(sym::riscv_target_feature)),
|
|
|
|
("zfhmin", Some(sym::riscv_target_feature)),
|
|
|
|
("zbkb", Some(sym::riscv_target_feature)),
|
|
|
|
("zbkc", Some(sym::riscv_target_feature)),
|
|
|
|
("zbkx", Some(sym::riscv_target_feature)),
|
|
|
|
("zknd", Some(sym::riscv_target_feature)),
|
|
|
|
("zkne", Some(sym::riscv_target_feature)),
|
|
|
|
("zknh", Some(sym::riscv_target_feature)),
|
|
|
|
("zksed", Some(sym::riscv_target_feature)),
|
|
|
|
("zksh", Some(sym::riscv_target_feature)),
|
|
|
|
("zkr", Some(sym::riscv_target_feature)),
|
|
|
|
("zkn", Some(sym::riscv_target_feature)),
|
|
|
|
("zks", Some(sym::riscv_target_feature)),
|
|
|
|
("zk", Some(sym::riscv_target_feature)),
|
|
|
|
("zkt", Some(sym::riscv_target_feature)),
|
2020-10-04 09:12:56 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
const WASM_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
|
2021-06-10 14:11:23 +00:00
|
|
|
("simd128", None),
|
2020-10-04 09:12:56 +00:00
|
|
|
("atomics", Some(sym::wasm_target_feature)),
|
|
|
|
("nontrapping-fptoint", Some(sym::wasm_target_feature)),
|
2022-06-06 22:01:17 +00:00
|
|
|
("bulk-memory", Some(sym::wasm_target_feature)),
|
|
|
|
("mutable-globals", Some(sym::wasm_target_feature)),
|
|
|
|
("reference-types", Some(sym::wasm_target_feature)),
|
2022-07-23 14:58:10 +00:00
|
|
|
("sign-ext", Some(sym::wasm_target_feature)),
|
2020-10-04 09:12:56 +00:00
|
|
|
];
|
|
|
|
|
2021-04-20 09:03:10 +00:00
|
|
|
const BPF_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[("alu32", Some(sym::bpf_target_feature))];
|
|
|
|
|
2020-10-04 09:12:56 +00:00
|
|
|
/// When rustdoc is running, provide a list of all known features so that all their respective
|
|
|
|
/// primitives may be documented.
|
|
|
|
///
|
|
|
|
/// IMPORTANT: If you're adding another feature list above, make sure to add it to this iterator!
|
|
|
|
pub fn all_known_features() -> impl Iterator<Item = (&'static str, Option<Symbol>)> {
|
|
|
|
std::iter::empty()
|
|
|
|
.chain(ARM_ALLOWED_FEATURES.iter())
|
|
|
|
.chain(AARCH64_ALLOWED_FEATURES.iter())
|
|
|
|
.chain(X86_ALLOWED_FEATURES.iter())
|
|
|
|
.chain(HEXAGON_ALLOWED_FEATURES.iter())
|
|
|
|
.chain(POWERPC_ALLOWED_FEATURES.iter())
|
|
|
|
.chain(MIPS_ALLOWED_FEATURES.iter())
|
|
|
|
.chain(RISCV_ALLOWED_FEATURES.iter())
|
|
|
|
.chain(WASM_ALLOWED_FEATURES.iter())
|
2021-04-20 09:03:10 +00:00
|
|
|
.chain(BPF_ALLOWED_FEATURES.iter())
|
2020-10-04 09:12:56 +00:00
|
|
|
.cloned()
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn supported_target_features(sess: &Session) -> &'static [(&'static str, Option<Symbol>)] {
|
2020-10-15 09:44:00 +00:00
|
|
|
match &*sess.target.arch {
|
2020-10-04 09:12:56 +00:00
|
|
|
"arm" => ARM_ALLOWED_FEATURES,
|
|
|
|
"aarch64" => AARCH64_ALLOWED_FEATURES,
|
|
|
|
"x86" | "x86_64" => X86_ALLOWED_FEATURES,
|
|
|
|
"hexagon" => HEXAGON_ALLOWED_FEATURES,
|
|
|
|
"mips" | "mips64" => MIPS_ALLOWED_FEATURES,
|
|
|
|
"powerpc" | "powerpc64" => POWERPC_ALLOWED_FEATURES,
|
|
|
|
"riscv32" | "riscv64" => RISCV_ALLOWED_FEATURES,
|
2020-12-30 18:52:21 +00:00
|
|
|
"wasm32" | "wasm64" => WASM_ALLOWED_FEATURES,
|
2021-04-20 09:03:10 +00:00
|
|
|
"bpf" => BPF_ALLOWED_FEATURES,
|
2020-10-04 09:12:56 +00:00
|
|
|
_ => &[],
|
|
|
|
}
|
|
|
|
}
|
2020-10-09 17:35:17 +00:00
|
|
|
|
2022-01-31 13:04:27 +00:00
|
|
|
pub fn tied_target_features(sess: &Session) -> &'static [&'static [&'static str]] {
|
|
|
|
match &*sess.target.arch {
|
|
|
|
"aarch64" => AARCH64_TIED_FEATURES,
|
|
|
|
_ => &[],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-09 17:35:17 +00:00
|
|
|
pub(crate) fn provide(providers: &mut Providers) {
|
|
|
|
providers.supported_target_features = |tcx, cnum| {
|
|
|
|
assert_eq!(cnum, LOCAL_CRATE);
|
|
|
|
if tcx.sess.opts.actually_rustdoc {
|
|
|
|
// rustdoc needs to be able to document functions that use all the features, so
|
|
|
|
// whitelist them all
|
|
|
|
all_known_features().map(|(a, b)| (a.to_string(), b)).collect()
|
|
|
|
} else {
|
|
|
|
supported_target_features(tcx.sess).iter().map(|&(a, b)| (a.to_string(), b)).collect()
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|