Skip to content

Commit 521e707

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 f76c3b7 commit 521e707

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
@@ -1290,15 +1290,21 @@ fn needs_codegen_config(run: &RunConfig<'_>) -> bool {
12901290
pub(crate) const CODEGEN_BACKEND_PREFIX: &str = "rustc_codegen_";
12911291

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

0 commit comments

Comments
 (0)