Skip to content

Fix proc macro punctuation panic#1197

Merged
fw-immunant merged 1 commit intomasterfrom
fw/proc-macro-punct
Jan 29, 2025
Merged

Fix proc macro punctuation panic#1197
fw-immunant merged 1 commit intomasterfrom
fw/proc-macro-punct

Conversation

@fw-immunant
Copy link
Copy Markdown
Contributor

@fw-immunant fw-immunant commented Jan 27, 2025

this should allow using newer versions of proc_macro2
@fw-immunant fw-immunant requested a review from kkysen January 27, 2025 18:19
Copy link
Copy Markdown
Contributor

@kkysen kkysen left a comment

Choose a reason for hiding this comment

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

LGTM.

@kornelski, does this fix the issue? You can test it by checking out this branch and then rm Cargo.lock and cargo +stable install --path c2rust (since cargo install --git doesn't allow --bin).

@fw-immunant
Copy link
Copy Markdown
Contributor Author

LGTM.

@kornelski, does this fix the issue? You can test it by checking out this branch and then rm Cargo.lock and cargo +stable install --path c2rust (since cargo install --git doesn't allow --bin).

This appears to fix the issue locally; a build with proc-macro2 v1.0.93 following the above instructions seems to correctly process the .c files I threw at it.

@fw-immunant fw-immunant merged commit 3b1ec86 into master Jan 29, 2025
@fw-immunant fw-immunant deleted the fw/proc-macro-punct branch January 29, 2025 20:46
kkysen added a commit that referenced this pull request Feb 24, 2025
This fixes another bug like
#1197: `_` is no puctuation --
another case of dtolnay/proc-macro2#475,
fall-out of dtolnay/proc-macro2#470.

## Testing

This enables building RIOT sources again without `--locked`. I'm not
entirely sure, but I think the offending assembly was

```c
  __ASM ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
```

which gets turned into

```rust
    asm!(
        "rev {0}, {1}", lateout(reg) result, inlateout(reg) value => _,
        options(preserves_flags, pure, readonly)
    );
```

where the `_` is the identifier (formerly punctuation) which c2rust
trips over.
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.

panic: unsupported proc macro punctuation character '(' thread 'main' panicked at 'unsupported proc macro punctuation character '(''

2 participants