| 1244 | // ── Rust `self.<field>.<method>()` receivers (#1585) ─────────────────── |
| 1245 | // A Cargo layout (Cargo.toml + src/) so `use crate::…` paths resolve. |
| 1246 | function writeRustCrate(root: string, files: Record<string, string>): void { |
| 1247 | fs.writeFileSync( |
| 1248 | path.join(root, 'Cargo.toml'), |
| 1249 | '[package]\nname = "repro"\nversion = "0.1.0"\nedition = "2021"\n' |
| 1250 | ); |
| 1251 | fs.mkdirSync(path.join(root, 'src'), { recursive: true }); |
| 1252 | for (const [rel, content] of Object.entries(files)) { |
| 1253 | fs.writeFileSync(path.join(root, 'src', rel), content); |
| 1254 | } |
| 1255 | } |
| 1256 | const callsFrom = (qualifiedName: string) => { |
| 1257 | const from = cg.getNodesByKind('method').find((n) => n.qualifiedName === qualifiedName); |
| 1258 | expect(from, qualifiedName).toBeDefined(); |