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 incorrectly outputs type items with where clauses #25031

Closed
jooert opened this issue May 1, 2015 · 3 comments · Fixed by #25092
Closed

Pretty-printer incorrectly outputs type items with where clauses #25031

jooert opened this issue May 1, 2015 · 3 comments · Fixed by #25092
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`)

Comments

@jooert
Copy link
Contributor

jooert commented May 1, 2015

So I wrote a regression test for a certain error and it held up the rollup PR (see #24979) because while my test passed the run-pass it failed during the pretty pass. The problem is that the prettifier (compiling with -Z unstable-options --pretty=expanded) transforms the original code example from #22471

type Foo<T> where T: Copy = Box<T>;

into

type Foo<T> = Box<T> where T: Copy;

which upon compilation leads to the following error:

error: expected one of `+`, `::`, or `;`, found `where`
type Foo<T> = Box<T> where T: Copy;

This seems to indicate a bug in the prettifier as (seemingly) valid code is transformed into non-compiling one.

@bluss
Copy link
Member

bluss commented May 1, 2015

basically the PR that added the syntax type Foo<T> where T: Copy = Box<T>; should have updated the pretty code to handle that too. That's what the pretty tests are trying to enforce.

@jooert
Copy link
Contributor Author

jooert commented May 1, 2015

It still may, as it isn't merged yet, but I have no idea how to do that. 😃

@jooert
Copy link
Contributor Author

jooert commented May 1, 2015

Sorry, I misread your comment, you weren't talking about my PR.

@steveklabnik steveklabnik added the A-pretty Area: Pretty printing (including `-Z unpretty`) label May 2, 2015
@pnkfelix pnkfelix changed the title Prettifier transforms working code into non-compiling one Pretty-printer incorrectly outputs type items with where clauses May 4, 2015
pnkfelix added a commit to pnkfelix/rust that referenced this issue May 4, 2015
Manishearth added a commit to Manishearth/rust that referenced this issue May 5, 2015
…ith-where, r=alexcrichton

 Correct pretty-printing of `type Foo<T> where T: Bound = ...;`

Fix rust-lang#25031
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants