Skip to content

Commit cdc86bb

Browse files
committed
Avoid a duplicated error case in fn_sig_suggestion.
1 parent 7de7467 commit cdc86bb

File tree

1 file changed

+5
-9
lines changed
  • compiler/rustc_hir_analysis/src/check

1 file changed

+5
-9
lines changed

compiler/rustc_hir_analysis/src/check/mod.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -456,18 +456,14 @@ fn fn_sig_suggestion<'tcx>(
456456
let mut output = sig.output();
457457

458458
let asyncness = if tcx.asyncness(assoc.def_id).is_async() {
459-
output = if let ty::Alias(_, alias_ty) = *output.kind() {
460-
tcx.explicit_item_super_predicates(alias_ty.def_id)
459+
output = if let ty::Alias(_, alias_ty) = *output.kind()
460+
&& let Some(output) = tcx
461+
.explicit_item_super_predicates(alias_ty.def_id)
461462
.iter_instantiated_copied(tcx, alias_ty.args)
462463
.find_map(|(bound, _)| {
463464
bound.as_projection_clause()?.no_bound_vars()?.term.as_type()
464-
})
465-
.unwrap_or_else(|| {
466-
span_bug!(
467-
ident.span,
468-
"expected async fn to have `impl Future` output, but it returns {output}"
469-
)
470-
})
465+
}) {
466+
output
471467
} else {
472468
span_bug!(
473469
ident.span,

0 commit comments

Comments
 (0)