-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Rename refactoring produce syntactically incorrect code #14137
Comments
If surrounding function is not annotated with But in presence of #[tokio::main]
async fn main() {
let f = 2;
println!("{}", f);
} In this example when trying rename variable rust-analyzer/crates/ide-db/src/rename.rs Line 288 in a6603fc
Later in |
This is a known bug with proc-macros for r-a. r-a currently fails to properly handle macros re-using spans. |
I wonder if there is a practical way it can be solved in general case? Proc macro can rewrite a |
This will be fixed once #9403 is implemented. "rust-analyzer.procMacro.ignored": {
"tokio-macros": [
"main"
]
}, in your settings to get around this mostly |
This works now |
rust-analyzer version: rust-analyzer version: 0.3.1394-standalone (0b32b65 2023-02-05)
rustc version: rustc 1.67.1 (d5a82bbd2 2023-02-07)
relevant settings: N/A
Consider following code:
If I'm trying to rename
inner
local variable on last line (println!("{}", inner);
) I get broken code:This happens wherever I use struct unpack syntax or
match
-statement. In both cases rust-analyzer reports incorrectTextEdit
offsets back to IDE (vscode).The problem seems to be related to #9403 and #13388 because manifest itself only in presence of
#[tokio::main]
or#[tokio::test]
proc macro.The text was updated successfully, but these errors were encountered: