Skip to content

Commit

Permalink
Merge #110
Browse files Browse the repository at this point in the history
110: fix: avoid rust-analyzer snake case warning r=almindor a=sethp

It seems that rust-analyzer needs to operate over the expanded text of the proc macro (in order to e.g. support completion in the function body, see #11014 for way more details), so it "sees" the non-snake-case name emitted by riscv-rt's `entry` here.

Without this change, rust-analyzer will show a "weak warning" on invocations of `#[entry]` with the text:

```
Function `__risc_v_rt__main` should have snake_case name, e.g. `__risc_v_rt_main`
```

Co-authored-by: sethp <seth@codecopse.net>
  • Loading branch information
bors[bot] and sethp committed Jan 22, 2023
2 parents e48c03e + 527ed05 commit 1091528
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions riscv-rt/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream {
let stmts = f.block.stmts;

quote!(
#[allow(non_snake_case)]
#[export_name = "main"]
#(#attrs)*
pub #unsafety fn __risc_v_rt__main(#args) -> ! {
Expand Down

0 comments on commit 1091528

Please sign in to comment.