about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-01-13 15:57:14 +0100
committerGitHub <noreply@github.com>2025-01-13 15:57:14 +0100
commit40f5861de90099617a2a6c38cda5cc037607b413 (patch)
tree3e65b339dad65151f21344e313833cb6a942a354 /compiler/rustc_codegen_llvm/src
parentb8dab0ead093938179385c9f1e73788264517eaf (diff)
parent9bf9f5db9b07cf0fa74bc5f2340ef13b6c22a96a (diff)
downloadrust-40f5861de90099617a2a6c38cda5cc037607b413.tar.gz
rust-40f5861de90099617a2a6c38cda5cc037607b413.zip
Rollup merge of #135426 - compiler-errors:no-resolve-assoc-ty, r=lcnr
Assert that `Instance::try_resolve` is only used on body-like things

`Instance::resolve` is not set up to resolve items that are not body-like things. The logic in `resolve_associated_item` very much encodes this assumption:

https://github.com/rust-lang/rust/blob/e7ad3ae331bf2716389c10e01612e201a7f98c8d/compiler/rustc_ty_utils/src/instance.rs#L96-L386

However, some diagnostics were using `Instance::resolve` on an associated type, and it was simply a lucky coicidence that nothing went wrong.

This PR adds an assertion to make sure we won't do this again in the future, and fixes two callsites:
1. `call_kind` which returns a `CallKind` enum to categorize what a call in MIR comes from, and was using `Instance::resolve` to point at the associated type `Deref::Target` for a specific self ty.
2. `MirBorrowckCtxt::explain_deref_coercion`, which was doing the same thing.

The logic was replaced with `specialization_graph::assoc_def`, which is the proper way of fetching the right `AssocItem` for a given impl.

r? `@lcnr` or re-roll :)
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions