@@ -894,6 +894,7 @@ pub const fn default_lib_output() -> CrateType {
894894
895895fn default_configuration ( sess : & Session ) -> CrateConfig {
896896 // NOTE: This should be kept in sync with `CrateCheckConfig::fill_well_known` below.
897+ let tar = & sess. opts . target_triple . triple ( ) ;
897898 let end = & sess. target . endian ;
898899 let arch = & sess. target . arch ;
899900 let wordsz = sess. target . pointer_width . to_string ( ) ;
@@ -909,8 +910,10 @@ fn default_configuration(sess: &Session) -> CrateConfig {
909910 } ) ;
910911
911912 let mut ret = FxHashSet :: default ( ) ;
912- ret. reserve ( 7 ) ; // the minimum number of insertions
913+ ret. reserve ( 9 ) ; // the minimum number of insertions
914+
913915 // Target bindings.
916+ ret. insert ( ( sym:: target, Some ( Symbol :: intern ( tar) ) ) ) ;
914917 ret. insert ( ( sym:: target_os, Some ( Symbol :: intern ( os) ) ) ) ;
915918 for fam in sess. target . families . as_ref ( ) {
916919 ret. insert ( ( sym:: target_family, Some ( Symbol :: intern ( fam) ) ) ) ;
@@ -1031,6 +1034,7 @@ impl CrateCheckConfig {
10311034 // rustc
10321035 sym:: unix,
10331036 sym:: windows,
1037+ sym:: target,
10341038 sym:: target_os,
10351039 sym:: target_family,
10361040 sym:: target_arch,
@@ -1120,9 +1124,11 @@ impl CrateCheckConfig {
11201124 . extend ( atomic_values) ;
11211125
11221126 // Target specific values
1123- for target in
1124- TARGETS . iter ( ) . map ( |target| Target :: expect_builtin ( & TargetTriple :: from_triple ( target) ) )
1127+ for ( name, target) in TARGETS
1128+ . iter ( )
1129+ . map ( |target| ( target, Target :: expect_builtin ( & TargetTriple :: from_triple ( target) ) ) )
11251130 {
1131+ self . values_valid . entry ( sym:: target) . or_default ( ) . insert ( Symbol :: intern ( & name) ) ;
11261132 self . values_valid
11271133 . entry ( sym:: target_os)
11281134 . or_default ( )
0 commit comments