Skip to content

cargo-fmt reports weird version on nightly #137666

New issue

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

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

Already on GitHub? # to your account

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

cargo-fmt reports weird version on nightly #137666

Kobzol opened this issue Feb 26, 2025 · 11 comments
Assignees
Labels
A-rustfmt Area: Rustfmt C-bug Category: This is a bug. 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
@onur-ozkan
Copy link
Member

I tried it just now and it seems to be working as expected:

$  ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin  $ ./rustfmt --version
rustfmt 1.8.0-nightly (414482f6a0 2025-05-13)
$  ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin  $ ./cargo-fmt --version
rustfmt 1.8.0-nightly (414482f6a0 2025-05-13)

@Kobzol
Copy link
Contributor Author

Kobzol commented May 15, 2025

~$ ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustfmt --version
rustfmt 1.8.0-nightly (414482f6a0 2025-05-13)
~$ ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo-fmt --version
rustfmt 1.8.0-stable (05f9846f89 2025-03-31)

Not sure why is there a difference between your and my environment :/

@onur-ozkan
Copy link
Member

lol this is weird

@onur-ozkan onur-ozkan removed the E-needs-investigation Call for partcipation: This issues needs some investigation to determine current status label May 16, 2025
@onur-ozkan onur-ozkan self-assigned this May 16, 2025
@onur-ozkan
Copy link
Member

I found the problem and explained it in the fix PR.

@onur-ozkan onur-ozkan removed the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label May 16, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-rustfmt Area: Rustfmt C-bug Category: This is a bug. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants