But that’s what you can already do! I mean, here’s a snippet from scan-rules’ current build.rs:
/*
See <https://github.com/rust-lang/rust/issues/26448#issuecomment-173794570>.
*/
if version_matches("< 1.7.0") {
println!("cargo:rustc-cfg=str_into_output_extra_broken");
}
Also, you’re dangerously close to a strawman argument: I never said the only way to do this should be compiler-defined feature flags. Even if that was a thing, you’re quite right, it’s still helpful to define your own, which is what you can already do.
I mean, yeah, but that just changes the optics of those errors (if it won’t compile, it won’t compile, just with a different message). It doesn’t make code that wouldn’t have otherwise compiled work (which adding this to Cargo could). Also, this is coming from someone who previously proposed more or less exactly what you’re proposing now, so it’s not like I think it’s a bad idea… just a possible misapplication of effort.