Skip to content

file/module rename mangles the starting text of the file declaring the module. #11417

@Lokathor

Description

@Lokathor

So I have a main.rs like this:

#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

// ...

submodule!(defer);

In this case the submodule! macro just takes a module name once and then spits out the mod as well as the pub use:

#[macro_export]
macro_rules! submodule {
  ($sub_module_vis:vis $sub_module_name:ident) => {
    $sub_module_vis mod $sub_module_name;
    pub use $sub_module_name::*;
  }
}

Okay, so given all that, if I use the "rename" feature to change the name of the defer module to something like defertest, then the identifier in the macro use gets changed properly, and the file on disk is renamed properly, but also part of the top line of the main.rs file is mangled to have the new module name in it:

#![defertestttr(not(debug_assertions), windows_subsystem = "windows")]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions