@@ -2580,9 +2580,19 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
2580
2580
) ;
2581
2581
}
2582
2582
2583
- // Until the unstable flag is removed, ensure `-Zgcc-ld=lld` and `-Clinker-flavor=gcc:lld` have
2584
- // a matching linker choice.
2585
2583
if let Some ( LinkerFlavorCli :: Gcc { use_ld } ) = & cg. linker_flavor {
2584
+ // For testing purposes, until we have more feedback about these options: ensure `-Z
2585
+ // unstable-options` enabled when using the `gcc` linker flavor enrichments.
2586
+ if !debugging_opts. unstable_options {
2587
+ early_error (
2588
+ error_format,
2589
+ "the `gcc:*` linker flavor is unstable, the `-Z unstable-options` \
2590
+ flag must also be passed to use it",
2591
+ ) ;
2592
+ }
2593
+
2594
+ // Until the unstable flag is removed, ensure `-Zgcc-ld=lld` and `-Clinker-flavor=gcc:lld`
2595
+ // have a matching linker choice.
2586
2596
if use_ld != "lld" && debugging_opts. gcc_ld == Some ( LdImpl :: Lld ) {
2587
2597
early_error (
2588
2598
error_format,
@@ -2592,6 +2602,26 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
2592
2602
}
2593
2603
}
2594
2604
2605
+ // For testing purposes, until we have more feedback about these options: ensure `-Z
2606
+ // unstable-options` is enabled when using the unstable `-C link-self-contained` options.
2607
+ if !debugging_opts. unstable_options {
2608
+ let uses_unstable_self_contained_option =
2609
+ matches. opt_strs ( "C" ) . iter ( ) . any ( |option| match option. as_str ( ) {
2610
+ "link-self-contained=crt"
2611
+ | "link-self-contained=auto"
2612
+ | "link-self-contained=linker"
2613
+ | "link-self-contained=all" => true ,
2614
+ _ => false ,
2615
+ } ) ;
2616
+ if uses_unstable_self_contained_option {
2617
+ early_error (
2618
+ error_format,
2619
+ "only `-C link-self-contained` values `y`/`yes`/`on`/`n`/`no`/`off` are stable, \
2620
+ the `-Z unstable-options` flag must also be passed to use the unstable values",
2621
+ ) ;
2622
+ }
2623
+ }
2624
+
2595
2625
let prints = collect_print_requests ( & mut cg, & mut debugging_opts, matches, error_format) ;
2596
2626
2597
2627
let cg = cg;
0 commit comments