self.cause(span, ObligationCauseCode::MiscObligation)
}
- /// Resolves type variables in `ty` if possible. Unlike the infcx
+ /// Resolves type and const variables in `ty` if possible. Unlike the infcx
/// version (resolve_vars_if_possible), this version will
/// also select obligations if it seems useful, in an effort
/// to get more type information.
- fn resolve_type_vars_with_obligations(&self, mut ty: Ty<'tcx>) -> Ty<'tcx> {
- debug!("resolve_type_vars_with_obligations(ty={:?})", ty);
+ fn resolve_vars_with_obligations(&self, mut ty: Ty<'tcx>) -> Ty<'tcx> {
+ debug!("resolve_vars_with_obligations(ty={:?})", ty);
// No Infer()? Nothing needs doing.
if !ty.has_infer_types() && !ty.has_infer_consts() {
- debug!("resolve_type_vars_with_obligations: ty={:?}", ty);
+ debug!("resolve_vars_with_obligations: ty={:?}", ty);
return ty;
}
// If `ty` is a type variable, see whether we already know what it is.
ty = self.resolve_vars_if_possible(&ty);
if !ty.has_infer_types() && !ty.has_infer_consts() {
- debug!("resolve_type_vars_with_obligations: ty={:?}", ty);
+ debug!("resolve_vars_with_obligations: ty={:?}", ty);
return ty;
}
self.select_obligations_where_possible(false, |_| {});
ty = self.resolve_vars_if_possible(&ty);
- debug!("resolve_type_vars_with_obligations: ty={:?}", ty);
+ debug!("resolve_vars_with_obligations: ty={:?}", ty);
ty
}
formal_ret: Ty<'tcx>,
formal_args: &[Ty<'tcx>])
-> Vec<Ty<'tcx>> {
- let formal_ret = self.resolve_type_vars_with_obligations(formal_ret);
+ let formal_ret = self.resolve_vars_with_obligations(formal_ret);
let ret_ty = match expected_ret.only_has_type(self) {
Some(ret) => ret,
None => return Vec::new()
err.span_suggestion(
span,
"try adding a return type",
- format!("-> {} ", self.resolve_type_vars_with_obligations(found)),
+ format!("-> {} ", self.resolve_vars_with_obligations(found)),
Applicability::MachineApplicable);
true
}
// If no resolution is possible, then an error is reported.
// Numeric inference variables may be left unresolved.
pub fn structurally_resolved_type(&self, sp: Span, ty: Ty<'tcx>) -> Ty<'tcx> {
- let ty = self.resolve_type_vars_with_obligations(ty);
+ let ty = self.resolve_vars_with_obligations(ty);
if !ty.is_ty_var() {
ty
} else {