about summary refs log tree commit diff
path: root/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-unwind.diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-12 14:11:20 +0000
committerbors <bors@rust-lang.org>2023-04-12 14:11:20 +0000
commit1ee88db4121bfd4bad1dcfdb64922f126d93e286 (patch)
treeb3ab82616b6453c666f8ba5fc97905c10c610e68 /tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-unwind.diff
parent7501d3b721560637e27f904d9fce79182c41bef7 (diff)
parentc978d4bf0c92e77ef94f354af8402af71bd7b5ab (diff)
downloadrust-1ee88db4121bfd4bad1dcfdb64922f126d93e286.tar.gz
rust-1ee88db4121bfd4bad1dcfdb64922f126d93e286.zip
Auto merge of #14533 - lowr:feat/text-edits-for-inlay-hints, r=Veykril
feat: make inlay hints insertable

Part of #13812

This PR implements text edit for inlay hints. When an inlay hint contain text edit, user can "accept" it (e.g. by double-clicking in VS Code) to make the hint actual code (effectively deprecating the hint itself).

This PR does not implement auto import despite the original request; text edits only insert qualified types along with necessary punctuation. I feel there are some missing pieces to implement efficient auto import (in particular, type traversal function with early exit) so left it for future work. Even without it, user can use `replace_qualified_name_with_use` assist after accepting the edit to achieve the same result.

I implemented for the following inlay hints:
- top-level identifier pattern in let statements
- top-level identifier pattern in closure parameters
- closure return type when its has block body

One somewhat strange interaction can be observed when top-level identifier pattern has subpattern: text edit inserts type annotation in different place than the inlay hint. Do we want to allow it or should we not provide text edits for these cases at all?

```rust
let a /* inlay hint shown here */ @ (b, c) = foo();
let a @ (b, c) /* text edit inserts types here */ = foo();
```
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-unwind.diff')
0 files changed, 0 insertions, 0 deletions