From 1ee921e7f18f7116d3111434d7ab88bd27755590 Mon Sep 17 00:00:00 2001 From: Xiaoyi Shi Date: Wed, 22 Oct 2025 11:25:22 +0800 Subject: [PATCH] Fix aliased crate handling in aliases attribute This change addresses an issue where crate_universe configuration using default_alias_rule_bzl would fail when processing aliased crates in the aliases() function. The problem occurs because aliased targets have crate_info.owner that points to the original target, not the alias label. This change ensures we use the correct owner label for alias resolution. Fixes #3692 --- rust/private/rustc.bzl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl index 48be035043..77a175f494 100644 --- a/rust/private/rustc.bzl +++ b/rust/private/rustc.bzl @@ -271,7 +271,10 @@ def collect_deps( else: crate_deps.append(dep) - aliases = {k.label: v for k, v in aliases.items()} + aliases = { + k[rust_common.crate_info].owner if rust_common.crate_info in k else k.label: v + for k, v in aliases.items() + } for dep in crate_deps: crate_info = dep.crate_info dep_info = dep.dep_info