rust/crates/rust-analyzer
bors[bot] 0808ade4e4
Merge #11182
11182: fix: don't panic on seeing an unexpected offset r=Veykril a=dimbleby

Intended as a fix, or at least a sticking plaster, for #11081.

I have arranged that [offset()](1ba9a924d7/crates/ide_db/src/line_index.rs (L105-L107)) returns `Option<TextSize>` instead of going out of bounds; other changes are the result of following the compiler after doing this.

Perhaps there's still an issue here - I suppose the server and client have gotten out of sync and that probably shouldn't happen in the first place?  I see that https://github.com/rust-analyzer/rust-analyzer/issues/10138#issuecomment-913727554 suggests what sounds like a more substantial fix which I think might be aimed in this direction.  So perhaps that one should be left open to cover such things?

Meanwhile, I hope that not-crashing is a good improvement: and I can confirm that it works out just fine in the repro I have at #11081.

Co-authored-by: David Hotham <david.hotham@metaswitch.com>
2022-01-31 11:16:22 +00:00
..
src Merge #11182 2022-01-31 11:16:22 +00:00
tests/slow-tests Fix merge commit check for git 2.35 2022-01-26 19:10:39 +01:00
build.rs Add semicolons for consistency 2021-10-03 23:39:43 +11:00
Cargo.toml cleanup + detect num cpus 2022-01-14 09:48:59 +00:00