Activate the thread-local callable target cache. While the returned guard is alive, `resolve_instance_method_callable` caches callable target resolutions by `"FQN::method_lower"` so that the same method on the same class is resolved at most once per diagnostic pass, regardless of how many different chain expressions lead to it.
()
| 176 | /// diagnostic pass, regardless of how many different chain expressions |
| 177 | /// lead to it. |
| 178 | pub(crate) fn with_callable_target_cache() -> CallableTargetCacheGuard { |
| 179 | let already_active = CALLABLE_TARGET_CACHE.with(|cell| cell.borrow().is_some()); |
| 180 | if already_active { |
| 181 | return CallableTargetCacheGuard { owns: false }; |
| 182 | } |
| 183 | CALLABLE_TARGET_CACHE.with(|cell| { |
| 184 | *cell.borrow_mut() = Some(HashMap::new()); |
| 185 | }); |
| 186 | CallableTargetCacheGuard { owns: true } |
| 187 | } |
| 188 | |
| 189 | // ── Body return type inference ────────────────────────────────────────────── |
| 190 |
no outgoing calls
no test coverage detected