@@ -545,6 +545,7 @@ pub enum PrintRequest {
545
545
NativeStaticLibs ,
546
546
StackProtectorStrategies ,
547
547
LinkArgs ,
548
+ RustcPath ,
548
549
}
549
550
550
551
pub enum Input {
@@ -1777,6 +1778,20 @@ fn collect_print_requests(
1777
1778
cg. target_feature = String :: new ( ) ;
1778
1779
}
1779
1780
1781
+ let gate = |req, opt| {
1782
+ if unstable_opts. unstable_options {
1783
+ req
1784
+ } else {
1785
+ early_error (
1786
+ error_format,
1787
+ & format ! (
1788
+ "the `-Z unstable-options` flag must also be passed to \
1789
+ enable the {opt} print option",
1790
+ ) ,
1791
+ ) ;
1792
+ }
1793
+ } ;
1794
+
1780
1795
prints. extend ( matches. opt_strs ( "print" ) . into_iter ( ) . map ( |s| match & * s {
1781
1796
"crate-name" => PrintRequest :: CrateName ,
1782
1797
"file-names" => PrintRequest :: FileNames ,
@@ -1791,18 +1806,9 @@ fn collect_print_requests(
1791
1806
"tls-models" => PrintRequest :: TlsModels ,
1792
1807
"native-static-libs" => PrintRequest :: NativeStaticLibs ,
1793
1808
"stack-protector-strategies" => PrintRequest :: StackProtectorStrategies ,
1794
- "target-spec-json" => {
1795
- if unstable_opts. unstable_options {
1796
- PrintRequest :: TargetSpec
1797
- } else {
1798
- early_error (
1799
- error_format,
1800
- "the `-Z unstable-options` flag must also be passed to \
1801
- enable the target-spec-json print option",
1802
- ) ;
1803
- }
1804
- }
1809
+ "target-spec-json" => gate ( PrintRequest :: TargetSpec , "target-spec-json" ) ,
1805
1810
"link-args" => PrintRequest :: LinkArgs ,
1811
+ "rustc-path" => gate ( PrintRequest :: RustcPath , "rustc-path" ) ,
1806
1812
req => early_error ( error_format, & format ! ( "unknown print request `{req}`" ) ) ,
1807
1813
} ) ) ;
1808
1814
0 commit comments