aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-12-13 13:52:45 +0000
committerFlorian Diebold <[email protected]>2020-12-13 13:53:04 +0000
commit4788aaa5f07da85707b7bf409b5d25df1682a760 (patch)
treedbe9c8211ce85e866b0d0658cfb74921f59a70a2 /crates
parent48802e54d1669c68fd27b007533dd6aa5221d089 (diff)
Add test for #6852
Diffstat (limited to 'crates')
-rw-r--r--crates/hir_ty/src/tests/regression.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs
index 8cf4e7012..da8170417 100644
--- a/crates/hir_ty/src/tests/regression.rs
+++ b/crates/hir_ty/src/tests/regression.rs
@@ -883,3 +883,40 @@ fn issue_6628() {
883 "#]], 883 "#]],
884 ); 884 );
885} 885}
886
887#[test]
888fn issue_6852() {
889 check_infer(
890 r#"
891 #[lang = "deref"]
892 pub trait Deref {
893 type Target;
894 }
895
896 struct BufWriter {}
897
898 struct Mutex<T> {}
899 struct MutexGuard<'a, T> {}
900 impl<T> Mutex<T> {
901 fn lock(&self) -> MutexGuard<'_, T> {}
902 }
903 impl<'a, T: 'a> Deref for MutexGuard<'a, T> {
904 type Target = T;
905 }
906 fn flush(&self) {
907 let w: &Mutex<BufWriter>;
908 *(w.lock());
909 }
910 "#,
911 expect![[r#"
912 156..160 'self': &Mutex<T>
913 183..185 '{}': ()
914 267..271 'self': &{unknown}
915 273..323 '{ ...()); }': ()
916 283..284 'w': &Mutex<BufWriter>
917 309..320 '*(w.lock())': BufWriter
918 311..312 'w': &Mutex<BufWriter>
919 311..319 'w.lock()': MutexGuard<BufWriter>
920 "#]],
921 );
922}