@@ -342,6 +342,19 @@ const CSKY_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
342342 ( "hard-float-abi" , Some ( sym:: csky_target_feature) ) ,
343343 // tidy-alphabetical-end
344344] ;
345+
346+ const LOONGARCH_ALLOWED_FEATURES : & [ ( & str , Option < Symbol > ) ] = & [
347+ // tidy-alphabetical-start
348+ ( "d" , Some ( sym:: loongarch_target_feature) ) ,
349+ ( "f" , Some ( sym:: loongarch_target_feature) ) ,
350+ ( "lasx" , Some ( sym:: loongarch_target_feature) ) ,
351+ ( "lbt" , Some ( sym:: loongarch_target_feature) ) ,
352+ ( "lsx" , Some ( sym:: loongarch_target_feature) ) ,
353+ ( "lvz" , Some ( sym:: loongarch_target_feature) ) ,
354+ ( "ual" , Some ( sym:: loongarch_target_feature) ) ,
355+ // tidy-alphabetical-end
356+ ] ;
357+
345358/// When rustdoc is running, provide a list of all known features so that all their respective
346359/// primitives may be documented.
347360///
@@ -358,6 +371,7 @@ pub fn all_known_features() -> impl Iterator<Item = (&'static str, Option<Symbol
358371 . chain ( WASM_ALLOWED_FEATURES . iter ( ) )
359372 . chain ( BPF_ALLOWED_FEATURES . iter ( ) )
360373 . chain ( CSKY_ALLOWED_FEATURES )
374+ . chain ( LOONGARCH_ALLOWED_FEATURES )
361375 . cloned ( )
362376}
363377
@@ -373,6 +387,7 @@ pub fn supported_target_features(sess: &Session) -> &'static [(&'static str, Opt
373387 "wasm32" | "wasm64" => WASM_ALLOWED_FEATURES ,
374388 "bpf" => BPF_ALLOWED_FEATURES ,
375389 "csky" => CSKY_ALLOWED_FEATURES ,
390+ "loongarch64" => LOONGARCH_ALLOWED_FEATURES ,
376391 _ => & [ ] ,
377392 }
378393}
@@ -445,6 +460,7 @@ pub fn from_target_feature(
445460 Some ( sym:: bpf_target_feature) => rust_features. bpf_target_feature ,
446461 Some ( sym:: aarch64_ver_target_feature) => rust_features. aarch64_ver_target_feature ,
447462 Some ( sym:: csky_target_feature) => rust_features. csky_target_feature ,
463+ Some ( sym:: loongarch_target_feature) => rust_features. loongarch_target_feature ,
448464 Some ( name) => bug ! ( "unknown target feature gate {}" , name) ,
449465 None => true ,
450466 } ;
0 commit comments