Skip to content

cargo-fmt reports weird version on nightly #137666

Open
@Kobzol

Description

@Kobzol
Member
$ 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.

Activity

added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Feb 26, 2025
removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Feb 26, 2025
added
T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
on Feb 26, 2025
added
A-stabilityArea: `#[stable]`, `#[unstable]` etc.
C-bugCategory: This is a bug.
E-needs-investigationCall for partcipation: This issues needs some investigation to determine current status
and removed
A-stabilityArea: `#[stable]`, `#[unstable]` etc.
on Feb 26, 2025
onur-ozkan

onur-ozkan commented on Feb 26, 2025

@onur-ozkan
Member

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

onur-ozkan

onur-ozkan commented on Feb 26, 2025

@onur-ozkan
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.

xizheyin

xizheyin commented on Mar 6, 2025

@xizheyin
Contributor

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

Kobzol commented on Mar 6, 2025

@Kobzol
MemberAuthor

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

xizheyin commented on Mar 6, 2025

@xizheyin
Contributor

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

Kobzol commented on Mar 6, 2025

@Kobzol
MemberAuthor

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

xizheyin commented on Mar 6, 2025

@xizheyin
Contributor

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

added
T-rustfmtRelevant to the rustfmt team, which will review and decide on the PR/issue.
on Mar 9, 2025
onur-ozkan

onur-ozkan commented on May 15, 2025

@onur-ozkan
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

Kobzol commented on May 15, 2025

@Kobzol
MemberAuthor
~$ ~/.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

onur-ozkan commented on May 15, 2025

@onur-ozkan
Member

lol this is weird

removed
E-needs-investigationCall for partcipation: This issues needs some investigation to determine current status
on May 16, 2025
self-assigned this
on May 16, 2025
onur-ozkan

onur-ozkan commented on May 16, 2025

@onur-ozkan
Member

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

removed
T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
on May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-rustfmtArea: RustfmtC-bugCategory: This is a bug.T-rustfmtRelevant to the rustfmt team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @Kobzol@jieyouxu@onur-ozkan@rustbot@xizheyin

    Issue actions

      `cargo-fmt` reports weird version on nightly · Issue #137666 · rust-lang/rust