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

generate: use token groups for delimited token streams #864

Merged
merged 3 commits into from
Oct 11, 2024

Conversation

rmsyn
Copy link
Contributor

@rmsyn rmsyn commented Oct 9, 2024

Uses proc_macro2::Group for token streams delimited with braces.

Resolves: #863

@rmsyn rmsyn requested a review from a team as a code owner October 9, 2024 05:13
burrbull
burrbull previously approved these changes Oct 9, 2024
@burrbull
Copy link
Member

burrbull commented Oct 9, 2024

Looks like need to update some dependencies in ci/scripts.sh

jannic
jannic previously approved these changes Oct 9, 2024
Copy link
Member

@jannic jannic left a comment

Choose a reason for hiding this comment

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

Some parts could be slightly simplified, but the more complex restructuring of render_register_mod_debug is exactly as I envisioned it.

Comment on lines 138 to 144
#[doc = #description]
pub mod #mod_ty {
#mod_items
}
pub mod #mod_ty
});

let mod_group = Group::new(Delimiter::Brace, mod_items);
out.extend(quote! { #mod_group });

Copy link
Member

Choose a reason for hiding this comment

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

Is this change needed? There's no Punct used in the old code, and using literal { } inside quote! should be fine, as long as they are properly nested.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I forgot to revert this change while I was still working things out. I'll change it back.

src/generate/register.rs Show resolved Hide resolved
@jannic
Copy link
Member

jannic commented Oct 9, 2024

Looks like need to update some dependencies in ci/scripts.sh

The ci failure seems to be caused by this change in nightly rust:
rust-lang/rust@562ec5a

While the version of xtensa-lx-rt in use in CI, 0.9.0, is indeed quite old, the current version in git still contains naked functions with asm! macros: https://github.com/esp-rs/esp-hal/blob/main/xtensa-lx-rt/src/exception/context.rs#L179

What's the best workaround? Pinning an older version of nightly in ci, for now?

@jannic
Copy link
Member

jannic commented Oct 9, 2024

What's the best workaround? Pinning an older version of nightly in ci, for now?

If that's acceptable, feel free to copy from c577438

(I didn't bisect the exact version, but just took one that succeeded in a previous CI run.)

CI results at #865

@rmsyn rmsyn dismissed stale reviews from jannic and burrbull via 0954530 October 10, 2024 01:28
@rmsyn
Copy link
Contributor Author

rmsyn commented Oct 10, 2024

CI results at #865

I can keep an eye on #865, and rebase on top of those changes once merged.

Let me know what you would like me to do.

@burrbull
Copy link
Member

Let me know what you would like me to do.

Merge #865 changes in this PR, please.

rmsyn and others added 3 commits October 10, 2024 20:48
Uses `proc_macro2::Group` for token streams delimited with braces.

Resolves: rust-embedded#863

Authored-by: rmsyn <[email protected]>
Co-authored-by: Jan Niehusmann <[email protected]>
Workaround for incompatibility of latest nightly with `asm!` in naked functions.
@burrbull burrbull added this pull request to the merge queue Oct 11, 2024
Merged via the queue into rust-embedded:master with commit c6035f7 Oct 11, 2024
46 checks passed
@rmsyn rmsyn deleted the generate/token-groups branch October 12, 2024 01:47
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.

Unsupported proc macro punctuation character while rendering device from svd
3 participants