Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing error with rust-version = "1.77" and cargo:: build script syntax #13807

Closed
lukas-code opened this issue Apr 26, 2024 · 0 comments · Fixed by #13808
Closed

Confusing error with rust-version = "1.77" and cargo:: build script syntax #13807

lukas-code opened this issue Apr 26, 2024 · 0 comments · Fixed by #13808
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@lukas-code
Copy link
Member

lukas-code commented Apr 26, 2024

Problem

If you set rust-version = "1.77" in Cargo.toml and use the new cargo:: build script syntax, you will get this wonderful error:

error: the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, but the minimum supported Rust version of `foo v0.1.0 (/tmp/foo)` is 1.77.

The workaround is to specify rust-version = "1.77.0", even though 1.77 and 1.77.0 mean exactly the same thing in semver.

Steps

  1. cargo new foo
  2. paste this into Cargo.toml:
[package]
name = "foo"
version = "0.1.0"
edition = "2021"
rust-version = "1.77"

[dependencies]
  1. create build.rs and paste this:
fn main() {
    println!("cargo::rerun-if-changed=.");
}
  1. cargo check

Possible Solution(s)

Maybe replace < with !is_compatible_with here:

if msrv < new_syntax_added_in {

Notes

No response

Version

cargo 1.79.0-nightly (80d5b607d 2024-04-19)
release: 1.79.0-nightly
commit-hash: 80d5b607dde6ef97dfff4e23923822c01d2bb036
commit-date: 2024-04-19
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
@lukas-code lukas-code added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Apr 26, 2024
janm-dev added a commit to janm-dev/links that referenced this issue May 8, 2024
asomers added a commit to asomers/capsicum-rs that referenced this issue Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant