godmaire,
@godmaire@mstdn.social avatar

Is it not possible to use grave accents in rust proc-macros? When I do, I get an "unknown start of token" error, even though it /is/ the whole token. When taking a peek at the TokenStream given to the proc-macro function, the grave doesn't appear at all

ekuber,
@ekuber@hachyderm.io avatar

@godmaire is that as a grave accent on its own, or something like è? The later should work. https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=1dbb34c0d237cc070f240c8c70e8a9b1

Also check that you're not using an out of date rust version.

godmaire,
@godmaire@mstdn.social avatar

@ekuber Grave accent on its own. I'm using a proc macro to embed a lisp in rust. Here's an example of the code that's failing with the rust-analyzer message

ekuber,
@ekuber@hachyderm.io avatar

@godmaire yeah, grave accent on its own is not a valid identifier according to Unicode, and rust follows their guidance. This is at the Lexer step, so proc macros are restricted in the same way.

godmaire,
@godmaire@mstdn.social avatar

@ekuber Ah, to clarify, I'm referring to and using the "backtick", not the diacritic mark. I'm not sure if that changes anything

https://en.m.wikipedia.org/wiki/Backtick

ekuber,
@ekuber@hachyderm.io avatar

@godmaire same result. The grave accent is only valid after a letter, the backtic is not valid as an identifier

  • All
  • Subscribed
  • Moderated
  • Favorites
  • rust
  • tester
  • DreamBathrooms
  • khanakhh
  • ngwrru68w68
  • Youngstown
  • magazineikmin
  • mdbf
  • slotface
  • thenastyranch
  • rosin
  • kavyap
  • tacticalgear
  • GTA5RPClips
  • osvaldo12
  • JUstTest
  • cubers
  • ethstaker
  • everett
  • Durango
  • InstantRegret
  • normalnudes
  • Leos
  • modclub
  • anitta
  • cisconetworking
  • megavids
  • provamag3
  • lostlight
  • All magazines