Skip to content

Macro fixup inserting {} characters as punct, causing proc macros to panic #19206

@ChayimFriedman2

Description

@ChayimFriedman2

@ChayimFriedman2

Hi - I am still seeing this exact bug, with rustc 1.84.1 (e71f9a9a9 2025-01-27), with both the latest analyzer versions available for VS Code: 0.3.2308 and 0.4.2312.

In my case the test case is

#[tokio::main]
async fn main() {
    loop {}
    // type 'while ' here
}

and the error displayed is

proc-macro panicked: unsupported proc macro punctuation character '{'.

EDIT: cargo build does not result in the proc macro panic, which is why I'm assuming the fault lies with analyzer and not with the macro itself (this is tokio_macros 2.5.0) – let me know if there's something I can do to prove one way or the other

EDIT 2: with nightly analyzer (2025-02-19)

Error SyntaxError from LineCol { line: 18, col: 18 } to LineCol { line: 18, col: 18 }: Syntax Error: expected a block
Error Ra("macro-error", Error) from LineCol { line: 15, col: 0 } to LineCol { line: 19, col: 1 }: proc-macro panicked: unsupported proc macro punctuation character '{'
processing crate: foobar, module: /Users/me/foobar/src/lib.rs

diagnostic scan complete

Error: diagnostic error detected

Stack backtrace:
   0: std::backtrace::Backtrace::create
   1: <anyhow::Error>::msg::<&str>
   2: std::sys::backtrace::__rust_begin_short_backtrace::<<stdx::thread::Builder>::spawn<<rust_analyzer::cli::flags::Diagnostics>::run::{closure#0}, core::result::Result<(), anyhow::Error>>::{closure#0}, core::result::Result<(), anyhow::Error>>
   3: <<std::thread::Builder>::spawn_unchecked_<<stdx::thread::Builder>::spawn<<rust_analyzer::cli::flags::Diagnostics>::run::{closure#0}, core::result::Result<(), anyhow::Error>>::{closure#0}, core::result::Result<(), anyhow::Error>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
   4: std::sys::pal::unix::thread::Thread::new::thread_start
   5: __pthread_deallocate

Originally posted by @tcbennun in #18840

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions