@@ -42,6 +42,32 @@ mod cfg;
4242mod  native_libs; 
4343pub  mod  sigpipe; 
4444
45+ pub  const  PRINT_KINDS :  & [ ( & str ,  PrintKind ) ]  = & [ 
46+     // tidy-alphabetical-start 
47+     ( "all-target-specs-json" ,  PrintKind :: AllTargetSpecs ) , 
48+     ( "calling-conventions" ,  PrintKind :: CallingConventions ) , 
49+     ( "cfg" ,  PrintKind :: Cfg ) , 
50+     ( "check-cfg" ,  PrintKind :: CheckCfg ) , 
51+     ( "code-models" ,  PrintKind :: CodeModels ) , 
52+     ( "crate-name" ,  PrintKind :: CrateName ) , 
53+     ( "deployment-target" ,  PrintKind :: DeploymentTarget ) , 
54+     ( "file-names" ,  PrintKind :: FileNames ) , 
55+     ( "host-tuple" ,  PrintKind :: HostTuple ) , 
56+     ( "link-args" ,  PrintKind :: LinkArgs ) , 
57+     ( "native-static-libs" ,  PrintKind :: NativeStaticLibs ) , 
58+     ( "relocation-models" ,  PrintKind :: RelocationModels ) , 
59+     ( "split-debuginfo" ,  PrintKind :: SplitDebuginfo ) , 
60+     ( "stack-protector-strategies" ,  PrintKind :: StackProtectorStrategies ) , 
61+     ( "sysroot" ,  PrintKind :: Sysroot ) , 
62+     ( "target-cpus" ,  PrintKind :: TargetCPUs ) , 
63+     ( "target-features" ,  PrintKind :: TargetFeatures ) , 
64+     ( "target-libdir" ,  PrintKind :: TargetLibdir ) , 
65+     ( "target-list" ,  PrintKind :: TargetList ) , 
66+     ( "target-spec-json" ,  PrintKind :: TargetSpec ) , 
67+     ( "tls-models" ,  PrintKind :: TlsModels ) , 
68+     // tidy-alphabetical-end 
69+ ] ; 
70+ 
4571/// The different settings that the `-C strip` flag can have. 
4672#[ derive( Clone ,  Copy ,  PartialEq ,  Hash ,  Debug ) ]  
4773pub  enum  Strip  { 
@@ -1508,6 +1534,13 @@ The default is {DEFAULT_EDITION} and the latest stable edition is {LATEST_STABLE
15081534    ) 
15091535} ) ; 
15101536
1537+ static  PRINT_KINDS_STRING :  LazyLock < String >  = LazyLock :: new ( || { 
1538+     format ! ( 
1539+         "[{}]" , 
1540+         PRINT_KINDS . iter( ) . map( |( name,  _) | format!( "{name}" ) ) . collect:: <Vec <_>>( ) . join( "|" ) 
1541+     ) 
1542+ } ) ; 
1543+ 
15111544/// Returns all rustc command line options, including metadata for 
15121545/// each option, such as whether the option is stable. 
15131546pub  fn  rustc_optgroups ( )  -> Vec < RustcOptGroup >  { 
@@ -1568,10 +1601,7 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
15681601            "" , 
15691602            "print" , 
15701603            "Compiler information to print on stdout" , 
1571-             "[crate-name|file-names|sysroot|target-libdir|cfg|check-cfg|calling-conventions|\  
1572- \ 
1573- \ 
1574- , 
1604+             & PRINT_KINDS_STRING , 
15751605        ) , 
15761606        opt( Stable ,  FlagMulti ,  "g" ,  "" ,  "Equivalent to -C debuginfo=2" ,  "" ) , 
15771607        opt( Stable ,  FlagMulti ,  "O" ,  "" ,  "Equivalent to -C opt-level=3" ,  "" ) , 
@@ -1999,32 +2029,6 @@ fn collect_print_requests(
19992029        cg. target_feature  = String :: new ( ) ; 
20002030    } 
20012031
2002-     const  PRINT_KINDS :  & [ ( & str ,  PrintKind ) ]  = & [ 
2003-         // tidy-alphabetical-start 
2004-         ( "all-target-specs-json" ,  PrintKind :: AllTargetSpecs ) , 
2005-         ( "calling-conventions" ,  PrintKind :: CallingConventions ) , 
2006-         ( "cfg" ,  PrintKind :: Cfg ) , 
2007-         ( "check-cfg" ,  PrintKind :: CheckCfg ) , 
2008-         ( "code-models" ,  PrintKind :: CodeModels ) , 
2009-         ( "crate-name" ,  PrintKind :: CrateName ) , 
2010-         ( "deployment-target" ,  PrintKind :: DeploymentTarget ) , 
2011-         ( "file-names" ,  PrintKind :: FileNames ) , 
2012-         ( "host-tuple" ,  PrintKind :: HostTuple ) , 
2013-         ( "link-args" ,  PrintKind :: LinkArgs ) , 
2014-         ( "native-static-libs" ,  PrintKind :: NativeStaticLibs ) , 
2015-         ( "relocation-models" ,  PrintKind :: RelocationModels ) , 
2016-         ( "split-debuginfo" ,  PrintKind :: SplitDebuginfo ) , 
2017-         ( "stack-protector-strategies" ,  PrintKind :: StackProtectorStrategies ) , 
2018-         ( "sysroot" ,  PrintKind :: Sysroot ) , 
2019-         ( "target-cpus" ,  PrintKind :: TargetCPUs ) , 
2020-         ( "target-features" ,  PrintKind :: TargetFeatures ) , 
2021-         ( "target-libdir" ,  PrintKind :: TargetLibdir ) , 
2022-         ( "target-list" ,  PrintKind :: TargetList ) , 
2023-         ( "target-spec-json" ,  PrintKind :: TargetSpec ) , 
2024-         ( "tls-models" ,  PrintKind :: TlsModels ) , 
2025-         // tidy-alphabetical-end 
2026-     ] ; 
2027- 
20282032    // We disallow reusing the same path in multiple prints, such as `--print 
20292033    // cfg=output.txt --print link-args=output.txt`, because outputs are printed 
20302034    // by disparate pieces of the compiler, and keeping track of which files 
0 commit comments