@@ -42,6 +42,32 @@ mod cfg;
42
42
mod native_libs;
43
43
pub mod sigpipe;
44
44
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
+
45
71
/// The different settings that the `-C strip` flag can have.
46
72
#[ derive( Clone , Copy , PartialEq , Hash , Debug ) ]
47
73
pub enum Strip {
@@ -1508,6 +1534,13 @@ The default is {DEFAULT_EDITION} and the latest stable edition is {LATEST_STABLE
1508
1534
)
1509
1535
} ) ;
1510
1536
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
+
1511
1544
/// Returns all rustc command line options, including metadata for
1512
1545
/// each option, such as whether the option is stable.
1513
1546
pub fn rustc_optgroups ( ) -> Vec < RustcOptGroup > {
@@ -1568,10 +1601,7 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
1568
1601
"" ,
1569
1602
"print" ,
1570
1603
"Compiler information to print on stdout" ,
1571
- "[crate-name|file-names|sysroot|target-libdir|cfg|check-cfg|calling-conventions|\
1572
- target-list|target-cpus|target-features|relocation-models|code-models|\
1573
- tls-models|target-spec-json|all-target-specs-json|native-static-libs|\
1574
- stack-protector-strategies|link-args|deployment-target]",
1604
+ & PRINT_KINDS_STRING ,
1575
1605
) ,
1576
1606
opt( Stable , FlagMulti , "g" , "" , "Equivalent to -C debuginfo=2" , "" ) ,
1577
1607
opt( Stable , FlagMulti , "O" , "" , "Equivalent to -C opt-level=3" , "" ) ,
@@ -1999,32 +2029,6 @@ fn collect_print_requests(
1999
2029
cg. target_feature = String :: new ( ) ;
2000
2030
}
2001
2031
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
-
2028
2032
// We disallow reusing the same path in multiple prints, such as `--print
2029
2033
// cfg=output.txt --print link-args=output.txt`, because outputs are printed
2030
2034
// by disparate pieces of the compiler, and keeping track of which files
0 commit comments