Skip to content

Commit f99519b

Browse files
Bail out if output_ty has bound variables
1 parent 7278e29 commit f99519b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/librustc_trait_selection/traits/error_reporting/suggestions.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -532,11 +532,15 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
532532
};
533533
let msg = format!("use parentheses to call the {}", callable);
534534

535-
let new_obligation = self.mk_trait_obligation_with_new_self_ty(
536-
obligation.param_env,
537-
trait_ref,
538-
output_ty.skip_binder(),
539-
);
535+
// `mk_trait_obligation_with_new_self_ty` only works for types with no escaping bound
536+
// variables, so bail out if we have any.
537+
let output_ty = match output_ty.no_bound_vars() {
538+
Some(ty) => ty,
539+
None => return,
540+
};
541+
542+
let new_obligation =
543+
self.mk_trait_obligation_with_new_self_ty(obligation.param_env, trait_ref, output_ty);
540544

541545
match self.evaluate_obligation(&new_obligation) {
542546
Ok(

0 commit comments

Comments
 (0)