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

x.py fmt <file> sometimes formats other files #102841

Closed
jyn514 opened this issue Oct 9, 2022 · 5 comments
Closed

x.py fmt <file> sometimes formats other files #102841

jyn514 opened this issue Oct 9, 2022 · 5 comments
Labels
C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@jyn514
Copy link
Member

jyn514 commented Oct 9, 2022

The per-file thing does not entirely work... when I ask x.py to format library/core/src/intrinsics.rs, it also formats library/core/src/panicking.rs.

Originally posted by @RalfJung in #102837 (comment)

@jyn514 jyn514 added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Oct 9, 2022
@jyn514
Copy link
Member Author

jyn514 commented Oct 9, 2022

@RalfJung can you post the commit you were on and the diff x.py created?

@RalfJung
Copy link
Member

RalfJung commented Oct 9, 2022

I wasn't on a commit as the committed files are all formatted already. So I introduced changes in both files and then triggered RA formatting, and it ended up undoing my changes in both files.

@RalfJung
Copy link
Member

RalfJung commented Oct 9, 2022

But strangely, I cannot reproduce outside of RA... when I invoke ./x.py fmt filename myself, it behaves as expected; when I ask it to do formatting from RA, it formats other files, too.

@RalfJung
Copy link
Member

RalfJung commented Oct 9, 2022

Oh, is it possible that RA expects the formatting to happen via stdin/stdout? I was wondering how things would work for files with mod statements where calling rustfmt with the filename causes it to recurse.

@RalfJung
Copy link
Member

RalfJung commented Oct 9, 2022

Yes indeed, formatting in RA happens via stdin/stdout. So the filename argument is not the problem.

@RalfJung RalfJung closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

2 participants