diff options
author | Florian Diebold <[email protected]> | 2020-01-28 20:42:58 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2020-02-07 17:28:10 +0000 |
commit | 4789a993eb26963a2411dcc3041733a3b034634a (patch) | |
tree | 21c59c8c814d34b68b6879d5a8d096ff58656c92 /crates/ra_hir_ty/src | |
parent | 16c69374471a0072541c21a5551b4fd97f7e12ba (diff) |
Fix printing of function types
Diffstat (limited to 'crates/ra_hir_ty/src')
-rw-r--r-- | crates/ra_hir_ty/src/lib.rs | 7 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/tests/coercion.rs | 26 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/tests/method_resolution.rs | 42 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/tests/patterns.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/tests/regression.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/tests/simple.rs | 32 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/tests/traits.rs | 32 |
7 files changed, 73 insertions, 72 deletions
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs index 79084bb3e..1f0fd1128 100644 --- a/crates/ra_hir_ty/src/lib.rs +++ b/crates/ra_hir_ty/src/lib.rs | |||
@@ -912,7 +912,8 @@ impl HirDisplay for ApplicationTy { | |||
912 | write!(f, ") -> {}", sig.ret().display(f.db))?; | 912 | write!(f, ") -> {}", sig.ret().display(f.db))?; |
913 | } | 913 | } |
914 | TypeCtor::FnDef(def) => { | 914 | TypeCtor::FnDef(def) => { |
915 | let sig = f.db.callable_item_signature(def); | 915 | let sig = f.db.callable_item_signature(def) |
916 | .subst(&self.parameters); | ||
916 | let name = match def { | 917 | let name = match def { |
917 | CallableDef::FunctionId(ff) => f.db.function_data(ff).name.clone(), | 918 | CallableDef::FunctionId(ff) => f.db.function_data(ff).name.clone(), |
918 | CallableDef::StructId(s) => f.db.struct_data(s).name.clone(), | 919 | CallableDef::StructId(s) => f.db.struct_data(s).name.clone(), |
@@ -933,8 +934,8 @@ impl HirDisplay for ApplicationTy { | |||
933 | write!(f, ">")?; | 934 | write!(f, ">")?; |
934 | } | 935 | } |
935 | write!(f, "(")?; | 936 | write!(f, "(")?; |
936 | f.write_joined(sig.value.params(), ", ")?; | 937 | f.write_joined(sig.params(), ", ")?; |
937 | write!(f, ") -> {}", sig.value.ret().display(f.db))?; | 938 | write!(f, ") -> {}", sig.ret().display(f.db))?; |
938 | } | 939 | } |
939 | TypeCtor::Adt(def_id) => { | 940 | TypeCtor::Adt(def_id) => { |
940 | let name = match def_id { | 941 | let name = match def_id { |
diff --git a/crates/ra_hir_ty/src/tests/coercion.rs b/crates/ra_hir_ty/src/tests/coercion.rs index 76a1b46c0..fc5ef36a5 100644 --- a/crates/ra_hir_ty/src/tests/coercion.rs +++ b/crates/ra_hir_ty/src/tests/coercion.rs | |||
@@ -75,7 +75,7 @@ fn test2() { | |||
75 | [124; 131) 'loop {}': ! | 75 | [124; 131) 'loop {}': ! |
76 | [129; 131) '{}': () | 76 | [129; 131) '{}': () |
77 | [160; 173) '{ gen() }': *mut [U] | 77 | [160; 173) '{ gen() }': *mut [U] |
78 | [166; 169) 'gen': fn gen<U>() -> *mut [T; _] | 78 | [166; 169) 'gen': fn gen<U>() -> *mut [U; _] |
79 | [166; 171) 'gen()': *mut [U; _] | 79 | [166; 171) 'gen()': *mut [U; _] |
80 | [186; 420) '{ ...rr); }': () | 80 | [186; 420) '{ ...rr); }': () |
81 | [196; 199) 'arr': &[u8; _] | 81 | [196; 199) 'arr': &[u8; _] |
@@ -85,14 +85,14 @@ fn test2() { | |||
85 | [227; 228) 'a': &[u8] | 85 | [227; 228) 'a': &[u8] |
86 | [237; 240) 'arr': &[u8; _] | 86 | [237; 240) 'arr': &[u8; _] |
87 | [250; 251) 'b': u8 | 87 | [250; 251) 'b': u8 |
88 | [254; 255) 'f': fn f<u8>(&[T]) -> T | 88 | [254; 255) 'f': fn f<u8>(&[u8]) -> u8 |
89 | [254; 260) 'f(arr)': u8 | 89 | [254; 260) 'f(arr)': u8 |
90 | [256; 259) 'arr': &[u8; _] | 90 | [256; 259) 'arr': &[u8; _] |
91 | [270; 271) 'c': &[u8] | 91 | [270; 271) 'c': &[u8] |
92 | [280; 287) '{ arr }': &[u8] | 92 | [280; 287) '{ arr }': &[u8] |
93 | [282; 285) 'arr': &[u8; _] | 93 | [282; 285) 'arr': &[u8; _] |
94 | [297; 298) 'd': u8 | 94 | [297; 298) 'd': u8 |
95 | [301; 302) 'g': fn g<u8>(S<&[T]>) -> T | 95 | [301; 302) 'g': fn g<u8>(S<&[u8]>) -> u8 |
96 | [301; 316) 'g(S { a: arr })': u8 | 96 | [301; 316) 'g(S { a: arr })': u8 |
97 | [303; 315) 'S { a: arr }': S<&[u8]> | 97 | [303; 315) 'S { a: arr }': S<&[u8]> |
98 | [310; 313) 'arr': &[u8; _] | 98 | [310; 313) 'arr': &[u8; _] |
@@ -164,15 +164,15 @@ fn test(a: A<[u8; 2]>, b: B<[u8; 2]>, c: C<[u8; 2]>) { | |||
164 | [400; 401) 'c': C<[u8; _]> | 164 | [400; 401) 'c': C<[u8; _]> |
165 | [415; 481) '{ ...(c); }': () | 165 | [415; 481) '{ ...(c); }': () |
166 | [425; 426) 'd': A<[{unknown}]> | 166 | [425; 426) 'd': A<[{unknown}]> |
167 | [429; 433) 'foo1': fn foo1<{unknown}>(A<[T]>) -> A<[T]> | 167 | [429; 433) 'foo1': fn foo1<{unknown}>(A<[{unknown}]>) -> A<[{unknown}]> |
168 | [429; 436) 'foo1(a)': A<[{unknown}]> | 168 | [429; 436) 'foo1(a)': A<[{unknown}]> |
169 | [434; 435) 'a': A<[u8; _]> | 169 | [434; 435) 'a': A<[u8; _]> |
170 | [446; 447) 'e': B<[u8]> | 170 | [446; 447) 'e': B<[u8]> |
171 | [450; 454) 'foo2': fn foo2<u8>(B<[T]>) -> B<[T]> | 171 | [450; 454) 'foo2': fn foo2<u8>(B<[u8]>) -> B<[u8]> |
172 | [450; 457) 'foo2(b)': B<[u8]> | 172 | [450; 457) 'foo2(b)': B<[u8]> |
173 | [455; 456) 'b': B<[u8; _]> | 173 | [455; 456) 'b': B<[u8; _]> |
174 | [467; 468) 'f': C<[u8]> | 174 | [467; 468) 'f': C<[u8]> |
175 | [471; 475) 'foo3': fn foo3<u8>(C<[T]>) -> C<[T]> | 175 | [471; 475) 'foo3': fn foo3<u8>(C<[u8]>) -> C<[u8]> |
176 | [471; 478) 'foo3(c)': C<[u8]> | 176 | [471; 478) 'foo3(c)': C<[u8]> |
177 | [476; 477) 'c': C<[u8; _]> | 177 | [476; 477) 'c': C<[u8; _]> |
178 | "### | 178 | "### |
@@ -202,7 +202,7 @@ fn test() { | |||
202 | [64; 123) 'if tru... }': &[i32] | 202 | [64; 123) 'if tru... }': &[i32] |
203 | [67; 71) 'true': bool | 203 | [67; 71) 'true': bool |
204 | [72; 97) '{ ... }': &[i32] | 204 | [72; 97) '{ ... }': &[i32] |
205 | [82; 85) 'foo': fn foo<i32>(&[T]) -> &[T] | 205 | [82; 85) 'foo': fn foo<i32>(&[i32]) -> &[i32] |
206 | [82; 91) 'foo(&[1])': &[i32] | 206 | [82; 91) 'foo(&[1])': &[i32] |
207 | [86; 90) '&[1]': &[i32; _] | 207 | [86; 90) '&[1]': &[i32; _] |
208 | [87; 90) '[1]': [i32; _] | 208 | [87; 90) '[1]': [i32; _] |
@@ -242,7 +242,7 @@ fn test() { | |||
242 | [83; 86) '[1]': [i32; _] | 242 | [83; 86) '[1]': [i32; _] |
243 | [84; 85) '1': i32 | 243 | [84; 85) '1': i32 |
244 | [98; 123) '{ ... }': &[i32] | 244 | [98; 123) '{ ... }': &[i32] |
245 | [108; 111) 'foo': fn foo<i32>(&[T]) -> &[T] | 245 | [108; 111) 'foo': fn foo<i32>(&[i32]) -> &[i32] |
246 | [108; 117) 'foo(&[1])': &[i32] | 246 | [108; 117) 'foo(&[1])': &[i32] |
247 | [112; 116) '&[1]': &[i32; _] | 247 | [112; 116) '&[1]': &[i32; _] |
248 | [113; 116) '[1]': [i32; _] | 248 | [113; 116) '[1]': [i32; _] |
@@ -275,7 +275,7 @@ fn test(i: i32) { | |||
275 | [70; 147) 'match ... }': &[i32] | 275 | [70; 147) 'match ... }': &[i32] |
276 | [76; 77) 'i': i32 | 276 | [76; 77) 'i': i32 |
277 | [88; 89) '2': i32 | 277 | [88; 89) '2': i32 |
278 | [93; 96) 'foo': fn foo<i32>(&[T]) -> &[T] | 278 | [93; 96) 'foo': fn foo<i32>(&[i32]) -> &[i32] |
279 | [93; 102) 'foo(&[2])': &[i32] | 279 | [93; 102) 'foo(&[2])': &[i32] |
280 | [97; 101) '&[2]': &[i32; _] | 280 | [97; 101) '&[2]': &[i32; _] |
281 | [98; 101) '[2]': [i32; _] | 281 | [98; 101) '[2]': [i32; _] |
@@ -320,7 +320,7 @@ fn test(i: i32) { | |||
320 | [94; 97) '[1]': [i32; _] | 320 | [94; 97) '[1]': [i32; _] |
321 | [95; 96) '1': i32 | 321 | [95; 96) '1': i32 |
322 | [107; 108) '2': i32 | 322 | [107; 108) '2': i32 |
323 | [112; 115) 'foo': fn foo<i32>(&[T]) -> &[T] | 323 | [112; 115) 'foo': fn foo<i32>(&[i32]) -> &[i32] |
324 | [112; 121) 'foo(&[2])': &[i32] | 324 | [112; 121) 'foo(&[2])': &[i32] |
325 | [116; 120) '&[2]': &[i32; _] | 325 | [116; 120) '&[2]': &[i32; _] |
326 | [117; 120) '[2]': [i32; _] | 326 | [117; 120) '[2]': [i32; _] |
@@ -438,16 +438,16 @@ fn test() { | |||
438 | [43; 45) '*x': T | 438 | [43; 45) '*x': T |
439 | [44; 45) 'x': &T | 439 | [44; 45) 'x': &T |
440 | [58; 127) '{ ...oo); }': () | 440 | [58; 127) '{ ...oo); }': () |
441 | [64; 73) 'takes_ref': fn takes_ref<Foo>(&T) -> T | 441 | [64; 73) 'takes_ref': fn takes_ref<Foo>(&Foo) -> Foo |
442 | [64; 79) 'takes_ref(&Foo)': Foo | 442 | [64; 79) 'takes_ref(&Foo)': Foo |
443 | [74; 78) '&Foo': &Foo | 443 | [74; 78) '&Foo': &Foo |
444 | [75; 78) 'Foo': Foo | 444 | [75; 78) 'Foo': Foo |
445 | [85; 94) 'takes_ref': fn takes_ref<&Foo>(&T) -> T | 445 | [85; 94) 'takes_ref': fn takes_ref<&Foo>(&&Foo) -> &Foo |
446 | [85; 101) 'takes_...&&Foo)': &Foo | 446 | [85; 101) 'takes_...&&Foo)': &Foo |
447 | [95; 100) '&&Foo': &&Foo | 447 | [95; 100) '&&Foo': &&Foo |
448 | [96; 100) '&Foo': &Foo | 448 | [96; 100) '&Foo': &Foo |
449 | [97; 100) 'Foo': Foo | 449 | [97; 100) 'Foo': Foo |
450 | [107; 116) 'takes_ref': fn takes_ref<&&Foo>(&T) -> T | 450 | [107; 116) 'takes_ref': fn takes_ref<&&Foo>(&&&Foo) -> &&Foo |
451 | [107; 124) 'takes_...&&Foo)': &&Foo | 451 | [107; 124) 'takes_...&&Foo)': &&Foo |
452 | [117; 123) '&&&Foo': &&&Foo | 452 | [117; 123) '&&&Foo': &&&Foo |
453 | [118; 123) '&&Foo': &&Foo | 453 | [118; 123) '&&Foo': &&Foo |
diff --git a/crates/ra_hir_ty/src/tests/method_resolution.rs b/crates/ra_hir_ty/src/tests/method_resolution.rs index ce9a06fde..6c7f6706a 100644 --- a/crates/ra_hir_ty/src/tests/method_resolution.rs +++ b/crates/ra_hir_ty/src/tests/method_resolution.rs | |||
@@ -27,7 +27,7 @@ fn test() { | |||
27 | [66; 73) 'loop {}': ! | 27 | [66; 73) 'loop {}': ! |
28 | [71; 73) '{}': () | 28 | [71; 73) '{}': () |
29 | [133; 160) '{ ...o"); }': () | 29 | [133; 160) '{ ...o"); }': () |
30 | [139; 149) '<[_]>::foo': fn foo<u8>(&[T]) -> T | 30 | [139; 149) '<[_]>::foo': fn foo<u8>(&[u8]) -> u8 |
31 | [139; 157) '<[_]>:..."foo")': u8 | 31 | [139; 157) '<[_]>:..."foo")': u8 |
32 | [150; 156) 'b"foo"': &[u8] | 32 | [150; 156) 'b"foo"': &[u8] |
33 | "### | 33 | "### |
@@ -175,7 +175,7 @@ fn test() { | |||
175 | [98; 101) 'val': T | 175 | [98; 101) 'val': T |
176 | [123; 155) '{ ...32); }': () | 176 | [123; 155) '{ ...32); }': () |
177 | [133; 134) 'a': Gen<u32> | 177 | [133; 134) 'a': Gen<u32> |
178 | [137; 146) 'Gen::make': fn make<u32>(T) -> Gen<T> | 178 | [137; 146) 'Gen::make': fn make<u32>(u32) -> Gen<u32> |
179 | [137; 152) 'Gen::make(0u32)': Gen<u32> | 179 | [137; 152) 'Gen::make(0u32)': Gen<u32> |
180 | [147; 151) '0u32': u32 | 180 | [147; 151) '0u32': u32 |
181 | "### | 181 | "### |
@@ -206,7 +206,7 @@ fn test() { | |||
206 | [95; 98) '{ }': () | 206 | [95; 98) '{ }': () |
207 | [118; 146) '{ ...e(); }': () | 207 | [118; 146) '{ ...e(); }': () |
208 | [128; 129) 'a': Gen<u32> | 208 | [128; 129) 'a': Gen<u32> |
209 | [132; 141) 'Gen::make': fn make<u32>() -> Gen<T> | 209 | [132; 141) 'Gen::make': fn make<u32>() -> Gen<u32> |
210 | [132; 143) 'Gen::make()': Gen<u32> | 210 | [132; 143) 'Gen::make()': Gen<u32> |
211 | "### | 211 | "### |
212 | ); | 212 | ); |
@@ -260,7 +260,7 @@ fn test() { | |||
260 | [91; 94) '{ }': () | 260 | [91; 94) '{ }': () |
261 | [114; 149) '{ ...e(); }': () | 261 | [114; 149) '{ ...e(); }': () |
262 | [124; 125) 'a': Gen<u32> | 262 | [124; 125) 'a': Gen<u32> |
263 | [128; 144) 'Gen::<...::make': fn make<u32>() -> Gen<T> | 263 | [128; 144) 'Gen::<...::make': fn make<u32>() -> Gen<u32> |
264 | [128; 146) 'Gen::<...make()': Gen<u32> | 264 | [128; 146) 'Gen::<...make()': Gen<u32> |
265 | "### | 265 | "### |
266 | ); | 266 | ); |
@@ -291,7 +291,7 @@ fn test() { | |||
291 | [117; 120) '{ }': () | 291 | [117; 120) '{ }': () |
292 | [140; 180) '{ ...e(); }': () | 292 | [140; 180) '{ ...e(); }': () |
293 | [150; 151) 'a': Gen<u32, u64> | 293 | [150; 151) 'a': Gen<u32, u64> |
294 | [154; 175) 'Gen::<...::make': fn make<u64>() -> Gen<u32, T> | 294 | [154; 175) 'Gen::<...::make': fn make<u64>() -> Gen<u32, u64> |
295 | [154; 177) 'Gen::<...make()': Gen<u32, u64> | 295 | [154; 177) 'Gen::<...make()': Gen<u32, u64> |
296 | "### | 296 | "### |
297 | ); | 297 | ); |
@@ -475,7 +475,7 @@ fn test() { | |||
475 | @r###" | 475 | @r###" |
476 | [33; 37) 'self': &Self | 476 | [33; 37) 'self': &Self |
477 | [102; 127) '{ ...d(); }': () | 477 | [102; 127) '{ ...d(); }': () |
478 | [108; 109) 'S': S<u32>(T) -> S<T> | 478 | [108; 109) 'S': S<u32>(u32) -> S<u32> |
479 | [108; 115) 'S(1u32)': S<u32> | 479 | [108; 115) 'S(1u32)': S<u32> |
480 | [108; 124) 'S(1u32...thod()': u32 | 480 | [108; 124) 'S(1u32...thod()': u32 |
481 | [110; 114) '1u32': u32 | 481 | [110; 114) '1u32': u32 |
@@ -501,13 +501,13 @@ fn test() { | |||
501 | @r###" | 501 | @r###" |
502 | [87; 193) '{ ...t(); }': () | 502 | [87; 193) '{ ...t(); }': () |
503 | [97; 99) 's1': S | 503 | [97; 99) 's1': S |
504 | [105; 121) 'Defaul...efault': fn default<S>() -> Self | 504 | [105; 121) 'Defaul...efault': fn default<S>() -> S |
505 | [105; 123) 'Defaul...ault()': S | 505 | [105; 123) 'Defaul...ault()': S |
506 | [133; 135) 's2': S | 506 | [133; 135) 's2': S |
507 | [138; 148) 'S::default': fn default<S>() -> Self | 507 | [138; 148) 'S::default': fn default<S>() -> S |
508 | [138; 150) 'S::default()': S | 508 | [138; 150) 'S::default()': S |
509 | [160; 162) 's3': S | 509 | [160; 162) 's3': S |
510 | [165; 188) '<S as ...efault': fn default<S>() -> Self | 510 | [165; 188) '<S as ...efault': fn default<S>() -> S |
511 | [165; 190) '<S as ...ault()': S | 511 | [165; 190) '<S as ...ault()': S |
512 | "### | 512 | "### |
513 | ); | 513 | ); |
@@ -533,13 +533,13 @@ fn test() { | |||
533 | @r###" | 533 | @r###" |
534 | [127; 211) '{ ...e(); }': () | 534 | [127; 211) '{ ...e(); }': () |
535 | [137; 138) 'a': u32 | 535 | [137; 138) 'a': u32 |
536 | [141; 148) 'S::make': fn make<S, u32>() -> T | 536 | [141; 148) 'S::make': fn make<S, u32>() -> u32 |
537 | [141; 150) 'S::make()': u32 | 537 | [141; 150) 'S::make()': u32 |
538 | [160; 161) 'b': u64 | 538 | [160; 161) 'b': u64 |
539 | [164; 178) 'G::<u64>::make': fn make<G<u64>, u64>() -> T | 539 | [164; 178) 'G::<u64>::make': fn make<G<u64>, u64>() -> u64 |
540 | [164; 180) 'G::<u6...make()': u64 | 540 | [164; 180) 'G::<u6...make()': u64 |
541 | [190; 191) 'c': f64 | 541 | [190; 191) 'c': f64 |
542 | [199; 206) 'G::make': fn make<G<f64>, f64>() -> T | 542 | [199; 206) 'G::make': fn make<G<f64>, f64>() -> f64 |
543 | [199; 208) 'G::make()': f64 | 543 | [199; 208) 'G::make()': f64 |
544 | "### | 544 | "### |
545 | ); | 545 | ); |
@@ -567,19 +567,19 @@ fn test() { | |||
567 | @r###" | 567 | @r###" |
568 | [135; 313) '{ ...e(); }': () | 568 | [135; 313) '{ ...e(); }': () |
569 | [145; 146) 'a': (u32, i64) | 569 | [145; 146) 'a': (u32, i64) |
570 | [149; 163) 'S::make::<i64>': fn make<S, u32, i64>() -> (T, U) | 570 | [149; 163) 'S::make::<i64>': fn make<S, u32, i64>() -> (u32, i64) |
571 | [149; 165) 'S::mak...i64>()': (u32, i64) | 571 | [149; 165) 'S::mak...i64>()': (u32, i64) |
572 | [175; 176) 'b': (u32, i64) | 572 | [175; 176) 'b': (u32, i64) |
573 | [189; 196) 'S::make': fn make<S, u32, i64>() -> (T, U) | 573 | [189; 196) 'S::make': fn make<S, u32, i64>() -> (u32, i64) |
574 | [189; 198) 'S::make()': (u32, i64) | 574 | [189; 198) 'S::make()': (u32, i64) |
575 | [208; 209) 'c': (u32, i64) | 575 | [208; 209) 'c': (u32, i64) |
576 | [212; 233) 'G::<u3...:<i64>': fn make<G<u32>, u32, i64>() -> (T, U) | 576 | [212; 233) 'G::<u3...:<i64>': fn make<G<u32>, u32, i64>() -> (u32, i64) |
577 | [212; 235) 'G::<u3...i64>()': (u32, i64) | 577 | [212; 235) 'G::<u3...i64>()': (u32, i64) |
578 | [245; 246) 'd': (u32, i64) | 578 | [245; 246) 'd': (u32, i64) |
579 | [259; 273) 'G::make::<i64>': fn make<G<u32>, u32, i64>() -> (T, U) | 579 | [259; 273) 'G::make::<i64>': fn make<G<u32>, u32, i64>() -> (u32, i64) |
580 | [259; 275) 'G::mak...i64>()': (u32, i64) | 580 | [259; 275) 'G::mak...i64>()': (u32, i64) |
581 | [285; 286) 'e': (u32, i64) | 581 | [285; 286) 'e': (u32, i64) |
582 | [301; 308) 'G::make': fn make<G<u32>, u32, i64>() -> (T, U) | 582 | [301; 308) 'G::make': fn make<G<u32>, u32, i64>() -> (u32, i64) |
583 | [301; 310) 'G::make()': (u32, i64) | 583 | [301; 310) 'G::make()': (u32, i64) |
584 | "### | 584 | "### |
585 | ); | 585 | ); |
@@ -601,7 +601,7 @@ fn test() { | |||
601 | @r###" | 601 | @r###" |
602 | [101; 127) '{ ...e(); }': () | 602 | [101; 127) '{ ...e(); }': () |
603 | [111; 112) 'a': (S<i32>, i64) | 603 | [111; 112) 'a': (S<i32>, i64) |
604 | [115; 122) 'S::make': fn make<S<i32>, i64>() -> (Self, T) | 604 | [115; 122) 'S::make': fn make<S<i32>, i64>() -> (S<i32>, i64) |
605 | [115; 124) 'S::make()': (S<i32>, i64) | 605 | [115; 124) 'S::make()': (S<i32>, i64) |
606 | "### | 606 | "### |
607 | ); | 607 | ); |
@@ -625,10 +625,10 @@ fn test() { | |||
625 | @r###" | 625 | @r###" |
626 | [131; 203) '{ ...e(); }': () | 626 | [131; 203) '{ ...e(); }': () |
627 | [141; 142) 'a': (S<u64>, i64) | 627 | [141; 142) 'a': (S<u64>, i64) |
628 | [158; 165) 'S::make': fn make<S<u64>, i64>() -> (Self, T) | 628 | [158; 165) 'S::make': fn make<S<u64>, i64>() -> (S<u64>, i64) |
629 | [158; 167) 'S::make()': (S<u64>, i64) | 629 | [158; 167) 'S::make()': (S<u64>, i64) |
630 | [177; 178) 'b': (S<u32>, i32) | 630 | [177; 178) 'b': (S<u32>, i32) |
631 | [191; 198) 'S::make': fn make<S<u32>, i32>() -> (Self, T) | 631 | [191; 198) 'S::make': fn make<S<u32>, i32>() -> (S<u32>, i32) |
632 | [191; 200) 'S::make()': (S<u32>, i32) | 632 | [191; 200) 'S::make()': (S<u32>, i32) |
633 | "### | 633 | "### |
634 | ); | 634 | ); |
@@ -728,7 +728,7 @@ fn test() { | |||
728 | [157; 158) 'S': S | 728 | [157; 158) 'S': S |
729 | [157; 165) 'S.into()': u64 | 729 | [157; 165) 'S.into()': u64 |
730 | [175; 176) 'z': u64 | 730 | [175; 176) 'z': u64 |
731 | [179; 196) 'Into::...::into': fn into<S, u64>(Self) -> T | 731 | [179; 196) 'Into::...::into': fn into<S, u64>(S) -> u64 |
732 | [179; 199) 'Into::...nto(S)': u64 | 732 | [179; 199) 'Into::...nto(S)': u64 |
733 | [197; 198) 'S': S | 733 | [197; 198) 'S': S |
734 | "### | 734 | "### |
diff --git a/crates/ra_hir_ty/src/tests/patterns.rs b/crates/ra_hir_ty/src/tests/patterns.rs index cb3890b42..e25d6dbc4 100644 --- a/crates/ra_hir_ty/src/tests/patterns.rs +++ b/crates/ra_hir_ty/src/tests/patterns.rs | |||
@@ -96,13 +96,13 @@ fn test() { | |||
96 | [38; 42) 'A(n)': A<i32> | 96 | [38; 42) 'A(n)': A<i32> |
97 | [40; 41) 'n': &i32 | 97 | [40; 41) 'n': &i32 |
98 | [45; 50) '&A(1)': &A<i32> | 98 | [45; 50) '&A(1)': &A<i32> |
99 | [46; 47) 'A': A<i32>(T) -> A<T> | 99 | [46; 47) 'A': A<i32>(i32) -> A<i32> |
100 | [46; 50) 'A(1)': A<i32> | 100 | [46; 50) 'A(1)': A<i32> |
101 | [48; 49) '1': i32 | 101 | [48; 49) '1': i32 |
102 | [60; 64) 'A(n)': A<i32> | 102 | [60; 64) 'A(n)': A<i32> |
103 | [62; 63) 'n': &mut i32 | 103 | [62; 63) 'n': &mut i32 |
104 | [67; 76) '&mut A(1)': &mut A<i32> | 104 | [67; 76) '&mut A(1)': &mut A<i32> |
105 | [72; 73) 'A': A<i32>(T) -> A<T> | 105 | [72; 73) 'A': A<i32>(i32) -> A<i32> |
106 | [72; 76) 'A(1)': A<i32> | 106 | [72; 76) 'A(1)': A<i32> |
107 | [74; 75) '1': i32 | 107 | [74; 75) '1': i32 |
108 | "### | 108 | "### |
diff --git a/crates/ra_hir_ty/src/tests/regression.rs b/crates/ra_hir_ty/src/tests/regression.rs index 02bab6dbe..14c8ed3a9 100644 --- a/crates/ra_hir_ty/src/tests/regression.rs +++ b/crates/ra_hir_ty/src/tests/regression.rs | |||
@@ -346,7 +346,7 @@ pub fn main_loop() { | |||
346 | @r###" | 346 | @r###" |
347 | [144; 146) '{}': () | 347 | [144; 146) '{}': () |
348 | [169; 198) '{ ...t(); }': () | 348 | [169; 198) '{ ...t(); }': () |
349 | [175; 193) 'FxHash...efault': fn default<{unknown}, FxHasher>() -> HashSet<T, H> | 349 | [175; 193) 'FxHash...efault': fn default<{unknown}, FxHasher>() -> HashSet<{unknown}, FxHasher> |
350 | [175; 195) 'FxHash...ault()': HashSet<{unknown}, FxHasher> | 350 | [175; 195) 'FxHash...ault()': HashSet<{unknown}, FxHasher> |
351 | "### | 351 | "### |
352 | ); | 352 | ); |
diff --git a/crates/ra_hir_ty/src/tests/simple.rs b/crates/ra_hir_ty/src/tests/simple.rs index f1238506b..b08355227 100644 --- a/crates/ra_hir_ty/src/tests/simple.rs +++ b/crates/ra_hir_ty/src/tests/simple.rs | |||
@@ -754,15 +754,15 @@ fn test() { | |||
754 | [289; 295) 'self.0': T | 754 | [289; 295) 'self.0': T |
755 | [315; 353) '{ ...))); }': () | 755 | [315; 353) '{ ...))); }': () |
756 | [325; 326) 't': &i32 | 756 | [325; 326) 't': &i32 |
757 | [329; 335) 'A::foo': fn foo<i32>(&A<T>) -> &T | 757 | [329; 335) 'A::foo': fn foo<i32>(&A<i32>) -> &i32 |
758 | [329; 350) 'A::foo...42))))': &i32 | 758 | [329; 350) 'A::foo...42))))': &i32 |
759 | [336; 349) '&&B(B(A(42)))': &&B<B<A<i32>>> | 759 | [336; 349) '&&B(B(A(42)))': &&B<B<A<i32>>> |
760 | [337; 349) '&B(B(A(42)))': &B<B<A<i32>>> | 760 | [337; 349) '&B(B(A(42)))': &B<B<A<i32>>> |
761 | [338; 339) 'B': B<B<A<i32>>>(T) -> B<T> | 761 | [338; 339) 'B': B<B<A<i32>>>(B<A<i32>>) -> B<B<A<i32>>> |
762 | [338; 349) 'B(B(A(42)))': B<B<A<i32>>> | 762 | [338; 349) 'B(B(A(42)))': B<B<A<i32>>> |
763 | [340; 341) 'B': B<A<i32>>(T) -> B<T> | 763 | [340; 341) 'B': B<A<i32>>(A<i32>) -> B<A<i32>> |
764 | [340; 348) 'B(A(42))': B<A<i32>> | 764 | [340; 348) 'B(A(42))': B<A<i32>> |
765 | [342; 343) 'A': A<i32>(T) -> A<T> | 765 | [342; 343) 'A': A<i32>(i32) -> A<i32> |
766 | [342; 347) 'A(42)': A<i32> | 766 | [342; 347) 'A(42)': A<i32> |
767 | [344; 346) '42': i32 | 767 | [344; 346) '42': i32 |
768 | "### | 768 | "### |
@@ -817,16 +817,16 @@ fn test(a: A<i32>) { | |||
817 | [326; 327) 'a': A<i32> | 817 | [326; 327) 'a': A<i32> |
818 | [337; 383) '{ ...))); }': () | 818 | [337; 383) '{ ...))); }': () |
819 | [347; 348) 't': &i32 | 819 | [347; 348) 't': &i32 |
820 | [351; 352) 'A': A<i32>(*mut T) -> A<T> | 820 | [351; 352) 'A': A<i32>(*mut i32) -> A<i32> |
821 | [351; 365) 'A(0 as *mut _)': A<i32> | 821 | [351; 365) 'A(0 as *mut _)': A<i32> |
822 | [351; 380) 'A(0 as...B(a)))': &i32 | 822 | [351; 380) 'A(0 as...B(a)))': &i32 |
823 | [353; 354) '0': i32 | 823 | [353; 354) '0': i32 |
824 | [353; 364) '0 as *mut _': *mut i32 | 824 | [353; 364) '0 as *mut _': *mut i32 |
825 | [370; 379) '&&B(B(a))': &&B<B<A<i32>>> | 825 | [370; 379) '&&B(B(a))': &&B<B<A<i32>>> |
826 | [371; 379) '&B(B(a))': &B<B<A<i32>>> | 826 | [371; 379) '&B(B(a))': &B<B<A<i32>>> |
827 | [372; 373) 'B': B<B<A<i32>>>(T) -> B<T> | 827 | [372; 373) 'B': B<B<A<i32>>>(B<A<i32>>) -> B<B<A<i32>>> |
828 | [372; 379) 'B(B(a))': B<B<A<i32>>> | 828 | [372; 379) 'B(B(a))': B<B<A<i32>>> |
829 | [374; 375) 'B': B<A<i32>>(T) -> B<T> | 829 | [374; 375) 'B': B<A<i32>>(A<i32>) -> B<A<i32>> |
830 | [374; 378) 'B(a)': B<A<i32>> | 830 | [374; 378) 'B(a)': B<A<i32>> |
831 | [376; 377) 'a': A<i32> | 831 | [376; 377) 'a': A<i32> |
832 | "### | 832 | "### |
@@ -1205,14 +1205,14 @@ fn test() { | |||
1205 | [21; 26) '{ t }': T | 1205 | [21; 26) '{ t }': T |
1206 | [23; 24) 't': T | 1206 | [23; 24) 't': T |
1207 | [38; 98) '{ ...(1); }': () | 1207 | [38; 98) '{ ...(1); }': () |
1208 | [44; 46) 'id': fn id<u32>(T) -> T | 1208 | [44; 46) 'id': fn id<u32>(u32) -> u32 |
1209 | [44; 52) 'id(1u32)': u32 | 1209 | [44; 52) 'id(1u32)': u32 |
1210 | [47; 51) '1u32': u32 | 1210 | [47; 51) '1u32': u32 |
1211 | [58; 68) 'id::<i128>': fn id<i128>(T) -> T | 1211 | [58; 68) 'id::<i128>': fn id<i128>(i128) -> i128 |
1212 | [58; 71) 'id::<i128>(1)': i128 | 1212 | [58; 71) 'id::<i128>(1)': i128 |
1213 | [69; 70) '1': i128 | 1213 | [69; 70) '1': i128 |
1214 | [81; 82) 'x': u64 | 1214 | [81; 82) 'x': u64 |
1215 | [90; 92) 'id': fn id<u64>(T) -> T | 1215 | [90; 92) 'id': fn id<u64>(u64) -> u64 |
1216 | [90; 95) 'id(1)': u64 | 1216 | [90; 95) 'id(1)': u64 |
1217 | [93; 94) '1': u64 | 1217 | [93; 94) '1': u64 |
1218 | "### | 1218 | "### |
@@ -1349,16 +1349,16 @@ fn test() -> i128 { | |||
1349 | [146; 147) 'x': i128 | 1349 | [146; 147) 'x': i128 |
1350 | [150; 151) '1': i128 | 1350 | [150; 151) '1': i128 |
1351 | [162; 163) 'y': i128 | 1351 | [162; 163) 'y': i128 |
1352 | [166; 168) 'id': fn id<i128>(T) -> T | 1352 | [166; 168) 'id': fn id<i128>(i128) -> i128 |
1353 | [166; 171) 'id(x)': i128 | 1353 | [166; 171) 'id(x)': i128 |
1354 | [169; 170) 'x': i128 | 1354 | [169; 170) 'x': i128 |
1355 | [182; 183) 'a': A<i128> | 1355 | [182; 183) 'a': A<i128> |
1356 | [186; 200) 'A { x: id(y) }': A<i128> | 1356 | [186; 200) 'A { x: id(y) }': A<i128> |
1357 | [193; 195) 'id': fn id<i128>(T) -> T | 1357 | [193; 195) 'id': fn id<i128>(i128) -> i128 |
1358 | [193; 198) 'id(y)': i128 | 1358 | [193; 198) 'id(y)': i128 |
1359 | [196; 197) 'y': i128 | 1359 | [196; 197) 'y': i128 |
1360 | [211; 212) 'z': i128 | 1360 | [211; 212) 'z': i128 |
1361 | [215; 217) 'id': fn id<i128>(T) -> T | 1361 | [215; 217) 'id': fn id<i128>(i128) -> i128 |
1362 | [215; 222) 'id(a.x)': i128 | 1362 | [215; 222) 'id(a.x)': i128 |
1363 | [218; 219) 'a': A<i128> | 1363 | [218; 219) 'a': A<i128> |
1364 | [218; 221) 'a.x': i128 | 1364 | [218; 221) 'a.x': i128 |
@@ -1502,14 +1502,14 @@ fn test() { | |||
1502 | [78; 158) '{ ...(1); }': () | 1502 | [78; 158) '{ ...(1); }': () |
1503 | [88; 89) 'y': u32 | 1503 | [88; 89) 'y': u32 |
1504 | [92; 97) '10u32': u32 | 1504 | [92; 97) '10u32': u32 |
1505 | [103; 105) 'id': fn id<u32>(T) -> T | 1505 | [103; 105) 'id': fn id<u32>(u32) -> u32 |
1506 | [103; 108) 'id(y)': u32 | 1506 | [103; 108) 'id(y)': u32 |
1507 | [106; 107) 'y': u32 | 1507 | [106; 107) 'y': u32 |
1508 | [118; 119) 'x': bool | 1508 | [118; 119) 'x': bool |
1509 | [128; 133) 'clone': fn clone<bool>(&T) -> T | 1509 | [128; 133) 'clone': fn clone<bool>(&bool) -> bool |
1510 | [128; 136) 'clone(z)': bool | 1510 | [128; 136) 'clone(z)': bool |
1511 | [134; 135) 'z': &bool | 1511 | [134; 135) 'z': &bool |
1512 | [142; 152) 'id::<i128>': fn id<i128>(T) -> T | 1512 | [142; 152) 'id::<i128>': fn id<i128>(i128) -> i128 |
1513 | [142; 155) 'id::<i128>(1)': i128 | 1513 | [142; 155) 'id::<i128>(1)': i128 |
1514 | [153; 154) '1': i128 | 1514 | [153; 154) '1': i128 |
1515 | "### | 1515 | "### |
diff --git a/crates/ra_hir_ty/src/tests/traits.rs b/crates/ra_hir_ty/src/tests/traits.rs index 764ab2800..eae6e9681 100644 --- a/crates/ra_hir_ty/src/tests/traits.rs +++ b/crates/ra_hir_ty/src/tests/traits.rs | |||
@@ -261,10 +261,10 @@ fn test() { | |||
261 | [92; 94) '{}': () | 261 | [92; 94) '{}': () |
262 | [105; 144) '{ ...(s); }': () | 262 | [105; 144) '{ ...(s); }': () |
263 | [115; 116) 's': S<u32> | 263 | [115; 116) 's': S<u32> |
264 | [119; 120) 'S': S<u32>(T) -> S<T> | 264 | [119; 120) 'S': S<u32>(u32) -> S<u32> |
265 | [119; 129) 'S(unknown)': S<u32> | 265 | [119; 129) 'S(unknown)': S<u32> |
266 | [121; 128) 'unknown': u32 | 266 | [121; 128) 'unknown': u32 |
267 | [135; 138) 'foo': fn foo<S<u32>>(T) -> () | 267 | [135; 138) 'foo': fn foo<S<u32>>(S<u32>) -> () |
268 | [135; 141) 'foo(s)': () | 268 | [135; 141) 'foo(s)': () |
269 | [139; 140) 's': S<u32> | 269 | [139; 140) 's': S<u32> |
270 | "### | 270 | "### |
@@ -289,11 +289,11 @@ fn test() { | |||
289 | [98; 100) '{}': () | 289 | [98; 100) '{}': () |
290 | [111; 163) '{ ...(s); }': () | 290 | [111; 163) '{ ...(s); }': () |
291 | [121; 122) 's': S<u32> | 291 | [121; 122) 's': S<u32> |
292 | [125; 126) 'S': S<u32>(T) -> S<T> | 292 | [125; 126) 'S': S<u32>(u32) -> S<u32> |
293 | [125; 135) 'S(unknown)': S<u32> | 293 | [125; 135) 'S(unknown)': S<u32> |
294 | [127; 134) 'unknown': u32 | 294 | [127; 134) 'unknown': u32 |
295 | [145; 146) 'x': u32 | 295 | [145; 146) 'x': u32 |
296 | [154; 157) 'foo': fn foo<u32, S<u32>>(T) -> U | 296 | [154; 157) 'foo': fn foo<u32, S<u32>>(S<u32>) -> u32 |
297 | [154; 160) 'foo(s)': u32 | 297 | [154; 160) 'foo(s)': u32 |
298 | [158; 159) 's': S<u32> | 298 | [158; 159) 's': S<u32> |
299 | "### | 299 | "### |
@@ -1066,26 +1066,26 @@ fn test<T: Trait<Type = u32>>(x: T, y: impl Trait<Type = i64>) { | |||
1066 | [296; 299) 'get': fn get<T>(T) -> <T as Trait>::Type | 1066 | [296; 299) 'get': fn get<T>(T) -> <T as Trait>::Type |
1067 | [296; 302) 'get(x)': {unknown} | 1067 | [296; 302) 'get(x)': {unknown} |
1068 | [300; 301) 'x': T | 1068 | [300; 301) 'x': T |
1069 | [308; 312) 'get2': fn get2<{unknown}, T>(T) -> U | 1069 | [308; 312) 'get2': fn get2<{unknown}, T>(T) -> {unknown} |
1070 | [308; 315) 'get2(x)': {unknown} | 1070 | [308; 315) 'get2(x)': {unknown} |
1071 | [313; 314) 'x': T | 1071 | [313; 314) 'x': T |
1072 | [321; 324) 'get': fn get<impl Trait<Type = i64>>(T) -> <T as Trait>::Type | 1072 | [321; 324) 'get': fn get<impl Trait<Type = i64>>(impl Trait<Type = i64>) -> <impl Trait<Type = i64> as Trait>::Type |
1073 | [321; 327) 'get(y)': {unknown} | 1073 | [321; 327) 'get(y)': {unknown} |
1074 | [325; 326) 'y': impl Trait<Type = i64> | 1074 | [325; 326) 'y': impl Trait<Type = i64> |
1075 | [333; 337) 'get2': fn get2<{unknown}, impl Trait<Type = i64>>(T) -> U | 1075 | [333; 337) 'get2': fn get2<{unknown}, impl Trait<Type = i64>>(impl Trait<Type = i64>) -> {unknown} |
1076 | [333; 340) 'get2(y)': {unknown} | 1076 | [333; 340) 'get2(y)': {unknown} |
1077 | [338; 339) 'y': impl Trait<Type = i64> | 1077 | [338; 339) 'y': impl Trait<Type = i64> |
1078 | [346; 349) 'get': fn get<S<u64>>(T) -> <T as Trait>::Type | 1078 | [346; 349) 'get': fn get<S<u64>>(S<u64>) -> <S<u64> as Trait>::Type |
1079 | [346; 357) 'get(set(S))': u64 | 1079 | [346; 357) 'get(set(S))': u64 |
1080 | [350; 353) 'set': fn set<S<u64>>(T) -> T | 1080 | [350; 353) 'set': fn set<S<u64>>(S<u64>) -> S<u64> |
1081 | [350; 356) 'set(S)': S<u64> | 1081 | [350; 356) 'set(S)': S<u64> |
1082 | [354; 355) 'S': S<u64> | 1082 | [354; 355) 'S': S<u64> |
1083 | [363; 367) 'get2': fn get2<u64, S<u64>>(T) -> U | 1083 | [363; 367) 'get2': fn get2<u64, S<u64>>(S<u64>) -> u64 |
1084 | [363; 375) 'get2(set(S))': u64 | 1084 | [363; 375) 'get2(set(S))': u64 |
1085 | [368; 371) 'set': fn set<S<u64>>(T) -> T | 1085 | [368; 371) 'set': fn set<S<u64>>(S<u64>) -> S<u64> |
1086 | [368; 374) 'set(S)': S<u64> | 1086 | [368; 374) 'set(S)': S<u64> |
1087 | [372; 373) 'S': S<u64> | 1087 | [372; 373) 'S': S<u64> |
1088 | [381; 385) 'get2': fn get2<str, S<str>>(T) -> U | 1088 | [381; 385) 'get2': fn get2<str, S<str>>(S<str>) -> str |
1089 | [381; 395) 'get2(S::<str>)': str | 1089 | [381; 395) 'get2(S::<str>)': str |
1090 | [386; 394) 'S::<str>': S<str> | 1090 | [386; 394) 'S::<str>': S<str> |
1091 | "### | 1091 | "### |
@@ -1258,9 +1258,9 @@ fn test() { | |||
1258 | [157; 160) '{t}': T | 1258 | [157; 160) '{t}': T |
1259 | [158; 159) 't': T | 1259 | [158; 159) 't': T |
1260 | [259; 280) '{ ...S)); }': () | 1260 | [259; 280) '{ ...S)); }': () |
1261 | [265; 269) 'get2': fn get2<u64, S<u64>>(T) -> U | 1261 | [265; 269) 'get2': fn get2<u64, S<u64>>(S<u64>) -> u64 |
1262 | [265; 277) 'get2(set(S))': u64 | 1262 | [265; 277) 'get2(set(S))': u64 |
1263 | [270; 273) 'set': fn set<S<u64>>(T) -> T | 1263 | [270; 273) 'set': fn set<S<u64>>(S<u64>) -> S<u64> |
1264 | [270; 276) 'set(S)': S<u64> | 1264 | [270; 276) 'set(S)': S<u64> |
1265 | [274; 275) 'S': S<u64> | 1265 | [274; 275) 'S': S<u64> |
1266 | "### | 1266 | "### |
@@ -1432,7 +1432,7 @@ fn test() { | |||
1432 | [340; 342) '{}': () | 1432 | [340; 342) '{}': () |
1433 | [356; 515) '{ ... S); }': () | 1433 | [356; 515) '{ ... S); }': () |
1434 | [366; 368) 'x1': u64 | 1434 | [366; 368) 'x1': u64 |
1435 | [371; 375) 'foo1': fn foo1<S, u64, |S| -> u64>(T, F) -> U | 1435 | [371; 375) 'foo1': fn foo1<S, u64, |S| -> u64>(S, |S| -> u64) -> u64 |
1436 | [371; 394) 'foo1(S...hod())': u64 | 1436 | [371; 394) 'foo1(S...hod())': u64 |
1437 | [376; 377) 'S': S | 1437 | [376; 377) 'S': S |
1438 | [379; 393) '|s| s.method()': |S| -> u64 | 1438 | [379; 393) '|s| s.method()': |S| -> u64 |
@@ -1440,7 +1440,7 @@ fn test() { | |||
1440 | [383; 384) 's': S | 1440 | [383; 384) 's': S |
1441 | [383; 393) 's.method()': u64 | 1441 | [383; 393) 's.method()': u64 |
1442 | [404; 406) 'x2': u64 | 1442 | [404; 406) 'x2': u64 |
1443 | [409; 413) 'foo2': fn foo2<S, u64, |S| -> u64>(F, T) -> U | 1443 | [409; 413) 'foo2': fn foo2<S, u64, |S| -> u64>(|S| -> u64, S) -> u64 |
1444 | [409; 432) 'foo2(|...(), S)': u64 | 1444 | [409; 432) 'foo2(|...(), S)': u64 |
1445 | [414; 428) '|s| s.method()': |S| -> u64 | 1445 | [414; 428) '|s| s.method()': |S| -> u64 |
1446 | [415; 416) 's': S | 1446 | [415; 416) 's': S |