Skip to content

Bootstrap ignores unknown values for codegen-backends #142184

@GrigorenkoPV

Description

@GrigorenkoPV

if let Some(ref backends) = codegen_backends {
let available_backends = ["llvm", "cranelift", "gcc"];
self.rust_codegen_backends = backends.iter().map(|s| {
if let Some(backend) = s.strip_prefix(CODEGEN_BACKEND_PREFIX) {
if available_backends.contains(&backend) {
panic!("Invalid value '{s}' for 'rust.codegen-backends'. Instead, please use '{backend}'.");
} else {
println!("HELP: '{s}' for 'rust.codegen-backends' might fail. \
Codegen backends are mostly defined without the '{CODEGEN_BACKEND_PREFIX}' prefix. \
In this case, it would be referred to as '{backend}'.");
}
}
s.clone()
}).collect();
}

If the value does not start with CODEGEN_BACKEND_PREFIX, it is just not validated at all.

So it means that typing gccc instead of gcc will cause no warning or error to be shown and gcc backend not actually being enabled.

Same issue for target-specific codegen options.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions