diff options
Diffstat (limited to 'crates/hir_ty/src/tests')
-rw-r--r-- | crates/hir_ty/src/tests/regression.rs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs index 94d86b0d1..8cf4e7012 100644 --- a/crates/hir_ty/src/tests/regression.rs +++ b/crates/hir_ty/src/tests/regression.rs | |||
@@ -840,3 +840,46 @@ fn issue_4966() { | |||
840 | "#]], | 840 | "#]], |
841 | ); | 841 | ); |
842 | } | 842 | } |
843 | |||
844 | #[test] | ||
845 | fn issue_6628() { | ||
846 | check_infer( | ||
847 | r#" | ||
848 | #[lang = "fn_once"] | ||
849 | pub trait FnOnce<Args> { | ||
850 | type Output; | ||
851 | } | ||
852 | |||
853 | struct S<T>(); | ||
854 | impl<T> S<T> { | ||
855 | fn f(&self, _t: T) {} | ||
856 | fn g<F: FnOnce(&T)>(&self, _f: F) {} | ||
857 | } | ||
858 | fn main() { | ||
859 | let s = S(); | ||
860 | s.g(|_x| {}); | ||
861 | s.f(10); | ||
862 | } | ||
863 | "#, | ||
864 | expect![[r#" | ||
865 | 105..109 'self': &S<T> | ||
866 | 111..113 '_t': T | ||
867 | 118..120 '{}': () | ||
868 | 146..150 'self': &S<T> | ||
869 | 152..154 '_f': F | ||
870 | 159..161 '{}': () | ||
871 | 174..225 '{ ...10); }': () | ||
872 | 184..185 's': S<i32> | ||
873 | 188..189 'S': S<i32>() -> S<i32> | ||
874 | 188..191 'S()': S<i32> | ||
875 | 197..198 's': S<i32> | ||
876 | 197..209 's.g(|_x| {})': () | ||
877 | 201..208 '|_x| {}': |&i32| -> () | ||
878 | 202..204 '_x': &i32 | ||
879 | 206..208 '{}': () | ||
880 | 215..216 's': S<i32> | ||
881 | 215..222 's.f(10)': () | ||
882 | 219..221 '10': i32 | ||
883 | "#]], | ||
884 | ); | ||
885 | } | ||