Add comment and mark

This commit is contained in:
Florian Diebold 2019-02-09 22:03:01 +01:00
parent a28d4befaf
commit c098a3fda5
3 changed files with 10 additions and 2 deletions

View file

@ -3,4 +3,5 @@ test_utils::marks!(
item_map_enum_importing
type_var_cycles_resolve_completely
type_var_cycles_resolve_as_possible
type_var_resolves_to_int_var
);

View file

@ -1003,8 +1003,13 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
/// otherwise, return ty.
fn resolve_ty_shallow<'b>(&mut self, ty: &'b Ty) -> Cow<'b, Ty> {
let mut ty = Cow::Borrowed(ty);
for _ in 0..3 {
// the type variable could resolve to a int/float variable
// The type variable could resolve to a int/float variable. Hence try
// resolving up to three times; each type of variable shouldn't occur
// more than once
for i in 0..3 {
if i > 0 {
tested_by!(type_var_resolves_to_int_var);
}
match &*ty {
Ty::Infer(tv) => {
let inner = tv.to_inner();
@ -1019,6 +1024,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
_ => return ty,
}
}
log::error!("Inference variable still not resolved: {:?}", ty);
ty
}

View file

@ -652,6 +652,7 @@ fn write() {
#[test]
fn infer_std_crash_2() {
covers!(type_var_resolves_to_int_var);
// caused "equating two type variables, ...", taken from std
check_inference(
"infer_std_crash_2",