Skip to content

Commit e949375

Browse files
Merge #11610
11610: Add a (currently failing) test for #11242 r=flodiebold a=flodiebold Co-authored-by: Florian Diebold <[email protected]>
2 parents f470f35 + 82fe1c7 commit e949375

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

crates/hir_ty/src/infer/coerce.rs

+2
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,10 @@ impl<'a> InferenceContext<'a> {
555555
);
556556
}
557557
Solution::Ambig(Guidance::Definite(subst)) => {
558+
// FIXME need to record an obligation here
558559
canonicalized.apply_solution(&mut self.table, subst)
559560
}
561+
// FIXME actually we maybe should also accept unknown guidance here
560562
_ => return Err(TypeError),
561563
};
562564
let unsize =

crates/hir_ty/src/tests/regression.rs

+31
Original file line numberDiff line numberDiff line change
@@ -1267,3 +1267,34 @@ fn test() {
12671267
"#]],
12681268
);
12691269
}
1270+
1271+
#[test]
1272+
fn bug_11242() {
1273+
// FIXME: wrong, should be u32
1274+
check_types(
1275+
r#"
1276+
fn foo<A, B>()
1277+
where
1278+
A: IntoIterator<Item = u32>,
1279+
B: IntoIterator<Item = usize>,
1280+
{
1281+
let _x: <A as IntoIterator>::Item;
1282+
// ^^ {unknown}
1283+
}
1284+
1285+
pub trait Iterator {
1286+
type Item;
1287+
}
1288+
1289+
pub trait IntoIterator {
1290+
type Item;
1291+
type IntoIter: Iterator<Item = Self::Item>;
1292+
}
1293+
1294+
impl<I: Iterator> IntoIterator for I {
1295+
type Item = I::Item;
1296+
type IntoIter = I;
1297+
}
1298+
"#,
1299+
);
1300+
}

0 commit comments

Comments
 (0)