Skip to content

Commit b546334

Browse files
committed
Avoid a duplicated error case in fn_sig_suggestion.
1 parent 97d1b0c commit b546334

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
@@ -455,18 +455,14 @@ fn fn_sig_suggestion<'tcx>(
455455
let mut output = sig.output();
456456

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

0 commit comments

Comments
 (0)