Open ijackson opened 1 month ago
It turns out that while 1.56 ignores this, it was made deprecated somewhere between that and 1.76.
I think it makes sense being a hard error since it might be a typo hard to catch. As suggested from the error message, developers are able to just switch to the single colon version. There is also a feature release schedule mix between rustc-check-cfg
and ::
syntax, so the behavior. We can't travel back to patch 1.76, so I feel like it would be a wontfix.
Anything blocking you from switching to the single colon cargo:rustc-check-cfg
?
See https://github.com/rust-lang/cargo/issues/13868. If there is any documentation improvement can be done, let us know.
Anything blocking you from switching to the single colon
cargo:rustc-check-cfg
?
Not if it's going to be supported indefinitely.
One problem I have is that I accidentally broke the MSRV of my crate. I have CI tests that test with 1.56, which didn't detect this. Normally Rust's stability guarantee would mean that if 1.56 works, so would 1.76. But that's not the case here.
How many different Rust versions do I need to test with in CI. if I want to know that all versions since my MSRV will work? Which versions should I choose?
ETA: my ticket forpreventing this happening again: https://gitlab.torproject.org/Diziet/rust-derive-deftly/-/issues/104
One problem I have is that I accidentally broke the MSRV of my crate. I have CI tests that test with 1.56, which didn't detect this. Normally Rust's stability guarantee would mean that if 1.56 works, so would 1.76. But that's not the case here.
That is unfortunate. For Cargo.toml
we intentionally allow unknown fields to reduce the risk of breaking things in future releases. We missed the scenario that people will opt-in a new syntax from 1.77 in a package with an older MSRV. It's always hard if we allowed a wildcard like syntax from the beginning then we made some change breaking people.
This is a useful reminder that emitting errors should follow pretty much the same compatibility practice as changes to Cargo.toml and config.toml when developing. Thank you for this bug report. I've opened #14150 for such a principle.
Problem
The check for the
cargo::
(double colon) syntax should apply only to directives that the MSRV would understand.Steps
Cargo.toml
:build.rs
:Expected output: it compiles.
Actual output:
Possible Solution(s)
Accept
cargo::
syntax unless the directive that follows::
is one that a compiler which only supports:
would understand.Notes
Unknown diretives are ignored, so
cargo::rustc-check-cfg
is completely fine. I htink no version of rust that would understandrustc-check-cfg
at all, doesn't understand::
.Version