Hygienic identifiers#356
Conversation
|
Looks like the 1.70 test is failing because syn bumped their |
Oh, an easy question that my brain can handle! Yes. :-) |
77bb652 to
6be6143
Compare
6be6143 to
45c1a2f
Compare
|
Ended up bumping it up to 1.76 because of trybuild. That should only be a dev dependency; I could try to maintain the 1.71 MSRV despite that, but it might get complicated, and 1.76 is already pretty old, so we'd likely have to bump again soon if we don't do it now. The nightly UI tests are still failing, expectedly. Do we want to disable the UI tests for nightly in CI if it just adds noise? |
Just run Once all the span stuff finally gets to the stable rustc the UI tests can run against stable instead. Of course with my limited ability to focus on any of this, and having no other co-maintainer, it might not make much of a difference in terms of how frequently the UI tests need to be updated :-) |
45c1a2f to
7e798e4
Compare
|
Oh my bad, I thought nightly and stable were disagreeing about the output for the same files. |
This PR fixes a bug where deriving
BinRead/BinWritethrough a macro-expanded derive path could error in attributes like#[br(pre_assert(...))]witherror[E0425]: cannot find value __binrw_generated_position_temp in this scope,help: an identifier with the same name is defined here, but is not accessible due to macro hygiene. This was revealed when I tried using derive-aliases, but it can happen with normalmacro_rules!, see the tests. This PR makes the__binrw_generated_position_temp-styleIdentStrs useSpan::call_site()into_identandto_spanned_tokenswhile leaving the span untouched for otherIdentStrs, which fixes the error for me. If there is another way you want this issue solved, I can rework it.Also, I considered adding something like this to simplify the sanitization file:
But it seemed like overkill for a couple of identifiers. Let me know if you want me to put that back in or do something else.
Long-term, I think we should be more careful with spans; I saw some TODOs related to this. Even then, it's probably a good idea to keep these changes.
Finally, I fixed some new warnings and clippy lints to keep CI happy, but the nightly UI tests will probably still fail.