-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
cargo add
deletes comments in TOML unexpectedly under certain conditions
#13645
Comments
cyqsimon
added
C-bug
Category: bug
S-triage
Status: This issue is waiting on initial triage.
labels
Mar 26, 2024
Can you try this on nightly? i believe this was fixed in #13402 |
Nope. Unless $ cargo +nightly -Vv
cargo 1.79.0-nightly (d438c80c4 2024-03-19)
release: 1.79.0-nightly
commit-hash: d438c80c45c24be676ef5867edc79d0a14910efe
commit-date: 2024-03-19
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.2 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
os: EndeavourOS Rolling Release (rolling) [64-bit]
$ cargo +nightly add serde
# Same behaviour |
epage
added a commit
to epage/cargo
that referenced
this issue
Mar 26, 2024
A case the tests showed but isn't covered here is when a `[features]` table is created, the dependencies-end comment gets attached to that, e.g. see cargo_add/overwrite_optional Fixes rust-lang#13645
bors
added a commit
that referenced
this issue
Mar 27, 2024
fix(add): Preserve comments when updating simple deps ### What does this PR try to resolve? Fixes #13645 ### How should we test and review this PR? A case the tests showed but isn't covered here is when a `[features]` table is created, the dependencies-end comment gets attached to that, e.g. see cargo_add/overwrite_optional ### Additional information
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
Running
cargo add <EXISTING_DEP>
causes the preceding comments to be deleted inCargo.toml
.Steps
cargo new
Cargo.toml
:cargo add chrono/serde
(in practise the likely reason you do this is to specify additional features, but that's not necessary for a MRE)Possible Solution(s)
No response
Notes
No response
Version
The text was updated successfully, but these errors were encountered: