mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Merge #11265
11265: fix: Fix postfix completion panic r=lnicola a=Veykril Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11233 bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
4fe10b7bfe
1 changed files with 4 additions and 0 deletions
|
@ -225,6 +225,10 @@ fn build_postfix_snippet_builder<'ctx>(
|
|||
) -> Option<impl Fn(&str, &str, &str) -> Builder + 'ctx> {
|
||||
let receiver_syntax = receiver.syntax();
|
||||
let receiver_range = ctx.sema.original_range_opt(receiver_syntax)?.range;
|
||||
if ctx.source_range().end() < receiver_range.start() {
|
||||
// This shouldn't happen, yet it does. I assume this might be due to an incorrect token mapping.
|
||||
return None;
|
||||
}
|
||||
let delete_range = TextRange::new(receiver_range.start(), ctx.source_range().end());
|
||||
|
||||
// Wrapping impl Fn in an option ruins lifetime inference for the parameters in a way that
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue