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

Show stdout from the compiler with json error mode #6674

Closed
wants to merge 1 commit into from

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Feb 16, 2019

This allows using commands like -Z time-passes and println! debugging in rustc.

r? @alexcrichton

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@alexcrichton
Copy link
Member

This looks fine by me, thanks! Perhaps this should forward stdout to stdout, though?

I think this may also want to go through the message-sending mechanism for the rest of Cargo as well to avoid messing up the progress bar perhaps?

@Zoxc
Copy link
Contributor Author

Zoxc commented Feb 19, 2019

JSON is emitted on stdout though

@Zoxc
Copy link
Contributor Author

Zoxc commented Feb 19, 2019

Also json_stder just writes directly to stderr. I just copied that.

@alexcrichton
Copy link
Member

Hm ok the progress bar is indeed just an existing bug it looks like. I still think though that we should preserve the output stream of the compiler. We switch json from stdout to stderr intentionally but that's more for Cargo's interface than anything else.

@ehuss
Copy link
Contributor

ehuss commented Feb 21, 2019

Fixing that code path to use Message would also fix this issue: #6119 (comment)

@ehuss ehuss added the S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. label Mar 15, 2019
@Zoxc
Copy link
Contributor Author

Zoxc commented Mar 20, 2019

@alexcrichton Wouldn't writing things to stdout would be a breaking change? It would break bootstrap at least since it expects only json.

@alexcrichton
Copy link
Member

Sounds like bootstrap should be updated then?

@bors
Copy link
Contributor

bors commented May 10, 2019

☔ The latest upstream changes (presumably #6883) made this pull request unmergeable. Please resolve the merge conflicts.

@ehuss
Copy link
Contributor

ehuss commented May 10, 2019

stdout is now always forwarded to stdout via #6883.

@ehuss ehuss closed this May 10, 2019
bors added a commit to rust-lang/rust that referenced this pull request Jun 17, 2019
Add a RUSTC_TIME env var to time rust crates during bootstrap

Blocked on rust-lang/cargo#6674

r? @michaelwoerister

Example for rustc with #58507:
```
  time: 0.460; rss: 94MB	parsing
  time: 0.000; rss: 94MB	attributes injection
  time: 0.000; rss: 94MB	recursion limit
  time: 0.000; rss: 94MB	crate injection
  time: 0.000; rss: 94MB	plugin loading
  time: 0.000; rss: 94MB	plugin registration
  time: 0.044; rss: 94MB	pre ast expansion lint checks
    time: 1.999; rss: 316MB	expand crate
    time: 0.000; rss: 316MB	check unused macros
  time: 2.000; rss: 316MB	expansion
  time: 0.000; rss: 316MB	maybe building test harness
  time: 0.053; rss: 316MB	AST validation
  time: 0.000; rss: 316MB	maybe creating a macro crate
  time: 1.515; rss: 397MB	name resolution
  time: 0.122; rss: 397MB	complete gated feature checking
  time: 0.655; rss: 546MB	lowering ast -> hir
  time: 0.136; rss: 550MB	early lint checks
    time: 0.117; rss: 540MB	validate hir map
  time: 0.606; rss: 540MB	indexing hir
  time: 0.000; rss: 480MB	load query result cache
  time: 0.000; rss: 478MB	dep graph tcx init
  time: 0.000; rss: 478MB	looking for entry point
  time: 0.001; rss: 478MB	looking for plugin registrar
  time: 0.001; rss: 478MB	looking for derive registrar
  time: 0.049; rss: 478MB	loop checking
  time: 0.064; rss: 479MB	attribute checking
  time: 0.166; rss: 484MB	stability checking
  time: 0.699; rss: 566MB	type collecting
  time: 0.006; rss: 566MB	outlives testing
  time: 0.018; rss: 568MB	impl wf inference
    time: 0.002; rss: 583MB	unsafety checking
    time: 0.005; rss: 583MB	orphan checking
  time: 0.227; rss: 583MB	coherence checking
  time: 0.006; rss: 583MB	variance testing
  time: 1.546; rss: 657MB	wf checking
  time: 0.389; rss: 665MB	item-types checking
  time: 13.999; rss: 837MB	item-bodies checking
    time: 1.692; rss: 883MB	rvalue promotion
    time: 0.067; rss: 883MB	intrinsic checking
    time: 0.624; rss: 887MB	match checking
    time: 0.246; rss: 889MB	liveness checking
  time: 2.629; rss: 889MB	misc checking
  time: 0.000; rss: 889MB	borrow checking
  time: 16.754; rss: 1242MB	MIR borrow checking
  time: 0.050; rss: 1242MB	dumping chalk-like clauses
  time: 0.010; rss: 1242MB	MIR effect checking
  time: 0.001; rss: 1242MB	layout testing
    time: 0.829; rss: 1244MB	privacy checking
    time: 0.183; rss: 1247MB	death checking
    time: 0.100; rss: 1248MB	unused lib feature checking
    time: 0.405; rss: 1250MB	lint checking
  time: 1.518; rss: 1250MB	misc checking
  time: 0.000; rss: 1250MB	resolving dependency formats
    time: 2.928; rss: 1332MB	write metadata
      time: 0.014; rss: 1332MB	collecting roots
      time: 7.621; rss: 1488MB	collecting mono items
    time: 7.635; rss: 1488MB	monomorphization collection
    time: 0.557; rss: 1567MB	codegen unit partitioning
    time: 27.971; rss: 2656MB	codegen to LLVM IR
    time: 0.056; rss: 2656MB	assert dep graph
    time: 0.000; rss: 2656MB	serialize dep graph
  time: 195.414; rss: 2656MB	codegen
  time: 0.000; rss: 329MB	serialize work products
    time: 1.664; rss: 331MB	running linker
  time: 1.965; rss: 331MB	linking
[RUSTC-TIMING] rustc test:false 950.103
```
It doesn't really look like the times add up here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants