@@ -293,6 +293,19 @@ const WASM_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
293
293
294
294
const BPF_ALLOWED_FEATURES : & [ ( & str , Option < Symbol > ) ] = & [ ( "alu32" , Some ( sym:: bpf_target_feature) ) ] ;
295
295
296
+
297
+ const LOONGARCH_ALLOWED_FEATURES : & [ ( & str , Option < Symbol > ) ] = & [
298
+ // tidy-alphabetical-start
299
+ ( "d" , Some ( sym:: loongarch_target_feature) ) ,
300
+ ( "f" , Some ( sym:: loongarch_target_feature) ) ,
301
+ ( "lasx" , Some ( sym:: loongarch_target_feature) ) ,
302
+ ( "lbt" , Some ( sym:: loongarch_target_feature) ) ,
303
+ ( "lsx" , Some ( sym:: loongarch_target_feature) ) ,
304
+ ( "lvz" , Some ( sym:: loongarch_target_feature) ) ,
305
+ ( "ual" , Some ( sym:: loongarch_target_feature) ) ,
306
+ // tidy-alphabetical-end
307
+ ] ;
308
+
296
309
/// When rustdoc is running, provide a list of all known features so that all their respective
297
310
/// primitives may be documented.
298
311
///
@@ -308,6 +321,7 @@ pub fn all_known_features() -> impl Iterator<Item = (&'static str, Option<Symbol
308
321
. chain ( RISCV_ALLOWED_FEATURES . iter ( ) )
309
322
. chain ( WASM_ALLOWED_FEATURES . iter ( ) )
310
323
. chain ( BPF_ALLOWED_FEATURES . iter ( ) )
324
+ . chain ( LOONGARCH_ALLOWED_FEATURES )
311
325
. cloned ( )
312
326
}
313
327
@@ -322,6 +336,7 @@ pub fn supported_target_features(sess: &Session) -> &'static [(&'static str, Opt
322
336
"riscv32" | "riscv64" => RISCV_ALLOWED_FEATURES ,
323
337
"wasm32" | "wasm64" => WASM_ALLOWED_FEATURES ,
324
338
"bpf" => BPF_ALLOWED_FEATURES ,
339
+ "loongarch64" => LOONGARCH_ALLOWED_FEATURES ,
325
340
_ => & [ ] ,
326
341
}
327
342
}
@@ -399,6 +414,7 @@ pub fn from_target_feature(
399
414
Some ( sym:: ermsb_target_feature) => rust_features. ermsb_target_feature ,
400
415
Some ( sym:: bpf_target_feature) => rust_features. bpf_target_feature ,
401
416
Some ( sym:: aarch64_ver_target_feature) => rust_features. aarch64_ver_target_feature ,
417
+ Some ( sym:: loongarch_target_feature) => rust_features. loongarch_target_feature ,
402
418
Some ( name) => bug ! ( "unknown target feature gate {}" , name) ,
403
419
None => true ,
404
420
} ;
0 commit comments