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

Don't insert a duplicate trailing comma in gluon_codegen #889

Merged
merged 1 commit into from
Sep 24, 2020

Conversation

Aaron1011
Copy link
Contributor

@Aaron1011 Aaron1011 commented Sep 23, 2020

Currently, gluon_codegen unconditionall inserts a comma after the
user-provided where clause. However, the where clause may already
have a trailing comma, which will result in an unparsable TokenStream
being generated.

The AliasRef struct would be affected by this bug, but a rustc bug
causes the exact parsed TokenStream to be lost in some cases
(see rust-lang/rust#43081) - in this case, due
to the presence of #[cfg_attr].

When PR rust-lang/rust#76130 is merged, the
exact parsed TokenStream will be passed to proc-macros in more cases,
exposing this bug.

Currently, `gluon_codegen` unconditionall inserts a comma after the
user-provided `where` clause. However, the `where` clause may already
have a trailing comma, which will result in an unparsable `TokenStream`
being generated.

The `AliasRef` struct would be affected by this bug, but a rustc bug
causes the exact parsed `TokenStream` to be lost in some cases
(see rust-lang/rust#43081) - in this case, due
to the presence of `#[cfg_attr]`.

When PR rust-lang/rust#76130 is merged, the
exact parsed `TokenStream` will be passed to proc-macros in more cases,
exposing this bug.
Copy link
Member

@Marwes Marwes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

@bors
Copy link
Contributor

bors bot commented Sep 24, 2020

Build succeeded:

@bors bors bot merged commit 112263e into gluon-lang:master Sep 24, 2020
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.

None yet

2 participants