Skip to content

Commit a551697

Browse files
committed
Don't be so eager to call unresolved inference variables an error. MC
is being used now before the final regionck stage and in some cases SOME amount of unresolved inference is OK. In fact, we could probably just allow inference variables as well with only minimal pain.
1 parent 4172c82 commit a551697

File tree

1 file changed

+9
-1
lines changed
  • src/librustc/middle/infer

1 file changed

+9
-1
lines changed

src/librustc/middle/infer/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,15 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
11621162
/// these unconstrained type variables.
11631163
fn resolve_type_vars_or_error(&self, t: &Ty<'tcx>) -> mc::McResult<Ty<'tcx>> {
11641164
let ty = self.resolve_type_vars_if_possible(t);
1165-
if ty.has_infer_types() || ty.references_error() { Err(()) } else { Ok(ty) }
1165+
if ty.references_error() {
1166+
debug!("resolve_type_vars_or_error: error from {:?}", ty);
1167+
Err(())
1168+
} else if ty.is_ty_var() {
1169+
debug!("resolve_type_vars_or_error: error from {:?}", ty);
1170+
Err(())
1171+
} else {
1172+
Ok(ty)
1173+
}
11661174
}
11671175

11681176
pub fn fully_resolve<T:TypeFoldable<'tcx>>(&self, value: &T) -> FixupResult<T> {

0 commit comments

Comments
 (0)