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