@@ -1747,19 +1747,24 @@ impl Config {
17471747 . unwrap_or ( self . profiler )
17481748 }
17491749
1750- pub fn codegen_backends ( & self , target : TargetSelection ) -> & [ CodegenBackendKind ] {
1750+ /// Returns codegen backends that should be:
1751+ /// - Built and added to the sysroot when we build the compiler.
1752+ /// - Distributed when `x dist` is executed (if the codegen backend has a dist step).
1753+ pub fn enabled_codegen_backends ( & self , target : TargetSelection ) -> & [ CodegenBackendKind ] {
17511754 self . target_config
17521755 . get ( & target)
17531756 . and_then ( |cfg| cfg. codegen_backends . as_deref ( ) )
17541757 . unwrap_or ( & self . rust_codegen_backends )
17551758 }
17561759
1757- pub fn jemalloc ( & self , target : TargetSelection ) -> bool {
1758- self . target_config . get ( & target) . and_then ( |cfg| cfg. jemalloc ) . unwrap_or ( self . jemalloc )
1760+ /// Returns the codegen backend that should be configured as the *default* codegen backend
1761+ /// for a rustc compiled by bootstrap.
1762+ pub fn default_codegen_backend ( & self , target : TargetSelection ) -> Option < CodegenBackendKind > {
1763+ self . enabled_codegen_backends ( target) . first ( ) . cloned ( )
17591764 }
17601765
1761- pub fn default_codegen_backend ( & self , target : TargetSelection ) -> Option < CodegenBackendKind > {
1762- self . codegen_backends ( target) . first ( ) . cloned ( )
1766+ pub fn jemalloc ( & self , target : TargetSelection ) -> bool {
1767+ self . target_config . get ( & target) . and_then ( |cfg| cfg . jemalloc ) . unwrap_or ( self . jemalloc )
17631768 }
17641769
17651770 pub fn rpath_enabled ( & self , target : TargetSelection ) -> bool {
@@ -1774,7 +1779,7 @@ impl Config {
17741779 }
17751780
17761781 pub fn llvm_enabled ( & self , target : TargetSelection ) -> bool {
1777- self . codegen_backends ( target) . contains ( & CodegenBackendKind :: Llvm )
1782+ self . enabled_codegen_backends ( target) . contains ( & CodegenBackendKind :: Llvm )
17781783 }
17791784
17801785 pub fn llvm_libunwind ( & self , target : TargetSelection ) -> LlvmLibunwind {
0 commit comments