Commit 7d04d0a
Discover transitioned and labeled sibling targets for rust-analyzer
Summary:
When rust-analyzer resolves a Rust source file via path-based discovery (e.g. `arc rust-project develop-json '{"path":"..."}'`), Phase 1 BXL (`resolve_owning_buildfile_impl`) finds the owning target and its sibling targets in the same BUCK file. Previously, sibling discovery only matched `rust_binary|rust_library|rust_test` rule kinds. This caused failures for platform-constrained targets that rely on `transitioned()` wrappers for cross-compilation.
The failure mode:
1. Phase 1 finds the owning target (e.g. a `rust_binary` with `compatible_with` device constraints)
2. Phase 1 misses sibling `_transitioned` targets (which apply platform transitions) because they don't match the rust kind filter
3. Phase 2 (`expand_targets`) tries to configure the constrained target, but `ctx.analysis()` drops it as incompatible with the x86_64 host
4. No targets survive → empty target universe → `buck2 cquery` fails
This change makes three additions:
1. Sibling target discovery (Phase 1) now also matches `_?transitioned` rule kind, so transition wrapper targets in the same BUCK file are discovered alongside their constrained actual targets.
2. The `--buildfiles` code path gets the same `_?transitioned` kind filter plus `attrfilter("labels", "rust_analyzer_target")` for targets that opt in via label (e.g. those generated by `cli_transition_rules`).
3. Phase 2 `expand_targets` now includes `_?transitioned` in its `cquery().kind()` filter (alongside the existing `alias`), so discovered transition targets enter the configured target set. Since `_transitioned` forwards providers from its `actual` target, `RustAnalyzerInfo` is available and downstream processing works unchanged.
The `_?transitioned` regex handles both `transitioned` and `_transitioned` (the actual `buck.type` emitted by the `transitioned()` macro).
Reviewed By: dtolnay
Differential Revision: D93604237
fbshipit-source-id: fe1ea88bca70981619f154246210b5e019dd83351 parent f9d62aa commit 7d04d0a
1 file changed
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
272 | | - | |
| 272 | + | |
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
410 | | - | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
411 | 413 | | |
412 | 414 | | |
413 | 415 | | |
| |||
430 | 432 | | |
431 | 433 | | |
432 | 434 | | |
433 | | - | |
434 | | - | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
435 | 438 | | |
436 | 439 | | |
437 | 440 | | |
| |||
0 commit comments