Skip to content

proc-macro panic with use-after-free #9323

@yisonPylkita

Description

@yisonPylkita

Whenever I try to use rust-analyzer with proc-macros enabled there is a problem with structopt crate. Here is a message from rust-analyzer

proc macro returned error: proc-macro panicked: use-after-free in `proc_macro` handle
rust-analyzer (macro-error)

image

Here is code

use structopt::StructOpt;

#[derive(StructOpt)]
#[structopt(name = "example", about = "An example of StructOpt usage.")]
struct Opt {}

fn main() {
    let _ = Opt::from_args();
}

and Cargo.toml

[package]
name = "proc-macro-debug"
version = "0.1.0"
edition = "2018"

[dependencies]
structopt = "0.3"

Info about my setup
System: WSL 2 Ubuntu 20.04
Editor: vscode 1.57.0
rust-analyzer extension version: v0.3.642
Tested on a nightly version downloaded by vscode 18.06.2021

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions