File tree Expand file tree Collapse file tree 4 files changed +17
-8
lines changed Expand file tree Collapse file tree 4 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -332,7 +332,11 @@ impl HirDisplay for ApplicationTy {
332332 let ret_display = if f. omit_verbose_types ( ) {
333333 ret. display_truncated ( f. db , f. max_size )
334334 } 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+ }
336340 } ;
337341 write ! ( f, " -> {}" , ret_display) ?;
338342 }
@@ -472,7 +476,11 @@ impl HirDisplay for ApplicationTy {
472476 let ret_display = if f. omit_verbose_types ( ) {
473477 sig. ret ( ) . display_truncated ( f. db , f. max_size )
474478 } 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+ }
476484 } ;
477485 write ! ( f, " -> {}" , ret_display) ?;
478486 } else {
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ fn check_types_impl(ra_fixture: &str, display_source: bool) {
7474 let module = db. module_for_file ( file_id) ;
7575 ty. display_source_code ( & db, module) . unwrap ( )
7676 } else {
77- ty. display ( & db) . to_string ( )
77+ ty. display_test ( & db) . to_string ( )
7878 } ;
7979 assert_eq ! ( expected, actual) ;
8080 checked_one = true ;
Original file line number Diff line number Diff line change @@ -832,7 +832,7 @@ fn issue_4966() {
832832 365..390 'Repeat...nner }': Repeat<Map<|&f64| -> f64>>
833833 383..388 'inner': Map<|&f64| -> f64>
834834 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>>> >
836836 407..424 'from_i...epeat)': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
837837 417..423 'repeat': Repeat<Map<|&f64| -> f64>>
838838 431..434 'vec': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
Original file line number Diff line number Diff line change @@ -907,7 +907,8 @@ fn test<T: Trait>(t: T) { (*t); }
907907}
908908
909909#[ 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].
911912 check_types (
912913 r#"
913914pub trait ApplyL {
@@ -923,13 +924,13 @@ impl<T> ApplyL for RefMutL<T> {
923924fn test<T: ApplyL>() {
924925 let y: <RefMutL<T> as ApplyL>::Out = no_matter;
925926 y;
926- } //^ <T as ApplyL> ::Out
927+ } //^ ApplyL::Out<T>
927928"# ,
928929 ) ;
929930}
930931
931932#[ test]
932- fn associated_type_inlay_hints_2 ( ) {
933+ fn associated_type_placeholder_2 ( ) {
933934 check_types (
934935 r#"
935936pub trait ApplyL {
@@ -940,7 +941,7 @@ fn foo<T: ApplyL>(t: T) -> <T as ApplyL>::Out;
940941fn test<T: ApplyL>(t: T) {
941942 let y = foo(t);
942943 y;
943- } //^ <T as ApplyL> ::Out
944+ } //^ ApplyL::Out<T>
944945"# ,
945946 ) ;
946947}
You can’t perform that action at this time.
0 commit comments