diff options
Diffstat (limited to 'crates/hir_ty')
-rw-r--r-- | crates/hir_ty/src/display.rs | 12 | ||||
-rw-r--r-- | crates/hir_ty/src/tests.rs | 2 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/regression.rs | 2 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/traits.rs | 9 |
4 files changed, 17 insertions, 8 deletions
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index 0bf181a92..822ef4477 100644 --- a/crates/hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs | |||
@@ -332,7 +332,11 @@ impl HirDisplay for ApplicationTy { | |||
332 | let ret_display = if f.omit_verbose_types() { | 332 | let ret_display = if f.omit_verbose_types() { |
333 | ret.display_truncated(f.db, f.max_size) | 333 | ret.display_truncated(f.db, f.max_size) |
334 | } else { | 334 | } else { |
335 | ret.display(f.db) | 335 | if f.display_target.is_test() { |
336 | ret.display_test(f.db) | ||
337 | } else { | ||
338 | ret.display(f.db) | ||
339 | } | ||
336 | }; | 340 | }; |
337 | write!(f, " -> {}", ret_display)?; | 341 | write!(f, " -> {}", ret_display)?; |
338 | } | 342 | } |
@@ -472,7 +476,11 @@ impl HirDisplay for ApplicationTy { | |||
472 | let ret_display = if f.omit_verbose_types() { | 476 | let ret_display = if f.omit_verbose_types() { |
473 | sig.ret().display_truncated(f.db, f.max_size) | 477 | sig.ret().display_truncated(f.db, f.max_size) |
474 | } else { | 478 | } else { |
475 | sig.ret().display(f.db) | 479 | if f.display_target.is_test() { |
480 | sig.ret().display_test(f.db) | ||
481 | } else { | ||
482 | sig.ret().display(f.db) | ||
483 | } | ||
476 | }; | 484 | }; |
477 | write!(f, " -> {}", ret_display)?; | 485 | write!(f, " -> {}", ret_display)?; |
478 | } else { | 486 | } else { |
diff --git a/crates/hir_ty/src/tests.rs b/crates/hir_ty/src/tests.rs index 29b178ec1..104ef334c 100644 --- a/crates/hir_ty/src/tests.rs +++ b/crates/hir_ty/src/tests.rs | |||
@@ -74,7 +74,7 @@ fn check_types_impl(ra_fixture: &str, display_source: bool) { | |||
74 | let module = db.module_for_file(file_id); | 74 | let module = db.module_for_file(file_id); |
75 | ty.display_source_code(&db, module).unwrap() | 75 | ty.display_source_code(&db, module).unwrap() |
76 | } else { | 76 | } else { |
77 | ty.display(&db).to_string() | 77 | ty.display_test(&db).to_string() |
78 | }; | 78 | }; |
79 | assert_eq!(expected, actual); | 79 | assert_eq!(expected, actual); |
80 | checked_one = true; | 80 | checked_one = true; |
diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs index 42d08f12c..94d86b0d1 100644 --- a/crates/hir_ty/src/tests/regression.rs +++ b/crates/hir_ty/src/tests/regression.rs | |||
@@ -832,7 +832,7 @@ fn issue_4966() { | |||
832 | 365..390 'Repeat...nner }': Repeat<Map<|&f64| -> f64>> | 832 | 365..390 'Repeat...nner }': Repeat<Map<|&f64| -> f64>> |
833 | 383..388 'inner': Map<|&f64| -> f64> | 833 | 383..388 'inner': Map<|&f64| -> f64> |
834 | 401..404 'vec': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>> | 834 | 401..404 'vec': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>> |
835 | 407..416 'from_iter': fn from_iter<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>, Repeat<Map<|&f64| -> f64>>>(Repeat<Map<|&f64| -> f64>>) -> Vec<<Repeat<Map<|&f64| -> f64>> as IntoIterator>::Item> | 835 | 407..416 'from_iter': fn from_iter<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>, Repeat<Map<|&f64| -> f64>>>(Repeat<Map<|&f64| -> f64>>) -> Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>> |
836 | 407..424 'from_i...epeat)': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>> | 836 | 407..424 'from_i...epeat)': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>> |
837 | 417..423 'repeat': Repeat<Map<|&f64| -> f64>> | 837 | 417..423 'repeat': Repeat<Map<|&f64| -> f64>> |
838 | 431..434 'vec': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>> | 838 | 431..434 'vec': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>> |
diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs index 4d193dea9..41d097519 100644 --- a/crates/hir_ty/src/tests/traits.rs +++ b/crates/hir_ty/src/tests/traits.rs | |||
@@ -907,7 +907,8 @@ fn test<T: Trait>(t: T) { (*t); } | |||
907 | } | 907 | } |
908 | 908 | ||
909 | #[test] | 909 | #[test] |
910 | fn associated_type_inlay_hints() { | 910 | fn associated_type_placeholder() { |
911 | // inside the generic function, the associated type gets normalized to a placeholder `ApplL::Out<T>` [https://rust-lang.github.io/rustc-guide/traits/associated-types.html#placeholder-associated-types]. | ||
911 | check_types( | 912 | check_types( |
912 | r#" | 913 | r#" |
913 | pub trait ApplyL { | 914 | pub trait ApplyL { |
@@ -923,13 +924,13 @@ impl<T> ApplyL for RefMutL<T> { | |||
923 | fn test<T: ApplyL>() { | 924 | fn test<T: ApplyL>() { |
924 | let y: <RefMutL<T> as ApplyL>::Out = no_matter; | 925 | let y: <RefMutL<T> as ApplyL>::Out = no_matter; |
925 | y; | 926 | y; |
926 | } //^ <T as ApplyL>::Out | 927 | } //^ ApplyL::Out<T> |
927 | "#, | 928 | "#, |
928 | ); | 929 | ); |
929 | } | 930 | } |
930 | 931 | ||
931 | #[test] | 932 | #[test] |
932 | fn associated_type_inlay_hints_2() { | 933 | fn associated_type_placeholder_2() { |
933 | check_types( | 934 | check_types( |
934 | r#" | 935 | r#" |
935 | pub trait ApplyL { | 936 | pub trait ApplyL { |
@@ -940,7 +941,7 @@ fn foo<T: ApplyL>(t: T) -> <T as ApplyL>::Out; | |||
940 | fn test<T: ApplyL>(t: T) { | 941 | fn test<T: ApplyL>(t: T) { |
941 | let y = foo(t); | 942 | let y = foo(t); |
942 | y; | 943 | y; |
943 | } //^ <T as ApplyL>::Out | 944 | } //^ ApplyL::Out<T> |
944 | "#, | 945 | "#, |
945 | ); | 946 | ); |
946 | } | 947 | } |