Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty printer improvements #14106

Closed
wants to merge 18 commits into from

Commits on May 13, 2014

  1. rustc: Make std_inject valid for pretty-printer

    Inject `extern crate {std, native}` before `use` statements.
    Add `#![feature(glob)]` since `use std::prelude::*` is used.
    
    (Unfortunately `rustc --pretty expanded` does not converge,
    since `extern crate` and `use std::prelude::*` is injected at every
    iteration.)
    klutzy authored and alexcrichton committed May 13, 2014
    Configuration menu
    Copy the full SHA
    c07cc84 View commit details
    Browse the repository at this point in the history
  2. pprust: Add parentheses to some Expr

    Some `Expr` needs parentheses when printed. For example, without
    parentheses, `ExprUnary(UnNeg, ExprBinary(BiAdd, ..))` becomes
    `-lhs + rhs` which is wrong.
    
    Those cases don't appear in ordinary code (since parentheses are
    explicitly added) but they can appear in manually crafted ast by
    extensions.
    klutzy authored and alexcrichton committed May 13, 2014
    Configuration menu
    Copy the full SHA
    2ede3e3 View commit details
    Browse the repository at this point in the history
  3. pprust: Fix asm output

    klutzy authored and alexcrichton committed May 13, 2014
    Configuration menu
    Copy the full SHA
    0f4c5e9 View commit details
    Browse the repository at this point in the history
  4. pprust: Print &&e instead of & &e

    klutzy authored and alexcrichton committed May 13, 2014
    Configuration menu
    Copy the full SHA
    19d54d8 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    cdb5c3e View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    ec9f1f0 View commit details
    Browse the repository at this point in the history
  7. test: Add missing #![feature(managed_boxes)]

    The tests use managed boxes, but are not perfectly feature-gated because
    they use `@` inside macros. (It causes issue after `--pretty expanded`.)
    klutzy authored and alexcrichton committed May 13, 2014
    Configuration menu
    Copy the full SHA
    536ef8a View commit details
    Browse the repository at this point in the history
  8. compiletest: Modernize typenames

    klutzy authored and alexcrichton committed May 13, 2014
    Configuration menu
    Copy the full SHA
    f3e7bfa View commit details
    Browse the repository at this point in the history
  9. compiletest: Test --pretty expanded

    After testing `--pretty normal`, it tries to run `--pretty expanded` and
    typecheck output.
    Here we don't check convergence since it really diverges: for every
    iteration, some extra lines (e.g.`extern crate std`) are inserted.
    
    Some tests are `ignore-pretty`-ed since they cause various issues
    with `--pretty expanded`.
    klutzy authored and alexcrichton committed May 13, 2014
    Configuration menu
    Copy the full SHA
    05d3dbd View commit details
    Browse the repository at this point in the history
  10. Touch up and rebase previous commits

    * Added `// no-pretty-expanded` to pretty-print a test, but not run it through
      the `expanded` variant.
    * Removed #[deriving] and other expanded attributes after they are expanded
    * Removed hacks around &str and &&str and friends (from both the parser and the
      pretty printer).
    * Un-ignored a bunch of tests
    alexcrichton committed May 13, 2014
    Configuration menu
    Copy the full SHA
    c7ff0e2 View commit details
    Browse the repository at this point in the history
  11. syntax: Fix printing INT64_MIN

    Integers are always parsed as a u64 in libsyntax, but they're stored as i64. The
    parser and pretty printer both printed an i64 instead of u64, sometimes
    introducing an extra negative sign.
    alexcrichton committed May 13, 2014
    Configuration menu
    Copy the full SHA
    d62cfe7 View commit details
    Browse the repository at this point in the history
  12. syntax: Fix parsing << with closure types

    This uses the trick of replacing the << token with a < token to parse closure
    types correctly.
    
    Closes rust-lang#13324
    alexcrichton committed May 13, 2014
    Configuration menu
    Copy the full SHA
    93edd7e View commit details
    Browse the repository at this point in the history
  13. test: Fix a pretty printing test

    The pretty printer handles inlines comments quite badly
    alexcrichton committed May 13, 2014
    Configuration menu
    Copy the full SHA
    72dbadc View commit details
    Browse the repository at this point in the history
  14. test: Ignore a pretty expanded failing test

    When expanding, an extra unsafe block is generated which is currently not
    handled well.
    alexcrichton committed May 13, 2014
    Configuration menu
    Copy the full SHA
    1aa7703 View commit details
    Browse the repository at this point in the history
  15. syntax: Print suffixed token literals correctly

    Previously, literals "1i" were printed as "1". This fixes the
    numeric-method-autoexport test for pretty printing.
    alexcrichton committed May 13, 2014
    Configuration menu
    Copy the full SHA
    da5b6e5 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    4cc3876 View commit details
    Browse the repository at this point in the history
  17. syntax: Preserve attributes in #[deriving]

    Now that the #[deriving] attribute is removed, the raw_pointers_deriving lint
    was broken. This commit restores the lint by preserving lint attributes
    across #[deriving] to the implementations and using #[automatically_derived] as
    the trigger for activating the lint.
    alexcrichton committed May 13, 2014
    Configuration menu
    Copy the full SHA
    4796b17 View commit details
    Browse the repository at this point in the history
  18. syntax: Improve --pretty normal slightly

    When printing doc comments, always put a newline after them in a macro
    invocation to ensure that a line-doc-comment doesn't consume remaining tokens on
    the line.
    alexcrichton committed May 13, 2014
    Configuration menu
    Copy the full SHA
    5de4b87 View commit details
    Browse the repository at this point in the history