Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Extract module to file" extracts module to incorrect path when source module's location is specified with #[path] #17181

Closed
selenography opened this issue May 4, 2024 · 0 comments · Fixed by #17216
Assignees
Labels
C-bug Category: bug

Comments

@selenography
Copy link

rust-analyzer version: 0.3.1940-standalone (f216be4 2024-04-27)

rustc version: rustc 1.79.0-nightly (0d8b3346a 2024-04-14)

editor or extension: VSCode; rust-analyzer v0.3.1940

relevant settings: None applicable

code snippet to reproduce:
In src/main.rs:

#[path="parser/__mod.rs"]
mod parser;

fn main() {}

In src/parser/__mod.rs:

mod expr {};

Place the cursor on expr and invoke the "Extract module to file" assist.

Expected behavior:
The line in __mod.rs becomes mod expr;, and a new empty file is created at parser/expr.rs.

Actual behavior:
The line in __mod.rs becomes mod expr;, and a new empty file is created at parser/parser/expr.rs (where it will not be recognized as part of the workspace).

@selenography selenography added the C-bug Category: bug label May 4, 2024
@Young-Flash Young-Flash self-assigned this May 5, 2024
@bors bors closed this as completed in 07d71c0 May 14, 2024
lnicola pushed a commit to lnicola/rust that referenced this issue May 19, 2024
fix: extract mod to file should respect path attribute

close rust-lang/rust-analyzer#17181
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants