Skip to content

Preserve substitutions when making trait obligations for suggestions #71618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 24, 2020
Merged
Prev Previous commit
Next Next commit
Bail out if output_ty has bound variables
  • Loading branch information
ecstatic-morse committed May 22, 2020
commit f99519bebb2cdd90379bb2b07a0cfdeeb5d2d469
Original file line number Diff line number Diff line change
Expand Up @@ -532,11 +532,15 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
};
let msg = format!("use parentheses to call the {}", callable);

let new_obligation = self.mk_trait_obligation_with_new_self_ty(
obligation.param_env,
trait_ref,
output_ty.skip_binder(),
);
// `mk_trait_obligation_with_new_self_ty` only works for types with no escaping bound
// variables, so bail out if we have any.
let output_ty = match output_ty.no_bound_vars() {
Some(ty) => ty,
None => return,
};

let new_obligation =
self.mk_trait_obligation_with_new_self_ty(obligation.param_env, trait_ref, output_ty);

match self.evaluate_obligation(&new_obligation) {
Ok(
Expand Down