@@ -139,7 +139,7 @@ pub fn time_trace_profiler_finish(file_name: &str) {
139139// to LLVM or the feature detection code will walk past the end of the feature
140140// array, leading to crashes.
141141
142- const ARM_WHITELIST : & [ ( & str , Option < Symbol > ) ] = & [
142+ const ARM_ALLOWED_FEATURES : & [ ( & str , Option < Symbol > ) ] = & [
143143 ( "aclass" , Some ( sym:: arm_target_feature) ) ,
144144 ( "mclass" , Some ( sym:: arm_target_feature) ) ,
145145 ( "rclass" , Some ( sym:: arm_target_feature) ) ,
@@ -162,7 +162,7 @@ const ARM_WHITELIST: &[(&str, Option<Symbol>)] = &[
162162 ( "thumb-mode" , Some ( sym:: arm_target_feature) ) ,
163163] ;
164164
165- const AARCH64_WHITELIST : & [ ( & str , Option < Symbol > ) ] = & [
165+ const AARCH64_ALLOWED_FEATURES : & [ ( & str , Option < Symbol > ) ] = & [
166166 ( "fp" , Some ( sym:: aarch64_target_feature) ) ,
167167 ( "neon" , Some ( sym:: aarch64_target_feature) ) ,
168168 ( "sve" , Some ( sym:: aarch64_target_feature) ) ,
@@ -180,7 +180,7 @@ const AARCH64_WHITELIST: &[(&str, Option<Symbol>)] = &[
180180 ( "v8.3a" , Some ( sym:: aarch64_target_feature) ) ,
181181] ;
182182
183- const X86_WHITELIST : & [ ( & str , Option < Symbol > ) ] = & [
183+ const X86_ALLOWED_FEATURES : & [ ( & str , Option < Symbol > ) ] = & [
184184 ( "adx" , Some ( sym:: adx_target_feature) ) ,
185185 ( "aes" , None ) ,
186186 ( "avx" , None ) ,
@@ -224,12 +224,12 @@ const X86_WHITELIST: &[(&str, Option<Symbol>)] = &[
224224 ( "xsaves" , None ) ,
225225] ;
226226
227- const HEXAGON_WHITELIST : & [ ( & str , Option < Symbol > ) ] = & [
227+ const HEXAGON_ALLOWED_FEATURES : & [ ( & str , Option < Symbol > ) ] = & [
228228 ( "hvx" , Some ( sym:: hexagon_target_feature) ) ,
229229 ( "hvx-length128b" , Some ( sym:: hexagon_target_feature) ) ,
230230] ;
231231
232- const POWERPC_WHITELIST : & [ ( & str , Option < Symbol > ) ] = & [
232+ const POWERPC_ALLOWED_FEATURES : & [ ( & str , Option < Symbol > ) ] = & [
233233 ( "altivec" , Some ( sym:: powerpc_target_feature) ) ,
234234 ( "power8-altivec" , Some ( sym:: powerpc_target_feature) ) ,
235235 ( "power9-altivec" , Some ( sym:: powerpc_target_feature) ) ,
@@ -238,10 +238,10 @@ const POWERPC_WHITELIST: &[(&str, Option<Symbol>)] = &[
238238 ( "vsx" , Some ( sym:: powerpc_target_feature) ) ,
239239] ;
240240
241- const MIPS_WHITELIST : & [ ( & str , Option < Symbol > ) ] =
241+ const MIPS_ALLOWED_FEATURES : & [ ( & str , Option < Symbol > ) ] =
242242 & [ ( "fp64" , Some ( sym:: mips_target_feature) ) , ( "msa" , Some ( sym:: mips_target_feature) ) ] ;
243243
244- const RISCV_WHITELIST : & [ ( & str , Option < Symbol > ) ] = & [
244+ const RISCV_ALLOWED_FEATURES : & [ ( & str , Option < Symbol > ) ] = & [
245245 ( "m" , Some ( sym:: riscv_target_feature) ) ,
246246 ( "a" , Some ( sym:: riscv_target_feature) ) ,
247247 ( "c" , Some ( sym:: riscv_target_feature) ) ,
@@ -250,7 +250,7 @@ const RISCV_WHITELIST: &[(&str, Option<Symbol>)] = &[
250250 ( "e" , Some ( sym:: riscv_target_feature) ) ,
251251] ;
252252
253- const WASM_WHITELIST : & [ ( & str , Option < Symbol > ) ] = & [
253+ const WASM_ALLOWED_FEATURES : & [ ( & str , Option < Symbol > ) ] = & [
254254 ( "simd128" , Some ( sym:: wasm_target_feature) ) ,
255255 ( "atomics" , Some ( sym:: wasm_target_feature) ) ,
256256 ( "nontrapping-fptoint" , Some ( sym:: wasm_target_feature) ) ,
@@ -259,19 +259,18 @@ const WASM_WHITELIST: &[(&str, Option<Symbol>)] = &[
259259/// When rustdoc is running, provide a list of all known features so that all their respective
260260/// primitives may be documented.
261261///
262- /// IMPORTANT: If you're adding another whitelist to the above lists, make sure to add it to this
263- /// iterator!
262+ /// IMPORTANT: If you're adding another feature list above, make sure to add it to this iterator!
264263pub fn all_known_features ( ) -> impl Iterator < Item = ( & ' static str , Option < Symbol > ) > {
265- ARM_WHITELIST
266- . iter ( )
264+ std:: iter:: empty ( )
265+ . chain ( ARM_ALLOWED_FEATURES . iter ( ) )
266+ . chain ( AARCH64_ALLOWED_FEATURES . iter ( ) )
267+ . chain ( X86_ALLOWED_FEATURES . iter ( ) )
268+ . chain ( HEXAGON_ALLOWED_FEATURES . iter ( ) )
269+ . chain ( POWERPC_ALLOWED_FEATURES . iter ( ) )
270+ . chain ( MIPS_ALLOWED_FEATURES . iter ( ) )
271+ . chain ( RISCV_ALLOWED_FEATURES . iter ( ) )
272+ . chain ( WASM_ALLOWED_FEATURES . iter ( ) )
267273 . cloned ( )
268- . chain ( AARCH64_WHITELIST . iter ( ) . cloned ( ) )
269- . chain ( X86_WHITELIST . iter ( ) . cloned ( ) )
270- . chain ( HEXAGON_WHITELIST . iter ( ) . cloned ( ) )
271- . chain ( POWERPC_WHITELIST . iter ( ) . cloned ( ) )
272- . chain ( MIPS_WHITELIST . iter ( ) . cloned ( ) )
273- . chain ( RISCV_WHITELIST . iter ( ) . cloned ( ) )
274- . chain ( WASM_WHITELIST . iter ( ) . cloned ( ) )
275274}
276275
277276pub fn to_llvm_feature < ' a > ( sess : & Session , s : & ' a str ) -> & ' a str {
@@ -289,7 +288,7 @@ pub fn to_llvm_feature<'a>(sess: &Session, s: &'a str) -> &'a str {
289288
290289pub fn target_features ( sess : & Session ) -> Vec < Symbol > {
291290 let target_machine = create_informational_target_machine ( sess) ;
292- target_feature_whitelist ( sess)
291+ supported_target_features ( sess)
293292 . iter ( )
294293 . filter_map ( |& ( feature, gate) | {
295294 if UnstableFeatures :: from_environment ( ) . is_nightly_build ( ) || gate. is_none ( ) {
@@ -307,16 +306,16 @@ pub fn target_features(sess: &Session) -> Vec<Symbol> {
307306 . collect ( )
308307}
309308
310- pub fn target_feature_whitelist ( sess : & Session ) -> & ' static [ ( & ' static str , Option < Symbol > ) ] {
309+ pub fn supported_target_features ( sess : & Session ) -> & ' static [ ( & ' static str , Option < Symbol > ) ] {
311310 match & * sess. target . target . arch {
312- "arm" => ARM_WHITELIST ,
313- "aarch64" => AARCH64_WHITELIST ,
314- "x86" | "x86_64" => X86_WHITELIST ,
315- "hexagon" => HEXAGON_WHITELIST ,
316- "mips" | "mips64" => MIPS_WHITELIST ,
317- "powerpc" | "powerpc64" => POWERPC_WHITELIST ,
318- "riscv32" | "riscv64" => RISCV_WHITELIST ,
319- "wasm32" => WASM_WHITELIST ,
311+ "arm" => ARM_ALLOWED_FEATURES ,
312+ "aarch64" => AARCH64_ALLOWED_FEATURES ,
313+ "x86" | "x86_64" => X86_ALLOWED_FEATURES ,
314+ "hexagon" => HEXAGON_ALLOWED_FEATURES ,
315+ "mips" | "mips64" => MIPS_ALLOWED_FEATURES ,
316+ "powerpc" | "powerpc64" => POWERPC_ALLOWED_FEATURES ,
317+ "riscv32" | "riscv64" => RISCV_ALLOWED_FEATURES ,
318+ "wasm32" => WASM_ALLOWED_FEATURES ,
320319 _ => & [ ] ,
321320 }
322321}
0 commit comments