Crate rustc_hir_pretty

source
Expand description

HIR pretty-printing is layered on top of AST pretty-printing. A number of the definitions in this file have equivalents in rustc_ast_pretty.

Structs§

Enums§

Constants§

Traits§

Functions§

  • Expressions that syntactically contain an “exterior” struct literal, i.e., not surrounded by any parens or other delimiters, e.g., X { y: 1 }, X { y: 1 }.method(), foo == X { y: 1 } and X { y: 1 } == foo all do, but (X { y: 1 }) == foo does not.
  • Does this expression require a semicolon to be treated as a statement? The negation of this: ‘can this expression be used as a statement without a semicolon’ – is used as an early-bail-out in the parser so that, for instance, if true {…} else {…} |x| 5 isn’t parsed as (if true {…} else {…} | x) | 5
  • Requires you to pass an input filename and reader so that it can scan the input text for comments to copy forward.
  • This statement requires a semicolon after it. note that in one case (stmt_semi), we’ve already seen the semicolon, and thus don’t need another.
  • to_string 🔒