Skip to content

Commit

Permalink
Merge #11610
Browse files Browse the repository at this point in the history
11610: Add a (currently failing) test for #11242 r=flodiebold a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
  • Loading branch information
bors[bot] and flodiebold authored Mar 3, 2022
2 parents f470f35 + 82fe1c7 commit e949375
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/hir_ty/src/infer/coerce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,10 @@ impl<'a> InferenceContext<'a> {
);
}
Solution::Ambig(Guidance::Definite(subst)) => {
// FIXME need to record an obligation here
canonicalized.apply_solution(&mut self.table, subst)
}
// FIXME actually we maybe should also accept unknown guidance here
_ => return Err(TypeError),
};
let unsize =
Expand Down
31 changes: 31 additions & 0 deletions crates/hir_ty/src/tests/regression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1267,3 +1267,34 @@ fn test() {
"#]],
);
}

#[test]
fn bug_11242() {
// FIXME: wrong, should be u32
check_types(
r#"
fn foo<A, B>()
where
A: IntoIterator<Item = u32>,
B: IntoIterator<Item = usize>,
{
let _x: <A as IntoIterator>::Item;
// ^^ {unknown}
}
pub trait Iterator {
type Item;
}
pub trait IntoIterator {
type Item;
type IntoIter: Iterator<Item = Self::Item>;
}
impl<I: Iterator> IntoIterator for I {
type Item = I::Item;
type IntoIter = I;
}
"#,
);
}

0 comments on commit e949375

Please sign in to comment.