Skip to content

Commit 4fe10b7

Browse files
bors[bot]Veykril
andauthored
Merge #11265
11265: fix: Fix postfix completion panic r=lnicola a=Veykril Fixes #11233 bors r+ Co-authored-by: Lukas Wirth <[email protected]>
2 parents de50ef4 + 09ce5d8 commit 4fe10b7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/ide_completion/src/completions/postfix.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ fn build_postfix_snippet_builder<'ctx>(
225225
) -> Option<impl Fn(&str, &str, &str) -> Builder + 'ctx> {
226226
let receiver_syntax = receiver.syntax();
227227
let receiver_range = ctx.sema.original_range_opt(receiver_syntax)?.range;
228+
if ctx.source_range().end() < receiver_range.start() {
229+
// This shouldn't happen, yet it does. I assume this might be due to an incorrect token mapping.
230+
return None;
231+
}
228232
let delete_range = TextRange::new(receiver_range.start(), ctx.source_range().end());
229233

230234
// Wrapping impl Fn in an option ruins lifetime inference for the parameters in a way that

0 commit comments

Comments
 (0)