Skip to content

Commit 11ef337

Browse files
committed
Mark @RUSTC_BUILTIN search path usage as unstable
1 parent a77f76e commit 11ef337

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

Diff for: compiler/rustc_interface/src/tests.rs

+1
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ fn test_search_paths_tracking_hash_different_order() {
321321
&opts.target_triple,
322322
&early_dcx,
323323
search_path,
324+
false,
324325
));
325326
};
326327

Diff for: compiler/rustc_session/src/config.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -2548,7 +2548,13 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
25482548

25492549
let mut search_paths = vec![];
25502550
for s in &matches.opt_strs("L") {
2551-
search_paths.push(SearchPath::from_cli_opt(&sysroot, &target_triple, early_dcx, s));
2551+
search_paths.push(SearchPath::from_cli_opt(
2552+
&sysroot,
2553+
&target_triple,
2554+
early_dcx,
2555+
s,
2556+
unstable_opts.unstable_options,
2557+
));
25522558
}
25532559

25542560
let working_dir = std::env::current_dir().unwrap_or_else(|e| {

Diff for: compiler/rustc_session/src/search_paths.rs

+8
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ impl SearchPath {
5252
triple: &TargetTriple,
5353
early_dcx: &EarlyDiagCtxt,
5454
path: &str,
55+
is_unstable_enabled: bool,
5556
) -> Self {
5657
let (kind, path) = if let Some(stripped) = path.strip_prefix("native=") {
5758
(PathKind::Native, stripped)
@@ -68,6 +69,13 @@ impl SearchPath {
6869
};
6970
let dir = match path.strip_prefix("@RUSTC_BUILTIN") {
7071
Some(stripped) => {
72+
if !is_unstable_enabled {
73+
early_dcx.early_fatal(
74+
"the `-Z unstable-options` flag must also be passed to \
75+
enable the use of `@RUSTC_BUILTIN`",
76+
);
77+
}
78+
7179
make_target_lib_path(sysroot, triple.triple()).join("builtin").join(stripped)
7280
}
7381
None => PathBuf::from(path),

Diff for: src/librustdoc/config.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,15 @@ impl Options {
635635
let libs = matches
636636
.opt_strs("L")
637637
.iter()
638-
.map(|s| SearchPath::from_cli_opt(&sysroot, &target, early_dcx, s))
638+
.map(|s| {
639+
SearchPath::from_cli_opt(
640+
&sysroot,
641+
&target,
642+
early_dcx,
643+
s,
644+
unstable_opts.unstable_options,
645+
)
646+
})
639647
.collect();
640648

641649
let show_coverage = matches.opt_present("show-coverage");

0 commit comments

Comments
 (0)