Module rustc_ast::util::classify

source ·
Expand description

Routines the parser and pretty-printer use to classify AST nodes.



  • This classification determines whether various syntactic positions break out of parsing the current expression (true) or continue parsing more of the same expression (false).
  • Does this expression require a semicolon to be treated as a statement?
  • If an expression ends with }, returns the innermost expression ending in the }
  • Returns whether the leftmost token of the given expression is the label of a labeled loop or block, such as in 'inner: loop { break 'inner 1 } + 1.
  • Returns the trailing return type in the given path, if it has one.
  • If the type’s last token is }, it must be due to a braced macro call, such as in *const brace! { ... }. Returns that trailing macro call.