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

Handle Groups with Delimiter::None #10

Merged
merged 1 commit into from May 31, 2020

Conversation

Aaron1011
Copy link
Contributor

@Aaron1011 Aaron1011 commented May 31, 2020

Currently, rustc does not pass the exact original TokenStream to
proc-macros in several cases. This has many undesirable effects, such as
losing correct location information in error message.
See rust-lang/rust#43081 for more details

In the future, rustc will begin passing the correct TokenStream to
proc-macros. As a result, some tokens may be wrapped in a
TokenTree::Group with Delimiter::None (when the tokens originally
came from a macro_rules!) macro expansion.

I've determined that this change will cause your crate to stop
compiling. This PR updates obfstr to be compatible with both the
old and new TokenStream contents.

You can verify this PR by attempting to build your crate as follows:

rustup toolchain install nightly-2020-05-29
cargo +nightly-2020-05-29 build

This will built your crate with an older nightly build that
contains the change we want to eventually roll out.
On this compiler version, your crate should fail to compile without this
PR, and successfully compile with this PR.

If you have any questions, feel free to ask me. See rust-lang/rust#72622 for more details

Currently, rustc does not pass the exact original `TokenStream` to
proc-macros in several cases. This has many undesirable effects, such as
losing correct location information in error message.
See rust-lang/rust#43081 for more details

In the future, rustc will begin passing the correct `TokenStream` to
proc-macros. As a result, some tokens may be wrapped in a
`TokenTree::Group` with `Delimiter::None` (when the tokens originally
came from a `macro_rules!`) macro expansion.

I've determined that this change will cause your crate to stop
compiling. This PR updates `obfstr` to be compatible with both the
old and new `TokenStream` contents.

You can verify this PR by attempting to build your crate as follows:

```
rustup toolchain install nightly-2020-05-29
cargo +nightly-2020-05-29 build
```

This will built your crate with an older nightly build that
contains the change we want to eventually roll out.
On this compiler version, your crate should fail to compile without this
PR, and successfully compile with this PR.

If you have any questions, feel free to ask me for more details.
@Aaron1011
Copy link
Contributor Author

I didn't notice #9: feel free to close this PR if it's no longer necessary 😄

@CasualX
Copy link
Owner

CasualX commented May 31, 2020

Thanks!

Don't worry about #9 as it's an experiment and needs a fairly recent nightly to compile while this crate right now works on stable.

Your breaking change (bugfix by another name :) just made me revisit this crate so I tried pushing const fn and const generic as far as I could. Which worked pretty well :)

@CasualX CasualX merged commit d481407 into CasualX:master May 31, 2020
Aaron1011 added a commit to Aaron1011/obfstr that referenced this pull request Jul 27, 2020
In PR CasualX#10, I didn't properly handle all of the cases where
`None`-delimited groups can appear. This makes the tests pass
with the Nightly build from the previous PR.
CasualX pushed a commit that referenced this pull request Jul 29, 2020
In PR #10, I didn't properly handle all of the cases where
`None`-delimited groups can appear. This makes the tests pass
with the Nightly build from the previous PR.
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