1
Fork 0

Avoid a duplicated error case in fn_sig_suggestion.

This commit is contained in:
Nicholas Nethercote 2025-01-29 15:07:02 +11:00
parent 97d1b0cbcd
commit b546334f6c

View file

@ -455,18 +455,14 @@ fn fn_sig_suggestion<'tcx>(
let mut output = sig.output();
let asyncness = if tcx.asyncness(assoc.def_id).is_async() {
output = if let ty::Alias(_, alias_ty) = *output.kind() {
tcx.explicit_item_self_bounds(alias_ty.def_id)
output = if let ty::Alias(_, alias_ty) = *output.kind()
&& let Some(output) = tcx
.explicit_item_self_bounds(alias_ty.def_id)
.iter_instantiated_copied(tcx, alias_ty.args)
.find_map(|(bound, _)| {
bound.as_projection_clause()?.no_bound_vars()?.term.as_type()
})
.unwrap_or_else(|| {
span_bug!(
ident.span,
"expected async fn to have `impl Future` output, but it returns {output}"
)
})
}) {
output
} else {
span_bug!(
ident.span,