From 51fc786e14dfdf6ec6db5dc909ec467a02df1350 Mon Sep 17 00:00:00 2001 From: mvanbem Date: Wed, 24 Jun 2026 09:45:57 -0700 Subject: [PATCH] Adapt to upstream rustc changes to `AliasTyKind::def_id` https://github.com/rust-lang/rust/pull/158013 It looks like the intent of these changes is that `AliasTyKind` will eventually gain variants that don't have a `DefId`. I'm not sure what we are going to do with that, but for now we can match on the variants, all of which do have a `DefId`. --- .../generate_bindings/generate_function.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cc_bindings_from_rs/generate_bindings/generate_function.rs b/cc_bindings_from_rs/generate_bindings/generate_function.rs index 3d074de4c..ead04f0c6 100644 --- a/cc_bindings_from_rs/generate_bindings/generate_function.rs +++ b/cc_bindings_from_rs/generate_bindings/generate_function.rs @@ -1212,8 +1212,15 @@ pub fn get_async_future_output_ty<'tcx>( .ok_or_else(|| anyhow!("crubit.rs-bug: Future::Output lang item not found"))?; #[rustversion::stable(1.95)] let alias_def_id = alias_ty.def_id; - #[rustversion::any(nightly, stable(1.96))] + #[rustversion::any(all(nightly, before(2026-06-23)), stable(1.96))] let alias_def_id = alias_ty.kind.def_id(); + #[rustversion::all(nightly, since(2026-06-23))] + let alias_def_id = alias_ty.kind.try_to_projection().ok_or_else(|| { + anyhow!( + "go/crubit-bug: async function return type has unexpected alias kind (not a \ + projection/trait associated type)", + ) + })?; tcx.explicit_item_bounds(alias_def_id) .iter_instantiated_copied(tcx, alias_ty.args) .find_map(|unnorm| {