You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Should it be possible to feed the output of --unpretty=hir back to rustc without requiring the user to do any changes? Right now this is only possible for very trivial code, and even then requires adding some feature gates.
Any code with moderately complex expansions will require additional imports or touching the code. Some things I've noticed:
cc @rust-lang/compiler is this something we should strive to address? Seems a good start for new contributors as it's mostly detective work and trying out stuff.
In order to actually test it we'd need to change compiletest.
a way to run all compile-pass and run-pass test after pretty printing instead of normally
to have a new flag //not-unpretty-hir-roundtrippable that we'd put on those compile-pass or run-pass tests that don't work yet.
have some builder run tests with pretty printing (shouldn't be much slower I hope)
Nah, for HIR pretty-printing there should be no such requirements, IMO.
It just should look reasonable enough to make HIR debugging possible.
(AST pretty printing is another story, proc macros and tools do use it for generating well-formed code, even it it's not entirely reliable due to hygiene etc.)
I mean if some fix is trivial and improves the output, then we should accept it, but if it requires preserving some data in HIR solely for pretty-printing, then we should not.
Reacted by oli, varkor, Mazdak Farrokhzad, Esteban Kuber and Alexander Regueiro
Closing. I agree that this is not generally desirable, specific (simple) bug fixes can come as PRs; issues are not appropriate (as we don't want it, but don't object to it).
Activity
oli-obk commentedon May 9, 2019
cc @rust-lang/compiler is this something we should strive to address? Seems a good start for new contributors as it's mostly detective work and trying out stuff.
In order to actually test it we'd need to change compiletest.
compile-passandrun-passtest after pretty printing instead of normally//not-unpretty-hir-roundtrippablethat we'd put on thosecompile-passorrun-passtests that don't work yet.petrochenkov commentedon May 9, 2019
Nah, for HIR pretty-printing there should be no such requirements, IMO.
It just should look reasonable enough to make HIR debugging possible.
(AST pretty printing is another story, proc macros and tools do use it for generating well-formed code, even it it's not entirely reliable due to hygiene etc.)
petrochenkov commentedon May 9, 2019
I mean if some fix is trivial and improves the output, then we should accept it, but if it requires preserving some data in HIR solely for pretty-printing, then we should not.
Mark-Simulacrum commentedon Sep 22, 2019
Closing. I agree that this is not generally desirable, specific (simple) bug fixes can come as PRs; issues are not appropriate (as we don't want it, but don't object to it).