8658: Check more carefully for cases where a rename can't be done r=Veykril a=dzhu
Attempting to rename an element of a tuple field would previously replace the type with the new name, which doesn't make sense; now it fails instead.
The check is done in both `prepare_rename` and `rename` so that the case is caught before the user is prompted for a new name. Some other existing failure cases are also now additionally checked in `prepare_rename`.
Closes: #8592
(I threw in some doc edits for a relevant type; of course, I can remove those if the policy here is to be strict about scope of changes within a PR.)
Co-authored-by: Danny Zhu <dzhu@dzhu.us>
Attempting to rename an element of a tuple field would previously
replace the type with the new name, which doesn't make sense; now it
fails instead.
The check is done in both `prepare_rename` and `rename` so that the case
is caught before the user is prompted for a new name. Some other
existing failure cases are also now additionally checked in
`prepare_rename`.
8591: Remove SyntaxRewriter usage in insert_use in favor of mutable syntax trees r=matklad a=Veykril
Unfortunately changing `insert_use` to not use `SyntaxRewriter` creates a lot of changes since so much relies on that. But on the other hand this should be the biggest usage of `SyntaxRewriter` I believe.
8638: Remove SyntaxRewriter::from_fn r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
8637: Tag `yield` and `await` as ControlFlow in semantic highlighting r=Veykril a=Veykril
and shuffle some code around
Closes#8634
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
8620: Remove unnecessary braces for extracted block expression r=Veykril a=brandondong
This change addresses the first bullet point of https://github.com/rust-analyzer/rust-analyzer/issues/7839.
Specifically, when extracting block expressions, remove the unneeded extra braces inside the generated function.
Co-authored-by: Brandon <brandondong604@hotmail.com>
8595: Diagnostic paths support specifying `remapPrefix` r=rickvanprim a=rickvanprim
Currently VSCode Problem Matchers will resolve a path like `//foo_crate/src/main.rs` if `${workspaceFolder}/foo_crate/src/main.rs` exists. Presumably their behavior is functionally a string concatenation that would produce `${workspaceFolder///foo_crate/src/main.rs` and repeated path separators get ignored.
This PR attempts to mimic this behavior by stripping any `Component::RootDir` from `file_name` before joining it to `workspace_root`, and then checking if the file exists. If it does, this path is used, and if not, the behavior falls through to the existing Rust path join behavior.
Co-authored-by: James Leitch <rickvanprim@gmail.com>
8570: Flycheck tries to parse both Cargo and Rustc messages. r=rickvanprim a=rickvanprim
This change allows non-Cargo build systems to be used for Flycheck provided they call `rustc` with `--error-format=json` and emit those JSON messages to `stdout`.
Co-authored-by: James Leitch <rickvanprim@gmail.com>