intellij-rust/intellij-rust

Use of mutable static is not highlighted as unsafe in some macro calls

Open

#8550 aperta il 11 feb 2022

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)Kotlin (376 fork)batch import
help wantedimprovementsubsystem::highlightingsubsystem::macros

Metriche repository

Star
 (4526 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Environment

  • IntelliJ Rust plugin version: 0.4.164.4409-213
  • Rust toolchain version: 1.60.0-nightly (27f5d830e 2022-02-02) x86_64-unknown-linux-gnu
  • IDE name and version: CLion 2021.3.3 (CL-213.6777.58)
  • Operating system: Windows 10 10.0
  • Macro expansion engine: new
  • Name resolution engine: new
  • Additional experimental features: org.rust.cargo.features.settings.gutter, org.rust.cargo.evaluate.build.scripts, org.rust.macros.proc

Problem description

Seems to work for some macros like println but not for other ones, like the one below.

Steps to reproduce

macro_rules! hide {
    ($id:ident) => {
        $id
    };
}
static mut num: i32 = 0;
unsafe fn fun() {
    let x = num; // highlighted as an unsafe operation
    hide!(num); // not highlighted
}

Guida contributor