Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/tests/method_resolution.rs')
-rw-r--r--crates/hir-ty/src/tests/method_resolution.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/crates/hir-ty/src/tests/method_resolution.rs b/crates/hir-ty/src/tests/method_resolution.rs
index 2084c01853..985ecb6c5d 100644
--- a/crates/hir-ty/src/tests/method_resolution.rs
+++ b/crates/hir-ty/src/tests/method_resolution.rs
@@ -2258,3 +2258,30 @@ fn main() {
"#,
);
}
+
+#[test]
+fn trait_impl_with_error_self_ty_does_not_match_arbitrary_receiver() {
+ check_types(
+ r#"
+//- minicore: sized
+trait UnrelatedTrait {
+ fn take(self) {}
+}
+
+struct MyOption<T>(T);
+
+impl<T> MyOption<T> {
+ fn take(&mut self) -> MyOption<T> {
+ loop {}
+ }
+}
+
+fn f<T>(mut o: MyOption<T>) {
+ let value = o.take();
+ //^^^^^ MyOption<T>
+}
+
+impl UnrelatedTrait for &'_ MissingType {}
+"#,
+ );
+}