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

In Cargo.toml I missspelled "version" and it still worked, but after I corrected it I now get compile errors. #13918

Closed
exo-cortex opened this issue May 15, 2024 · 3 comments
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@exo-cortex
Copy link

Problem

The code is in this github repo: https://github.com/exo-cortex/simple_axum_button_response
In Cargo.toml I missspelled "version" in the line

tower-http = { verion = "0.4", features = ["fs"] }

Everything still worked fine and compiled without errors.
But once I corrected the mistake my project now does not compile anymore. I don't completely understand what's happening here. While compiling cargo displayed that it compiled tower-html v0.5.2 - so it somehow read the package name, but ignored the malformed version-statement.

I fixed my problem with the newer version (that cargo somehow used), but It is problematic IMHO that cargo does not warn the user of a misspelled dependency version statement; I did not correctly state the version and it still installed some version.
I don't think this is intended.

Steps

  1. git clone the repo at https://github.com/exo-cortex/simple_axum_button_response
  2. run cargo build
  3. correct the misspelled word "verion" in Cargo.toml
  4. run cargo build again
    this should give you an errror.

Possible Solution(s)

Check toml file integrity when running cargo commands and warn user.

Notes

No response

Version

No response

@exo-cortex exo-cortex added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels May 15, 2024
@epage
Copy link
Contributor

epage commented May 15, 2024

Cargo had a bug where a missing version was treated as version = "*". After a several year transition period for people to stop relying on the bug, we've fixed it in #13775 which will be released in 1.79

Closing as this appears to be resolved. If there is a reason for us to keep this open, let us know.

btw you should have at least gotten the following (I do follow the reproduction steps)

warning: dependency (tower-http) specified without providing a local path, Git repository, version, or workspace dependency to use. This will be considered an error in future versions
warning: unused manifest key: dependencies.tower-http.verion

@epage epage closed this as completed May 15, 2024
@weihanglo
Copy link
Member

This is the other relevant issue tracking for typo correction for Cargo.toml: #9731

@exo-cortex
Copy link
Author

@epage
You're absolutely right! I somehow didn't see it, but it was there. Thank you.

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

No branches or pull requests

3 participants