Skip to content

Conversation

nikomatsakis
Copy link
Contributor

This uses the debug impls to dump the raw HIR. Particularly useful when
learning how the compiler works.

cc @qmx

This uses the debug impls to dump the raw HIR. Particularly useful when
learning how the compiler works.
@rust-highfive
Copy link
Contributor

r? @arielb1

(rust_highfive has picked a reviewer for you, use r? to override)

@qmx
Copy link
Contributor

qmx commented Nov 2, 2017

👍 useful

@nikomatsakis
Copy link
Contributor Author

nikomatsakis commented Nov 2, 2017

You can also do -Zdump-tree=22 to lower the contents of node-id 22, or -Zdump-tree=foo to lower a particular path foo. I've found the latter... imperfect... in my testing, but it's just using the existing infrastructure.

Er, I meant --unpretty=hir-tree=22 -Zunstable-options.

I'd really like to change --unpretty to -Zunpretty but this is enough for one day.

@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 2, 2017
@arielb1
Copy link
Contributor

arielb1 commented Nov 2, 2017

Could you add a run-make test on some sort of "Hello World" program (an Hello World without println!, I suppose), just that we make sure this doesn't randomly break, or do you think that would be too much of a maintenance burden?

@nikomatsakis
Copy link
Contributor Author

@arielb1 good question. It does seem useful to have a test -- but I am not super keen about periodically updating it with new HIR. I guess we could just check that it emits something non-empty or perhaps something with a few strings (e.g., names of the functions)?

@arielb1
Copy link
Contributor

arielb1 commented Nov 2, 2017

Sure, just running it, seeing that it doesn't crash, and seeing that e.g. a string literal from the code appears in the HIR should work.

@carols10cents carols10cents added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 6, 2017
@shepmaster
Copy link
Member

Greetings from triage, @nikomatsakis! It's been a week since we last heard from you here — will you be able to add the requested tests sometime soon?

@nikomatsakis
Copy link
Contributor Author

@shepmaster I will, I'm just slow. =)

@nikomatsakis
Copy link
Contributor Author

Added a test.

@arielb1
Copy link
Contributor

arielb1 commented Nov 22, 2017

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 22, 2017

📌 Commit 61f31fd has been approved by arielb1

@bors
Copy link
Collaborator

bors commented Nov 22, 2017

⌛ Testing commit 61f31fd with merge 2591df308e0af291feaf1161a7751f002bcd41da...

@kennytm
Copy link
Member

kennytm commented Nov 22, 2017

@bors retry — prioritize #46183

@bors
Copy link
Collaborator

bors commented Nov 23, 2017

⌛ Testing commit 61f31fd with merge 6af4515...

bors added a commit that referenced this pull request Nov 23, 2017
add -Zunpretty=hir-tree

This uses the debug impls to dump the raw HIR. Particularly useful when
learning how the compiler works.

cc @qmx
@bors
Copy link
Collaborator

bors commented Nov 23, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: arielb1
Pushing 6af4515 to master...

@bors bors merged commit 61f31fd into rust-lang:master Nov 23, 2017
Centril added a commit to Centril/rust that referenced this pull request Jan 15, 2019
Add missing unpretty option help message

There are some missing help messages that is printed `ructc -Zunpretty help` and receiving invalid option.

related with rust-lang#16419, rust-lang#45721, rust-lang#21085, rust-lang#31916
Centril added a commit to Centril/rust that referenced this pull request Jan 19, 2019
Add missing unpretty option help message

There are some missing help messages that is printed `ructc -Zunpretty help` and receiving invalid option.

related with rust-lang#16419, rust-lang#45721, rust-lang#21085, rust-lang#31916
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants