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

Pretty printing should use \r\n on Windows. #14808

Closed
retep998 opened this issue Jun 11, 2014 · 10 comments
Closed

Pretty printing should use \r\n on Windows. #14808

retep998 opened this issue Jun 11, 2014 · 10 comments
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`) C-enhancement Category: An issue proposing an enhancement or a PR with one. I-needs-decision Issue: In need of a decision. O-windows Operating system: Windows

Comments

@retep998
Copy link
Member

On Windows the preferred line ending is \r\n, not \n like it is on posix platforms.
Unfortunately using --pretty with rustc outputs \n newlines.
For comparison clang-format outputs \r\n on Windows.

@thestinger
Copy link
Contributor

I don't really think the source code format should vary across platforms. Using UTF-8 with consistent line endings everywhere works fine and it means the files are portable across operating systems.

@retep998
Copy link
Member Author

Nonetheless, text editors on windows all use \r\n so having mixed \n and \r\n isn't any better, nevermind some editors don't even display \n correctly.
Also every time I open up git gui to commit some code, it yells at me about the line endings.
Since Git can already checkout files as \r\n on windows and push them back as \n to repos, having --pretty emit \r\n on windows wouldn't decrease portability.

@retep998
Copy link
Member Author

This likely depends on #14400 being merged first.

tamird added a commit to tamird/rust that referenced this issue Apr 22, 2015
tamird added a commit to tamird/rust that referenced this issue Apr 23, 2015
tamird added a commit to tamird/rust that referenced this issue Apr 23, 2015
@rprichard
Copy link
Contributor

Did anyone ever consider having stdout convert LF to CRLF automatically on Windows?

@tamird
Copy link
Contributor

tamird commented Apr 23, 2015

#24696 generated enough resistance that I think we should not pursue this. I'm not sure how to get to a decision, but it'd be nice to lock this down.

@steveklabnik
Copy link
Member

Triage: no changes in the last two years. @rust-lang/compiler and @rust-lang/lang , do you have any thoughts here? There was a PR for this, but it was closed in favor of gaining some kind of consensus.

@nikomatsakis
Copy link
Contributor

I personally don't have any problem emitting \r\n, but I'm not a big fan of offering the pretty printer at all, mostly because it's a complex, little-used piece of code. It's definitely handy for debugging macros though and we don't really have a good alternative right now, so it seems like it'd be good if it integrated more smoothly with windows.

That said, I think the proper comparison for clang --format is really rustfmt, right? The pretty-printer is basically a (crude) macro-debugging tool at this point.

@retep998
Copy link
Member Author

retep998 commented Jan 3, 2017

The pretty printer is incredibly useful for debugging macros, but that's really about it. I don't care anymore about the choice of line ending for pretty printing, and rustfmt takes care of formatting code. I just want the pretty printer to be polished as a proper macro debugging tool, the equivalent of preprocessing only in C++.

@Mark-Simulacrum Mark-Simulacrum added C-enhancement Category: An issue proposing an enhancement or a PR with one. I-needs-decision Issue: In need of a decision. labels Jul 21, 2017
@Havvy
Copy link
Contributor

Havvy commented Jun 30, 2018

Which team does the decision needed fall to for this?

@Mark-Simulacrum
Copy link
Member

Closing. I personally think this is not something that we should settle on long-running issues and it seems no one cares too much about this today.

bors added a commit to rust-lang-ci/rust that referenced this issue Jun 5, 2023
Add metrics for unevaluated constants, failed mir bodies, and failed data layouts

fix rust-lang#14803
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`) C-enhancement Category: An issue proposing an enhancement or a PR with one. I-needs-decision Issue: In need of a decision. O-windows Operating system: Windows
Projects
None yet
Development

No branches or pull requests

9 participants