Skip to content

Conversation

klutzy
Copy link
Contributor

@klutzy klutzy commented Apr 18, 2014

This patchset fixes some bugs regarding pprust-expanded,
and make compiletest run --pretty expanded tests.

klutzy added 10 commits April 19, 2014 00:20
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.)
This patch renames `#[deriving]` into `#[!deriving]` (starting with `!`)
to mark that expansion has completed.

This makes output of `--pretty expanded` valid.
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.
The tests use managed boxes, but are not perfectly feature-gated because
they use `@` inside macros. (It causes issue after `--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`.
@alexcrichton
Copy link
Member

Nice work, I love seeing progress on the pretty printer!

@alexcrichton
Copy link
Member

Closing due to inactivity, but feel free to reopen with a rebase! These fixes all seem legitimately useful!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants