Skip to content

Commit 271a11a

Browse files
committed
require -Z unstable-options to use the link-self-contained new flag values
only the stable values for `-Clink-self-contained` can be used on stable until we have more feedback on the interface
1 parent 3368b62 commit 271a11a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

compiler/rustc_session/src/config.rs

+20
Original file line numberDiff line numberDiff line change
@@ -2543,6 +2543,26 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
25432543
);
25442544
}
25452545

2546+
// For testing purposes, until we have more feedback about these options: ensure `-Z
2547+
// unstable-options` is enabled when using the unstable `-C link-self-contained` options.
2548+
if !debugging_opts.unstable_options {
2549+
let uses_unstable_self_contained_option =
2550+
matches.opt_strs("C").iter().any(|option| match option.as_str() {
2551+
"link-self-contained=crt"
2552+
| "link-self-contained=auto"
2553+
| "link-self-contained=linker"
2554+
| "link-self-contained=all" => true,
2555+
_ => false,
2556+
});
2557+
if uses_unstable_self_contained_option {
2558+
early_error(
2559+
error_format,
2560+
"only `-C link-self-contained` values `y`/`yes`/`on`/`n`/`no`/`off` are stable, \
2561+
the `-Z unstable-options` flag must also be passed to use the unstable values",
2562+
);
2563+
}
2564+
}
2565+
25462566
let prints = collect_print_requests(&mut cg, &mut debugging_opts, matches, error_format);
25472567

25482568
let cg = cg;

0 commit comments

Comments
 (0)