Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/tests/regression/new_solver.rs')
-rw-r--r--crates/hir-ty/src/tests/regression/new_solver.rs56
1 files changed, 55 insertions, 1 deletions
diff --git a/crates/hir-ty/src/tests/regression/new_solver.rs b/crates/hir-ty/src/tests/regression/new_solver.rs
index ead79a8f5b..adc35cc9bc 100644
--- a/crates/hir-ty/src/tests/regression/new_solver.rs
+++ b/crates/hir-ty/src/tests/regression/new_solver.rs
@@ -1,6 +1,6 @@
use expect_test::expect;
-use crate::tests::{check_infer, check_no_mismatches};
+use crate::tests::{check_infer, check_no_mismatches, check_types};
#[test]
fn regression_20365() {
@@ -418,3 +418,57 @@ fn foo() {
"#]],
);
}
+
+#[test]
+fn regression_19637() {
+ check_no_mismatches(
+ r#"
+//- minicore: coerce_unsized
+pub trait Any {}
+
+impl<T: 'static> Any for T {}
+
+pub trait Trait: Any {
+ type F;
+}
+
+pub struct TT {}
+
+impl Trait for TT {
+ type F = f32;
+}
+
+pub fn coercion(x: &mut dyn Any) -> &mut dyn Any {
+ x
+}
+
+fn main() {
+ let mut t = TT {};
+ let tt = &mut t as &mut dyn Trait<F = f32>;
+ let st = coercion(tt);
+}
+ "#,
+ );
+}
+
+#[test]
+fn double_into_iter() {
+ check_types(
+ r#"
+//- minicore: iterator
+
+fn intoiter_issue<A, B>(foo: A)
+where
+ A: IntoIterator<Item = B>,
+ B: IntoIterator<Item = usize>,
+{
+ for x in foo {
+ // ^ B
+ for m in x {
+ // ^ usize
+ }
+ }
+}
+"#,
+ );
+}