Skip to content

Refactor ppaux out of existence.#58140

Merged
bors merged 70 commits intorust-lang:masterfrom
eddyb:advent-of-print
Mar 15, 2019
Merged

Refactor ppaux out of existence.#58140
bors merged 70 commits intorust-lang:masterfrom
eddyb:advent-of-print

Conversation

@eddyb
Copy link
Copy Markdown
Member

@eddyb eddyb commented Feb 4, 2019

A long-time coming, this PR reorganizes and rewrites the pretty-printing architecture of rustc, specifically the parts that involve the typesystem (which used to be in rustc::util::ppaux).

Note: these commits used to be in #57967 before being split off.

The new API (i.e. the Printer and PrettyPrint traits) is in rustc::ty::print.

Design points, roughly:

  • using associated types in Printer to allow building e.g. an AST, not just printing as a side-effect
  • several overloading points for implementers of PrettyPrinter, e.g. how <...> is printed
  • for fmt::Display impls, the value to print is lifted to the ty::tls tcx, and everything after that stays within the ty::print API, which requires 'tcx to match between values and the printer's tcx, without going through fmt::Display again

Most of the behavior is unchanged, except for a few details, which should be clear from the test changes.

r? @nikomatsakis

Fixes #55464

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants