Skip to content

Adding and removing crate level cfg breaks macro expansion #7039

@PizzaCrust

Description

@PizzaCrust

Environment

  • IntelliJ Rust plugin version: 0.3.145.3769-203-nightly
  • Rust toolchain version: 1.53.0-nightly (07e0e2ec2 2021-03-24) x86_64-pc-windows-msvc
  • IDE name and version: IntelliJ IDEA 2020.3.3 Community Edition (IC-203.7717.56)
  • Operating system: Windows 10 10.0
  • Macro expansion engine: new
  • Name resolution engine: new

Problem description

Adding and removing a crate level cfg breaks macro expansion until restart

#![cfg(target_pointer_width = "64")]

macro_rules! anything {
    ($($tt:tt)*) => {
        $($tt)*
    };
}

anything!(pub struct A;);

Steps to reproduce

  1. Place this code in the editor
macro_rules! anything {
    ($($tt:tt)*) => {
        $($tt)*
    };
}

anything!(pub struct A;);
  1. Add a crate level cfg
#![cfg(target_pointer_width = "64")]
  1. Remove cfg
    Now macro expansion is broken until the IDE restarts

Metadata

Metadata

Assignees

Labels

subsystem::cfgIssues related to conditional compilation (processing of `cfg` attributes)subsystem::macrosIssues related to macros

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions