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

HIR printing of existential type is broken #60662

Closed
oli-obk opened this issue May 9, 2019 · 6 comments · Fixed by #60694
Closed

HIR printing of existential type is broken #60662

oli-obk opened this issue May 9, 2019 · 6 comments · Fixed by #60694
Labels
A-hir Area: the High level Intermediate Representation (HIR) A-impl-trait Area: impl Trait. Universally / existentially quantified anonymous types with static dispatch. A-pretty Area: Pretty printing. E-easy Call for participation: Experience needed to fix: Easy / not much (good first issue)

Comments

@oli-obk
Copy link
Contributor

oli-obk commented May 9, 2019

pub existential type ServeFut: Future<Output = ()>;

expanded with rustc --edition 2018 -Z unpretty=hir yields

pub existential type ServeFut : : Future<Output = ()>;

we should not print that extra :

@oli-obk oli-obk added E-easy Call for participation: Experience needed to fix: Easy / not much (good first issue) A-pretty Area: Pretty printing. A-hir Area: the High level Intermediate Representation (HIR) A-impl-trait Area: impl Trait. Universally / existentially quantified anonymous types with static dispatch. labels May 9, 2019
@Pulkit07
Copy link
Contributor

Pulkit07 commented May 9, 2019

Hi, I will like to work on this issue.

@oli-obk
Copy link
Contributor Author

oli-obk commented May 9, 2019

awesome!

Most likely all that is required is to remove

self.word_space(":")?;

you can check if there's a test in src/tests/ui that has a // compile-flags comment with -Z unpretty=hir in it. If there is, just add the above test line to it and run tests with ./x.py test --stage 1 src/test/ui --test-args name-of-the-test --bless.

If there is no such test, add such a test ;)

@alexreg
Copy link
Contributor

alexreg commented May 9, 2019

I think I fixed this in one of my PRs, but not sure when it will merge, so go for it. :-)

@Pulkit07
Copy link
Contributor

While adding test, I am getting following error message:

unexpected error: '8:5: 8:43: existential types are unstable [E0658]'

The existing test can be seen here: https://github.com/rust-lang/rust/pull/60694/files#diff-b122eeedc759d82eab86eafd6445ce8e

@oli-obk
Copy link
Contributor Author

oli-obk commented May 10, 2019

you need to add #![feature(existential_types)] to the test

@Pulkit07
Copy link
Contributor

you need to add #![feature(existential_types)] to the test

Added that, many thanks!

Pulkit07 added a commit to Pulkit07/rust that referenced this issue May 11, 2019
Centril added a commit to Centril/rust that referenced this issue May 12, 2019
bors added a commit that referenced this issue May 12, 2019
Rollup of 4 pull requests

Successful merges:

 - #60694 (Fix HIR printing of existential type #60662)
 - #60750 (syntax: Remove some legacy nonterminal tokens)
 - #60751 (Assorted cleanup in parser & AST validation)
 - #60752 (Fix minor typos for ItemLocalId)

Failed merges:

r? @ghost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-hir Area: the High level Intermediate Representation (HIR) A-impl-trait Area: impl Trait. Universally / existentially quantified anonymous types with static dispatch. A-pretty Area: Pretty printing. E-easy Call for participation: Experience needed to fix: Easy / not much (good first issue)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants