about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-03-05 12:35:03 +0000
committerbors <bors@rust-lang.org>2024-03-05 12:35:03 +0000
commit223238d9e7947866eafa65056feb79752615c3d0 (patch)
tree10ffc5cc6fd57e8cff8711bbe32ddaf0004971f7 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent7c786ed96f78dcd938d4a143993a3bb6c136435d (diff)
parent9cc3a9cfc25ea36ceb0474011d51de4fc7d42f7a (diff)
downloadrust-223238d9e7947866eafa65056feb79752615c3d0.tar.gz
rust-223238d9e7947866eafa65056feb79752615c3d0.zip
Auto merge of #16759 - roife:fix-goto-def-for-constants-in-range-pattern, r=Veykril
fix: goto-definition for constants inside range pattern

Fix #15653.

This PR addresses the issue where it was not possible to navigate to constants in range patterns, specifically including two major changes:

1. Previously, both the `start` and `end` fields in `Pat::Range` were of type `LiteralOrConst`. When performing `goto-definition` on constants inside range patterns, r-a would use `resolve_bind_pat_to_const` to find their definitions. However, because the content of a `Const` is not `Pat` but `Path`, it was not stored in the `source_map`, so `resolve_bind_pat_to_const` would returns `None`. This PR changes them to `Const(PatId)`, so that during the lowering process, they are considered as a `pat`, allowing their definitions to be found later through `resolve_bind_pat_to_const`.

2. The process related to range patterns in MIR-lowering has been modified to correctly handle the above changes.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions