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

Write text output files to stdout if options like -o - or --emit asm=- are provided #431

Closed
1 of 3 tasks
pjhades opened this issue May 13, 2021 · 8 comments
Closed
1 of 3 tasks
Labels
disposition-merge The FCP starter wants to merge this finished-final-comment-period The FCP has finished, action upon the disposition label needs to be taken major-change A proposal to make a major change to rustc major-change-accepted A major change proposal that was accepted T-compiler Add this label so rfcbot knows to poll the compiler team

Comments

@pjhades
Copy link

pjhades commented May 13, 2021

Proposal

Currently, rustc writes output to files, even if options like -o - or --emit asm=- are specified. But sometimes it would be convenient if rustc writes text output (asm, dep-info, llvm-ir and mir) to stdout if the user explicitly asks for it, so that the output could be easily read or piped to consumer programs. For example I could write a simple name demangler and pipe the assembly output to it to make a poor man's command-line compiler explorer.

There are a few open issues where people proposed the same thing, like rust-lang/rust#47112 and rust-lang/rust#26719.

For gcc and clang, when -o - is provided, assembly output (produced via -S) will be written to stdout instead of a <source_file_name>.s file. Dependency information (produced via -MD) will still be written to a file called -.d. Preprocessor output (produced via -E) will always be written to stdout.

Mentors or Reviewers

I'm not sure who to include here.

Process

The main points of the Major Change Process are as follows:

  • File an issue describing the proposal.
  • A compiler team member or contributor who is knowledgeable in the area can second by writing @rustbot second.
    • Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a -C flag, then full team check-off is required.
    • Compiler team members can initiate a check-off via @rfcbot fcp merge on either the MCP or the PR.
  • Once an MCP is seconded, the Final Comment Period begins. If no objections are raised after 10 days, the MCP is considered approved.

You can read more about Major Change Proposals on forge.

Comments

This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.

@pjhades pjhades added T-compiler Add this label so rfcbot knows to poll the compiler team major-change A proposal to make a major change to rustc labels May 13, 2021
@rustbot
Copy link
Collaborator

rustbot commented May 13, 2021

This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.

cc @rust-lang/compiler @rust-lang/compiler-contributors

@rustbot rustbot added the to-announce Announce this issue on triage meeting label May 13, 2021
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label May 20, 2021
@pnkfelix
Copy link
Member

@rustbot second

@pnkfelix
Copy link
Member

Actually this is public facing, so it needs full team checkoff.

@pnkfelix
Copy link
Member

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Jun 24, 2021

Team member @pnkfelix has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period An FCP has been started, cast your votes and raise concerns disposition-merge The FCP starter wants to merge this labels Jun 24, 2021
@rfcbot rfcbot added final-comment-period The FCP has started, most (if not all) team members are in agreement and removed proposed-final-comment-period An FCP has been started, cast your votes and raise concerns labels Oct 22, 2021
@rfcbot
Copy link

rfcbot commented Oct 22, 2021

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot added the finished-final-comment-period The FCP has finished, action upon the disposition label needs to be taken label Nov 1, 2021
@rfcbot
Copy link

rfcbot commented Nov 1, 2021

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@rfcbot rfcbot added to-announce Announce this issue on triage meeting and removed final-comment-period The FCP has started, most (if not all) team members are in agreement labels Nov 1, 2021
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Nov 11, 2021
@apiraino
Copy link
Contributor

@rustbot label -final-comment-period +major-change-accepted

(closing only now because slipped through the cracks)

@rustbot rustbot added major-change-accepted A major change proposal that was accepted to-announce Announce this issue on triage meeting labels May 19, 2022
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label May 19, 2022
bors added a commit to rust-lang-ci/rust that referenced this issue Jun 9, 2023
Write to stdout if `-` is given as output file

With this PR, if `-o -` or `--emit KIND=-` is provided, output will be written to stdout instead. Binary output (those of type `obj`, `llvm-bc`, `link` and `metadata`) being written this way will result in an error unless stdout is not a tty. Multiple output types going to stdout will trigger an error too, as they will all be mixded together.

This implements rust-lang/compiler-team#431

The idea behind the changes is to introduce an `OutFileName` enum that represents the output - be it a real path or stdout - and to use this enum along the code paths that handle different output types.
RalfJung pushed a commit to RalfJung/miri that referenced this issue Jun 11, 2023
Write to stdout if `-` is given as output file

With this PR, if `-o -` or `--emit KIND=-` is provided, output will be written to stdout instead. Binary output (those of type `obj`, `llvm-bc`, `link` and `metadata`) being written this way will result in an error unless stdout is not a tty. Multiple output types going to stdout will trigger an error too, as they will all be mixded together.

This implements rust-lang/compiler-team#431

The idea behind the changes is to introduce an `OutFileName` enum that represents the output - be it a real path or stdout - and to use this enum along the code paths that handle different output types.
lnicola pushed a commit to lnicola/rust-analyzer that referenced this issue Apr 7, 2024
Write to stdout if `-` is given as output file

With this PR, if `-o -` or `--emit KIND=-` is provided, output will be written to stdout instead. Binary output (those of type `obj`, `llvm-bc`, `link` and `metadata`) being written this way will result in an error unless stdout is not a tty. Multiple output types going to stdout will trigger an error too, as they will all be mixded together.

This implements rust-lang/compiler-team#431

The idea behind the changes is to introduce an `OutFileName` enum that represents the output - be it a real path or stdout - and to use this enum along the code paths that handle different output types.
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this issue Apr 27, 2024
Write to stdout if `-` is given as output file

With this PR, if `-o -` or `--emit KIND=-` is provided, output will be written to stdout instead. Binary output (those of type `obj`, `llvm-bc`, `link` and `metadata`) being written this way will result in an error unless stdout is not a tty. Multiple output types going to stdout will trigger an error too, as they will all be mixded together.

This implements rust-lang/compiler-team#431

The idea behind the changes is to introduce an `OutFileName` enum that represents the output - be it a real path or stdout - and to use this enum along the code paths that handle different output types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge The FCP starter wants to merge this finished-final-comment-period The FCP has finished, action upon the disposition label needs to be taken major-change A proposal to make a major change to rustc major-change-accepted A major change proposal that was accepted T-compiler Add this label so rfcbot knows to poll the compiler team
Projects
None yet
Development

No branches or pull requests

5 participants