* A bare Rust name reaches only what is in scope — every strategy's result, * a framework resolver's `Ok(x)` → `struct Ok` construction included (see * isRustNameInScope). A call through a path whose type is from outside the * project reaches only the project's impls for that type (or of th
(result: ResolvedRef | null, ref: UnresolvedRef)
| 4453 | * impl on a std type only as Rust would pick it (isRustForeignImplCallable). |
| 4454 | */ |
| 4455 | private gateRustScope(result: ResolvedRef | null, ref: UnresolvedRef): ResolvedRef | null { |
| 4456 | if (!result || ref.language !== 'rust') return result; |
| 4457 | const bare = /^[A-Za-z_]\w*$/.test(ref.referenceName); |
| 4458 | if (!bare && ref.referenceKind !== 'calls') return result; |
| 4459 | const target = this.nodeById(result.targetNodeId); |
| 4460 | if (!target) return result; |
| 4461 | if (bare && !isRustNameInScope(target, ref, this.context)) return null; |
| 4462 | if (ref.referenceKind !== 'calls') return result; |
| 4463 | if (!bare && !isRustPathCallReachable(target, ref, this.context)) return null; |
| 4464 | return isRustForeignImplCallable(target, ref, this.context) ? result : null; |
| 4465 | } |
| 4466 | |
| 4467 | /** |
| 4468 | * The context production code is resolved in when the project has Jest or |