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

cargo-fmt reports weird version on nightly #137666

Open
Kobzol opened this issue Feb 26, 2025 · 7 comments
Open

cargo-fmt reports weird version on nightly #137666

Kobzol opened this issue Feb 26, 2025 · 7 comments
Labels
A-rustfmt Area: Rustfmt C-bug Category: This is a bug. E-needs-investigation Call for partcipation: This issues needs some investigation to determine current status T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue.

Comments

@Kobzol
Copy link
Contributor

Kobzol commented Feb 26, 2025

$ rustup update nightly
$ cd .rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin
$ ./cargo-fmt --version
rustfmt 1.8.0-stable (4d91de4e48 2025-02-17)
$ ./rustfmt --version
rustfmt 1.8.0-nightly (85abb27636 2025-02-25)

The version has a different date than rustfmt, which I would perhaps understand, but it's a bit weird that it says -stable even though it's in the nightly toolchain.

It's possible that #137541 might fix this, we'll see after the next nightly is released.

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 26, 2025
@Kobzol Kobzol removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 26, 2025
@onur-ozkan onur-ozkan added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Feb 26, 2025
@jieyouxu jieyouxu added A-stability Area: `#[stable]`, `#[unstable]` etc. C-bug Category: This is a bug. E-needs-investigation Call for partcipation: This issues needs some investigation to determine current status and removed A-stability Area: `#[stable]`, `#[unstable]` etc. labels Feb 26, 2025
@onur-ozkan
Copy link
Member

I did a quick check, #137541 doesn't fix this.

@onur-ozkan
Copy link
Member

Clippy doesn't have this problem. Since both tools share common implementations I assume there might be some internal logic in src/tools/rustfmt.

@jieyouxu jieyouxu added the A-rustfmt Area: Rustfmt label Feb 26, 2025
@xizheyin
Copy link
Contributor

xizheyin commented Mar 6, 2025

It has been fixed?

xxxxxx:~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin$ ./cargo-fmt --version
rustfmt 1.8.0-nightly (30f168ef81 2025-03-05)
xxxxxx:~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin$ ./rustfmt --version
rustfmt 1.8.0-nightly (30f168ef81 2025-03-05)

@Kobzol
Copy link
Contributor Author

Kobzol commented Mar 6, 2025

I still see this:

~/.rustup$ ./toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo-fmt --version
rustfmt 1.8.0-stable (4d91de4e48 2025-02-17)

@xizheyin
Copy link
Contributor

xizheyin commented Mar 6, 2025

Try to update the nightly? rustup toolchain update nightly
It seems to be old version nightly.

xxxxxxx:~/rust$ rustup toolchain update nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'

  nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.87.0-nightly (30f168ef8 2025-03-05)

info: checking for self-update

@Kobzol
Copy link
Contributor Author

Kobzol commented Mar 6, 2025

No it is updated :) That's why it's super weird. I also removed the toolchain and reinstalled it.

~$ ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo-fmt --version
rustfmt 1.8.0-stable (4d91de4e48 2025-02-17)
~$ ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustfmt --version
rustfmt 1.8.0-nightly (30f168ef81 2025-03-05)

I even tried a pinned nightly (2025-03-01) which doesn't have any extra components, where the same thing happens.

@xizheyin
Copy link
Contributor

xizheyin commented Mar 6, 2025

The code is here. It seems that RUSTFMT is incorrect.

@jieyouxu jieyouxu added the T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue. label Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustfmt Area: Rustfmt C-bug Category: This is a bug. E-needs-investigation Call for partcipation: This issues needs some investigation to determine current status T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants