Skip to content

Commit e20d93a

Browse files
committed
make codegen-backend config warning less noisy
If `codegen-backends` is missing "cranelift" and "gcc" (which is common), bootstrap will now only show this warning during `dist` and `install` steps, or if codegen-backends was explicitly called for build. Signed-off-by: onur-ozkan <[email protected]>
1 parent 7676171 commit e20d93a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/bootstrap/src/core/build_steps/compile.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -1291,15 +1291,21 @@ fn needs_codegen_config(run: &RunConfig<'_>) -> bool {
12911291
pub(crate) const CODEGEN_BACKEND_PREFIX: &str = "rustc_codegen_";
12921292

12931293
fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool {
1294-
if path.path.to_str().unwrap().contains(CODEGEN_BACKEND_PREFIX) {
1294+
let path = path.path.to_str().unwrap();
1295+
1296+
let is_explicitly_called = |p| -> bool { run.builder.paths.contains(p) };
1297+
let should_enforce = run.builder.kind == Kind::Dist || run.builder.kind == Kind::Install;
1298+
1299+
if path.contains(CODEGEN_BACKEND_PREFIX) {
12951300
let mut needs_codegen_backend_config = true;
12961301
for backend in run.builder.config.codegen_backends(run.target) {
1297-
if path.path.to_str().unwrap().ends_with(&(CODEGEN_BACKEND_PREFIX.to_owned() + backend))
1298-
{
1302+
if path.ends_with(&(CODEGEN_BACKEND_PREFIX.to_owned() + backend)) {
12991303
needs_codegen_backend_config = false;
13001304
}
13011305
}
1302-
if needs_codegen_backend_config {
1306+
if (is_explicitly_called(&PathBuf::from(path)) || should_enforce)
1307+
&& needs_codegen_backend_config
1308+
{
13031309
run.builder.info(
13041310
"WARNING: no codegen-backends config matched the requested path to build a codegen backend. \
13051311
HELP: add backend to codegen-backends in config.toml.",

0 commit comments

Comments
 (0)