diff options
37 files changed, 3537 insertions, 3708 deletions
diff --git a/Cargo.lock b/Cargo.lock index f2069c55e..9ea1765cb 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -1664,7 +1664,6 @@ name = "test_utils" | |||
1664 | version = "0.1.0" | 1664 | version = "0.1.0" |
1665 | dependencies = [ | 1665 | dependencies = [ |
1666 | "difference", | 1666 | "difference", |
1667 | "ra_cfg", | ||
1668 | "rustc-hash", | 1667 | "rustc-hash", |
1669 | "serde_json", | 1668 | "serde_json", |
1670 | "stdx", | 1669 | "stdx", |
diff --git a/crates/ra_assists/src/handlers/auto_import.rs b/crates/ra_assists/src/handlers/auto_import.rs index 5092bf336..d1cafa7d9 100644 --- a/crates/ra_assists/src/handlers/auto_import.rs +++ b/crates/ra_assists/src/handlers/auto_import.rs | |||
@@ -488,16 +488,17 @@ mod tests { | |||
488 | check_assist( | 488 | check_assist( |
489 | auto_import, | 489 | auto_import, |
490 | r" | 490 | r" |
491 | //- /lib.rs crate:crate_with_macro | 491 | //- /lib.rs crate:crate_with_macro |
492 | #[macro_export] | 492 | #[macro_export] |
493 | macro_rules! foo { | 493 | macro_rules! foo { |
494 | () => () | 494 | () => () |
495 | } | 495 | } |
496 | 496 | ||
497 | //- /main.rs crate:main deps:crate_with_macro | 497 | //- /main.rs crate:main deps:crate_with_macro |
498 | fn main() { | 498 | fn main() { |
499 | foo<|> | 499 | foo<|> |
500 | }", | 500 | } |
501 | ", | ||
501 | r"use crate_with_macro::foo; | 502 | r"use crate_with_macro::foo; |
502 | 503 | ||
503 | fn main() { | 504 | fn main() { |
@@ -847,13 +848,14 @@ fn main() { | |||
847 | check_assist( | 848 | check_assist( |
848 | auto_import, | 849 | auto_import, |
849 | r" | 850 | r" |
850 | //- /lib.rs crate:dep | 851 | //- /lib.rs crate:dep |
851 | pub struct Struct; | 852 | pub struct Struct; |
852 | 853 | ||
853 | //- /main.rs crate:main deps:dep | 854 | //- /main.rs crate:main deps:dep |
854 | fn main() { | 855 | fn main() { |
855 | Struct<|> | 856 | Struct<|> |
856 | }", | 857 | } |
858 | ", | ||
857 | r"use dep::Struct; | 859 | r"use dep::Struct; |
858 | 860 | ||
859 | fn main() { | 861 | fn main() { |
@@ -869,20 +871,22 @@ fn main() { | |||
869 | check_assist( | 871 | check_assist( |
870 | auto_import, | 872 | auto_import, |
871 | r" | 873 | r" |
872 | //- /lib.rs crate:dep | 874 | //- /lib.rs crate:dep |
873 | pub mod fmt { | 875 | pub mod fmt { |
874 | pub trait Display {} | 876 | pub trait Display {} |
875 | } | 877 | } |
876 | 878 | ||
877 | pub fn panic_fmt() {} | 879 | pub fn panic_fmt() {} |
878 | 880 | ||
879 | //- /main.rs crate:main deps:dep | 881 | //- /main.rs crate:main deps:dep |
880 | struct S; | 882 | struct S; |
881 | 883 | ||
882 | impl f<|>mt::Display for S {}", | 884 | impl f<|>mt::Display for S {} |
885 | ", | ||
883 | r"use dep::fmt; | 886 | r"use dep::fmt; |
884 | 887 | ||
885 | struct S; | 888 | struct S; |
889 | |||
886 | impl fmt::Display for S {} | 890 | impl fmt::Display for S {} |
887 | ", | 891 | ", |
888 | ); | 892 | ); |
@@ -894,21 +898,20 @@ impl fmt::Display for S {} | |||
894 | check_assist( | 898 | check_assist( |
895 | auto_import, | 899 | auto_import, |
896 | r" | 900 | r" |
897 | //- /lib.rs crate:dep | 901 | //- /lib.rs crate:dep |
898 | 902 | macro_rules! mac { | |
899 | macro_rules! mac { | 903 | () => { |
900 | () => { | 904 | pub struct Cheese; |
901 | pub struct Cheese; | 905 | }; |
902 | }; | 906 | } |
903 | } | ||
904 | |||
905 | mac!(); | ||
906 | 907 | ||
907 | //- /main.rs crate:main deps:dep | 908 | mac!(); |
908 | 909 | ||
909 | fn main() { | 910 | //- /main.rs crate:main deps:dep |
910 | Cheese<|>; | 911 | fn main() { |
911 | }", | 912 | Cheese<|>; |
913 | } | ||
914 | ", | ||
912 | r"use dep::Cheese; | 915 | r"use dep::Cheese; |
913 | 916 | ||
914 | fn main() { | 917 | fn main() { |
@@ -924,16 +927,15 @@ fn main() { | |||
924 | check_assist( | 927 | check_assist( |
925 | auto_import, | 928 | auto_import, |
926 | r" | 929 | r" |
927 | //- /lib.rs crate:dep | 930 | //- /lib.rs crate:dep |
928 | 931 | pub struct FMT; | |
929 | pub struct FMT; | 932 | pub struct fmt; |
930 | pub struct fmt; | ||
931 | |||
932 | //- /main.rs crate:main deps:dep | ||
933 | 933 | ||
934 | fn main() { | 934 | //- /main.rs crate:main deps:dep |
935 | FMT<|>; | 935 | fn main() { |
936 | }", | 936 | FMT<|>; |
937 | } | ||
938 | ", | ||
937 | r"use dep::FMT; | 939 | r"use dep::FMT; |
938 | 940 | ||
939 | fn main() { | 941 | fn main() { |
diff --git a/crates/ra_assists/src/handlers/fill_match_arms.rs b/crates/ra_assists/src/handlers/fill_match_arms.rs index 3c12c1daa..64270c86f 100644 --- a/crates/ra_assists/src/handlers/fill_match_arms.rs +++ b/crates/ra_assists/src/handlers/fill_match_arms.rs | |||
@@ -763,9 +763,9 @@ mod tests { | |||
763 | fn foo(opt: Option<i32>) { | 763 | fn foo(opt: Option<i32>) { |
764 | match opt<|> { | 764 | match opt<|> { |
765 | } | 765 | } |
766 | }"#; | 766 | } |
767 | let before = | 767 | "#; |
768 | &format!("//- /main.rs crate:main deps:core\n{}{}", before, FamousDefs::FIXTURE); | 768 | let before = &format!("//- /main.rs crate:main deps:core{}{}", before, FamousDefs::FIXTURE); |
769 | 769 | ||
770 | check_assist( | 770 | check_assist( |
771 | fill_match_arms, | 771 | fill_match_arms, |
diff --git a/crates/ra_assists/src/handlers/fix_visibility.rs b/crates/ra_assists/src/handlers/fix_visibility.rs index 531b3560f..54601d1f3 100644 --- a/crates/ra_assists/src/handlers/fix_visibility.rs +++ b/crates/ra_assists/src/handlers/fix_visibility.rs | |||
@@ -255,15 +255,14 @@ mod tests { | |||
255 | check_assist( | 255 | check_assist( |
256 | fix_visibility, | 256 | fix_visibility, |
257 | r" | 257 | r" |
258 | //- /main.rs | 258 | //- /main.rs |
259 | mod foo; | 259 | mod foo; |
260 | fn main() { foo::Foo<|> } | 260 | fn main() { foo::Foo<|> } |
261 | 261 | ||
262 | //- /foo.rs | 262 | //- /foo.rs |
263 | struct Foo; | 263 | struct Foo; |
264 | ", | 264 | ", |
265 | r"$0pub(crate) struct Foo; | 265 | r"$0pub(crate) struct Foo; |
266 | |||
267 | ", | 266 | ", |
268 | ); | 267 | ); |
269 | } | 268 | } |
@@ -279,14 +278,14 @@ mod tests { | |||
279 | ); | 278 | ); |
280 | check_assist( | 279 | check_assist( |
281 | fix_visibility, | 280 | fix_visibility, |
282 | r"//- /lib.rs | 281 | r" |
283 | mod foo; | 282 | //- /lib.rs |
284 | fn main() { foo::Foo { <|>bar: () }; } | 283 | mod foo; |
285 | //- /foo.rs | 284 | fn main() { foo::Foo { <|>bar: () }; } |
286 | pub struct Foo { bar: () } | 285 | //- /foo.rs |
287 | ", | 286 | pub struct Foo { bar: () } |
287 | ", | ||
288 | r"pub struct Foo { $0pub(crate) bar: () } | 288 | r"pub struct Foo { $0pub(crate) bar: () } |
289 | |||
290 | ", | 289 | ", |
291 | ); | 290 | ); |
292 | check_assist_not_applicable( | 291 | check_assist_not_applicable( |
@@ -296,12 +295,13 @@ mod tests { | |||
296 | ); | 295 | ); |
297 | check_assist_not_applicable( | 296 | check_assist_not_applicable( |
298 | fix_visibility, | 297 | fix_visibility, |
299 | r"//- /lib.rs | 298 | r" |
300 | mod foo; | 299 | //- /lib.rs |
301 | fn main() { foo::Foo { <|>bar: () }; } | 300 | mod foo; |
302 | //- /foo.rs | 301 | fn main() { foo::Foo { <|>bar: () }; } |
303 | pub struct Foo { pub bar: () } | 302 | //- /foo.rs |
304 | ", | 303 | pub struct Foo { pub bar: () } |
304 | ", | ||
305 | ); | 305 | ); |
306 | } | 306 | } |
307 | 307 | ||
@@ -316,14 +316,14 @@ mod tests { | |||
316 | ); | 316 | ); |
317 | check_assist( | 317 | check_assist( |
318 | fix_visibility, | 318 | fix_visibility, |
319 | r"//- /lib.rs | 319 | r" |
320 | mod foo; | 320 | //- /lib.rs |
321 | fn main() { foo::Foo::Bar { <|>bar: () }; } | 321 | mod foo; |
322 | //- /foo.rs | 322 | fn main() { foo::Foo::Bar { <|>bar: () }; } |
323 | pub enum Foo { Bar { bar: () } } | 323 | //- /foo.rs |
324 | ", | 324 | pub enum Foo { Bar { bar: () } } |
325 | ", | ||
325 | r"pub enum Foo { Bar { $0pub(crate) bar: () } } | 326 | r"pub enum Foo { Bar { $0pub(crate) bar: () } } |
326 | |||
327 | ", | 327 | ", |
328 | ); | 328 | ); |
329 | check_assist_not_applicable( | 329 | check_assist_not_applicable( |
@@ -333,12 +333,13 @@ mod tests { | |||
333 | ); | 333 | ); |
334 | check_assist_not_applicable( | 334 | check_assist_not_applicable( |
335 | fix_visibility, | 335 | fix_visibility, |
336 | r"//- /lib.rs | 336 | r" |
337 | mod foo; | 337 | //- /lib.rs |
338 | fn main() { foo::Foo { <|>bar: () }; } | 338 | mod foo; |
339 | //- /foo.rs | 339 | fn main() { foo::Foo { <|>bar: () }; } |
340 | pub struct Foo { pub bar: () } | 340 | //- /foo.rs |
341 | ", | 341 | pub struct Foo { pub bar: () } |
342 | ", | ||
342 | ); | 343 | ); |
343 | } | 344 | } |
344 | 345 | ||
@@ -355,14 +356,14 @@ mod tests { | |||
355 | ); | 356 | ); |
356 | check_assist( | 357 | check_assist( |
357 | fix_visibility, | 358 | fix_visibility, |
358 | r"//- /lib.rs | 359 | r" |
359 | mod foo; | 360 | //- /lib.rs |
360 | fn main() { foo::Foo { <|>bar: () }; } | 361 | mod foo; |
361 | //- /foo.rs | 362 | fn main() { foo::Foo { <|>bar: () }; } |
362 | pub union Foo { bar: () } | 363 | //- /foo.rs |
363 | ", | 364 | pub union Foo { bar: () } |
365 | ", | ||
364 | r"pub union Foo { $0pub(crate) bar: () } | 366 | r"pub union Foo { $0pub(crate) bar: () } |
365 | |||
366 | ", | 367 | ", |
367 | ); | 368 | ); |
368 | check_assist_not_applicable( | 369 | check_assist_not_applicable( |
@@ -372,12 +373,13 @@ mod tests { | |||
372 | ); | 373 | ); |
373 | check_assist_not_applicable( | 374 | check_assist_not_applicable( |
374 | fix_visibility, | 375 | fix_visibility, |
375 | r"//- /lib.rs | 376 | r" |
376 | mod foo; | 377 | //- /lib.rs |
377 | fn main() { foo::Foo { <|>bar: () }; } | 378 | mod foo; |
378 | //- /foo.rs | 379 | fn main() { foo::Foo { <|>bar: () }; } |
379 | pub union Foo { pub bar: () } | 380 | //- /foo.rs |
380 | ", | 381 | pub union Foo { pub bar: () } |
382 | ", | ||
381 | ); | 383 | ); |
382 | } | 384 | } |
383 | 385 | ||
@@ -458,19 +460,18 @@ mod tests { | |||
458 | check_assist( | 460 | check_assist( |
459 | fix_visibility, | 461 | fix_visibility, |
460 | r" | 462 | r" |
461 | //- /main.rs | 463 | //- /main.rs |
462 | mod foo; | 464 | mod foo; |
463 | fn main() { foo::bar<|>::baz(); } | 465 | fn main() { foo::bar<|>::baz(); } |
464 | 466 | ||
465 | //- /foo.rs | 467 | //- /foo.rs |
466 | mod bar { | 468 | mod bar { |
467 | pub fn baz() {} | 469 | pub fn baz() {} |
468 | } | 470 | } |
469 | ", | 471 | ", |
470 | r"$0pub(crate) mod bar { | 472 | r"$0pub(crate) mod bar { |
471 | pub fn baz() {} | 473 | pub fn baz() {} |
472 | } | 474 | } |
473 | |||
474 | ", | 475 | ", |
475 | ); | 476 | ); |
476 | 477 | ||
@@ -486,17 +487,15 @@ mod tests { | |||
486 | check_assist( | 487 | check_assist( |
487 | fix_visibility, | 488 | fix_visibility, |
488 | r" | 489 | r" |
489 | //- /main.rs | 490 | //- /main.rs |
490 | mod foo; | 491 | mod foo; |
491 | fn main() { foo::bar<|>::baz(); } | 492 | fn main() { foo::bar<|>::baz(); } |
492 | 493 | ||
493 | //- /foo.rs | 494 | //- /foo.rs |
494 | mod bar; | 495 | mod bar; |
495 | 496 | //- /foo/bar.rs | |
496 | //- /foo/bar.rs | 497 | pub fn baz() {} |
497 | pub fn baz() {} | 498 | ", |
498 | } | ||
499 | ", | ||
500 | r"$0pub(crate) mod bar; | 499 | r"$0pub(crate) mod bar; |
501 | ", | 500 | ", |
502 | ); | 501 | ); |
@@ -506,14 +505,16 @@ mod tests { | |||
506 | fn fix_visibility_of_module_declaration_in_other_file() { | 505 | fn fix_visibility_of_module_declaration_in_other_file() { |
507 | check_assist( | 506 | check_assist( |
508 | fix_visibility, | 507 | fix_visibility, |
509 | r"//- /main.rs | 508 | r" |
510 | mod foo; | 509 | //- /main.rs |
511 | fn main() { foo::bar<|>>::baz(); } | 510 | mod foo; |
511 | fn main() { foo::bar<|>>::baz(); } | ||
512 | 512 | ||
513 | //- /foo.rs | 513 | //- /foo.rs |
514 | mod bar { | 514 | mod bar { |
515 | pub fn baz() {} | 515 | pub fn baz() {} |
516 | }", | 516 | } |
517 | ", | ||
517 | r"$0pub(crate) mod bar { | 518 | r"$0pub(crate) mod bar { |
518 | pub fn baz() {} | 519 | pub fn baz() {} |
519 | } | 520 | } |
@@ -525,10 +526,12 @@ mod tests { | |||
525 | fn adds_pub_when_target_is_in_another_crate() { | 526 | fn adds_pub_when_target_is_in_another_crate() { |
526 | check_assist( | 527 | check_assist( |
527 | fix_visibility, | 528 | fix_visibility, |
528 | r"//- /main.rs crate:a deps:foo | 529 | r" |
529 | foo::Bar<|> | 530 | //- /main.rs crate:a deps:foo |
530 | //- /lib.rs crate:foo | 531 | foo::Bar<|> |
531 | struct Bar;", | 532 | //- /lib.rs crate:foo |
533 | struct Bar; | ||
534 | ", | ||
532 | r"$0pub struct Bar; | 535 | r"$0pub struct Bar; |
533 | ", | 536 | ", |
534 | ) | 537 | ) |
diff --git a/crates/ra_assists/src/handlers/introduce_variable.rs b/crates/ra_assists/src/handlers/introduce_variable.rs index 31d6539f7..88b62278f 100644 --- a/crates/ra_assists/src/handlers/introduce_variable.rs +++ b/crates/ra_assists/src/handlers/introduce_variable.rs | |||
@@ -226,27 +226,31 @@ fn foo() { | |||
226 | mark::check!(test_introduce_var_last_expr); | 226 | mark::check!(test_introduce_var_last_expr); |
227 | check_assist( | 227 | check_assist( |
228 | introduce_variable, | 228 | introduce_variable, |
229 | " | 229 | r#" |
230 | fn foo() { | 230 | fn foo() { |
231 | bar(<|>1 + 1<|>) | 231 | bar(<|>1 + 1<|>) |
232 | }", | 232 | } |
233 | " | 233 | "#, |
234 | r#" | ||
234 | fn foo() { | 235 | fn foo() { |
235 | let $0var_name = 1 + 1; | 236 | let $0var_name = 1 + 1; |
236 | bar(var_name) | 237 | bar(var_name) |
237 | }", | 238 | } |
239 | "#, | ||
238 | ); | 240 | ); |
239 | check_assist( | 241 | check_assist( |
240 | introduce_variable, | 242 | introduce_variable, |
241 | " | 243 | r#" |
242 | fn foo() { | 244 | fn foo() { |
243 | <|>bar(1 + 1)<|> | 245 | <|>bar(1 + 1)<|> |
244 | }", | 246 | } |
245 | " | 247 | "#, |
248 | r#" | ||
246 | fn foo() { | 249 | fn foo() { |
247 | let $0var_name = bar(1 + 1); | 250 | let $0var_name = bar(1 + 1); |
248 | var_name | 251 | var_name |
249 | }", | 252 | } |
253 | "#, | ||
250 | ) | 254 | ) |
251 | } | 255 | } |
252 | 256 | ||
diff --git a/crates/ra_assists/src/handlers/raw_string.rs b/crates/ra_assists/src/handlers/raw_string.rs index 16002d2ac..d22d0aa55 100644 --- a/crates/ra_assists/src/handlers/raw_string.rs +++ b/crates/ra_assists/src/handlers/raw_string.rs | |||
@@ -158,16 +158,16 @@ mod test { | |||
158 | check_assist( | 158 | check_assist( |
159 | make_raw_string, | 159 | make_raw_string, |
160 | r#" | 160 | r#" |
161 | fn f() { | 161 | fn f() { |
162 | let s = <|>"random\nstring"; | 162 | let s = <|>"random\nstring"; |
163 | } | 163 | } |
164 | "#, | 164 | "#, |
165 | r##" | 165 | r##" |
166 | fn f() { | 166 | fn f() { |
167 | let s = r#"random | 167 | let s = r#"random |
168 | string"#; | 168 | string"#; |
169 | } | 169 | } |
170 | "##, | 170 | "##, |
171 | ) | 171 | ) |
172 | } | 172 | } |
173 | 173 | ||
@@ -193,16 +193,16 @@ string"#; | |||
193 | check_assist( | 193 | check_assist( |
194 | make_raw_string, | 194 | make_raw_string, |
195 | r###" | 195 | r###" |
196 | fn f() { | 196 | fn f() { |
197 | let s = <|>"#random##\nstring"; | 197 | let s = <|>"#random##\nstring"; |
198 | } | 198 | } |
199 | "###, | 199 | "###, |
200 | r####" | 200 | r####" |
201 | fn f() { | 201 | fn f() { |
202 | let s = r#"#random## | 202 | let s = r#"#random## |
203 | string"#; | 203 | string"#; |
204 | } | 204 | } |
205 | "####, | 205 | "####, |
206 | ) | 206 | ) |
207 | } | 207 | } |
208 | 208 | ||
@@ -211,16 +211,16 @@ string"#; | |||
211 | check_assist( | 211 | check_assist( |
212 | make_raw_string, | 212 | make_raw_string, |
213 | r###" | 213 | r###" |
214 | fn f() { | 214 | fn f() { |
215 | let s = <|>"#random\"##\nstring"; | 215 | let s = <|>"#random\"##\nstring"; |
216 | } | 216 | } |
217 | "###, | 217 | "###, |
218 | r####" | 218 | r####" |
219 | fn f() { | 219 | fn f() { |
220 | let s = r###"#random"## | 220 | let s = r###"#random"## |
221 | string"###; | 221 | string"###; |
222 | } | 222 | } |
223 | "####, | 223 | "####, |
224 | ) | 224 | ) |
225 | } | 225 | } |
226 | 226 | ||
diff --git a/crates/ra_assists/src/tests.rs b/crates/ra_assists/src/tests.rs index 55576813f..858f5ca80 100644 --- a/crates/ra_assists/src/tests.rs +++ b/crates/ra_assists/src/tests.rs | |||
@@ -4,18 +4,18 @@ use hir::Semantics; | |||
4 | use ra_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt}; | 4 | use ra_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt}; |
5 | use ra_ide_db::RootDatabase; | 5 | use ra_ide_db::RootDatabase; |
6 | use ra_syntax::TextRange; | 6 | use ra_syntax::TextRange; |
7 | use test_utils::{ | 7 | use test_utils::{assert_eq_text, extract_offset, extract_range}; |
8 | assert_eq_text, extract_offset, extract_range, extract_range_or_offset, RangeOrOffset, | ||
9 | }; | ||
10 | 8 | ||
11 | use crate::{handlers::Handler, Assist, AssistConfig, AssistContext, Assists}; | 9 | use crate::{handlers::Handler, Assist, AssistConfig, AssistContext, Assists}; |
10 | use stdx::trim_indent; | ||
12 | 11 | ||
13 | pub(crate) fn with_single_file(text: &str) -> (RootDatabase, FileId) { | 12 | pub(crate) fn with_single_file(text: &str) -> (RootDatabase, FileId) { |
14 | RootDatabase::with_single_file(text) | 13 | RootDatabase::with_single_file(text) |
15 | } | 14 | } |
16 | 15 | ||
17 | pub(crate) fn check_assist(assist: Handler, ra_fixture_before: &str, ra_fixture_after: &str) { | 16 | pub(crate) fn check_assist(assist: Handler, ra_fixture_before: &str, ra_fixture_after: &str) { |
18 | check(assist, ra_fixture_before, ExpectedResult::After(ra_fixture_after)); | 17 | let ra_fixture_after = trim_indent(ra_fixture_after); |
18 | check(assist, ra_fixture_before, ExpectedResult::After(&ra_fixture_after)); | ||
19 | } | 19 | } |
20 | 20 | ||
21 | // FIXME: instead of having a separate function here, maybe use | 21 | // FIXME: instead of having a separate function here, maybe use |
@@ -30,8 +30,9 @@ pub(crate) fn check_assist_not_applicable(assist: Handler, ra_fixture: &str) { | |||
30 | } | 30 | } |
31 | 31 | ||
32 | fn check_doc_test(assist_id: &str, before: &str, after: &str) { | 32 | fn check_doc_test(assist_id: &str, before: &str, after: &str) { |
33 | let (selection, before) = extract_range_or_offset(before); | 33 | let after = trim_indent(after); |
34 | let (db, file_id) = crate::tests::with_single_file(&before); | 34 | let (db, file_id, selection) = RootDatabase::with_range_or_offset(&before); |
35 | let before = db.file_text(file_id).to_string(); | ||
35 | let frange = FileRange { file_id, range: selection.into() }; | 36 | let frange = FileRange { file_id, range: selection.into() }; |
36 | 37 | ||
37 | let mut assist = Assist::resolved(&db, &AssistConfig::default(), frange) | 38 | let mut assist = Assist::resolved(&db, &AssistConfig::default(), frange) |
@@ -51,11 +52,11 @@ fn check_doc_test(assist_id: &str, before: &str, after: &str) { | |||
51 | 52 | ||
52 | let actual = { | 53 | let actual = { |
53 | let change = assist.source_change.source_file_edits.pop().unwrap(); | 54 | let change = assist.source_change.source_file_edits.pop().unwrap(); |
54 | let mut actual = before.clone(); | 55 | let mut actual = before; |
55 | change.edit.apply(&mut actual); | 56 | change.edit.apply(&mut actual); |
56 | actual | 57 | actual |
57 | }; | 58 | }; |
58 | assert_eq_text!(after, &actual); | 59 | assert_eq_text!(&after, &actual); |
59 | } | 60 | } |
60 | 61 | ||
61 | enum ExpectedResult<'a> { | 62 | enum ExpectedResult<'a> { |
@@ -65,19 +66,8 @@ enum ExpectedResult<'a> { | |||
65 | } | 66 | } |
66 | 67 | ||
67 | fn check(handler: Handler, before: &str, expected: ExpectedResult) { | 68 | fn check(handler: Handler, before: &str, expected: ExpectedResult) { |
68 | let (text_without_caret, file_with_caret_id, range_or_offset, db) = if before.contains("//-") { | 69 | let (db, file_with_caret_id, range_or_offset) = RootDatabase::with_range_or_offset(before); |
69 | let (db, position) = RootDatabase::with_position(before); | 70 | let text_without_caret = db.file_text(file_with_caret_id).to_string(); |
70 | ( | ||
71 | db.file_text(position.file_id).as_ref().to_owned(), | ||
72 | position.file_id, | ||
73 | RangeOrOffset::Offset(position.offset), | ||
74 | db, | ||
75 | ) | ||
76 | } else { | ||
77 | let (range_or_offset, text_without_caret) = extract_range_or_offset(before); | ||
78 | let (db, file_id) = with_single_file(&text_without_caret); | ||
79 | (text_without_caret, file_id, range_or_offset, db) | ||
80 | }; | ||
81 | 71 | ||
82 | let frange = FileRange { file_id: file_with_caret_id, range: range_or_offset.into() }; | 72 | let frange = FileRange { file_id: file_with_caret_id, range: range_or_offset.into() }; |
83 | 73 | ||
diff --git a/crates/ra_assists/src/utils.rs b/crates/ra_assists/src/utils.rs index c1ff0de7b..b7c45a619 100644 --- a/crates/ra_assists/src/utils.rs +++ b/crates/ra_assists/src/utils.rs | |||
@@ -198,8 +198,7 @@ pub(crate) struct FamousDefs<'a, 'b>(pub(crate) &'a Semantics<'b, RootDatabase>, | |||
198 | #[allow(non_snake_case)] | 198 | #[allow(non_snake_case)] |
199 | impl FamousDefs<'_, '_> { | 199 | impl FamousDefs<'_, '_> { |
200 | #[cfg(test)] | 200 | #[cfg(test)] |
201 | pub(crate) const FIXTURE: &'static str = r#" | 201 | pub(crate) const FIXTURE: &'static str = r#"//- /libcore.rs crate:core |
202 | //- /libcore.rs crate:core | ||
203 | pub mod convert { | 202 | pub mod convert { |
204 | pub trait From<T> { | 203 | pub trait From<T> { |
205 | fn from(T) -> Self; | 204 | fn from(T) -> Self; |
diff --git a/crates/ra_db/src/fixture.rs b/crates/ra_db/src/fixture.rs index f7d9118a9..ddf46e6c4 100644 --- a/crates/ra_db/src/fixture.rs +++ b/crates/ra_db/src/fixture.rs | |||
@@ -61,7 +61,7 @@ use std::{str::FromStr, sync::Arc}; | |||
61 | 61 | ||
62 | use ra_cfg::CfgOptions; | 62 | use ra_cfg::CfgOptions; |
63 | use rustc_hash::FxHashMap; | 63 | use rustc_hash::FxHashMap; |
64 | use test_utils::{extract_offset, parse_fixture, parse_single_fixture, FixtureMeta, CURSOR_MARKER}; | 64 | use test_utils::{extract_range_or_offset, Fixture, RangeOrOffset, CURSOR_MARKER}; |
65 | use vfs::{file_set::FileSet, VfsPath}; | 65 | use vfs::{file_set::FileSet, VfsPath}; |
66 | 66 | ||
67 | use crate::{ | 67 | use crate::{ |
@@ -74,21 +74,32 @@ pub const WORKSPACE: SourceRootId = SourceRootId(0); | |||
74 | pub trait WithFixture: Default + SourceDatabaseExt + 'static { | 74 | pub trait WithFixture: Default + SourceDatabaseExt + 'static { |
75 | fn with_single_file(text: &str) -> (Self, FileId) { | 75 | fn with_single_file(text: &str) -> (Self, FileId) { |
76 | let mut db = Self::default(); | 76 | let mut db = Self::default(); |
77 | let file_id = with_single_file(&mut db, text); | 77 | let (_, files) = with_files(&mut db, text); |
78 | (db, file_id) | 78 | assert_eq!(files.len(), 1); |
79 | (db, files[0]) | ||
79 | } | 80 | } |
80 | 81 | ||
81 | fn with_files(ra_fixture: &str) -> Self { | 82 | fn with_files(ra_fixture: &str) -> Self { |
82 | let mut db = Self::default(); | 83 | let mut db = Self::default(); |
83 | let pos = with_files(&mut db, ra_fixture); | 84 | let (pos, _) = with_files(&mut db, ra_fixture); |
84 | assert!(pos.is_none()); | 85 | assert!(pos.is_none()); |
85 | db | 86 | db |
86 | } | 87 | } |
87 | 88 | ||
88 | fn with_position(ra_fixture: &str) -> (Self, FilePosition) { | 89 | fn with_position(ra_fixture: &str) -> (Self, FilePosition) { |
90 | let (db, file_id, range_or_offset) = Self::with_range_or_offset(ra_fixture); | ||
91 | let offset = match range_or_offset { | ||
92 | RangeOrOffset::Range(_) => panic!(), | ||
93 | RangeOrOffset::Offset(it) => it, | ||
94 | }; | ||
95 | (db, FilePosition { file_id, offset }) | ||
96 | } | ||
97 | |||
98 | fn with_range_or_offset(ra_fixture: &str) -> (Self, FileId, RangeOrOffset) { | ||
89 | let mut db = Self::default(); | 99 | let mut db = Self::default(); |
90 | let pos = with_files(&mut db, ra_fixture); | 100 | let (pos, _) = with_files(&mut db, ra_fixture); |
91 | (db, pos.unwrap()) | 101 | let (file_id, range_or_offset) = pos.unwrap(); |
102 | (db, file_id, range_or_offset) | ||
92 | } | 103 | } |
93 | 104 | ||
94 | fn test_crate(&self) -> CrateId { | 105 | fn test_crate(&self) -> CrateId { |
@@ -102,78 +113,27 @@ pub trait WithFixture: Default + SourceDatabaseExt + 'static { | |||
102 | 113 | ||
103 | impl<DB: SourceDatabaseExt + Default + 'static> WithFixture for DB {} | 114 | impl<DB: SourceDatabaseExt + Default + 'static> WithFixture for DB {} |
104 | 115 | ||
105 | fn with_single_file(db: &mut dyn SourceDatabaseExt, ra_fixture: &str) -> FileId { | 116 | fn with_files( |
106 | let file_id = FileId(0); | 117 | db: &mut dyn SourceDatabaseExt, |
107 | let mut file_set = vfs::file_set::FileSet::default(); | 118 | fixture: &str, |
108 | file_set.insert(file_id, vfs::VfsPath::new_virtual_path("/main.rs".to_string())); | 119 | ) -> (Option<(FileId, RangeOrOffset)>, Vec<FileId>) { |
109 | 120 | let fixture = Fixture::parse(fixture); | |
110 | let source_root = SourceRoot::new_local(file_set); | ||
111 | |||
112 | let fixture = parse_single_fixture(ra_fixture); | ||
113 | |||
114 | let crate_graph = if let Some(entry) = fixture { | ||
115 | let meta = match ParsedMeta::from(&entry.meta) { | ||
116 | ParsedMeta::File(it) => it, | ||
117 | _ => panic!("with_single_file only support file meta"), | ||
118 | }; | ||
119 | |||
120 | let mut crate_graph = CrateGraph::default(); | ||
121 | crate_graph.add_crate_root( | ||
122 | file_id, | ||
123 | meta.edition, | ||
124 | meta.krate.map(|name| { | ||
125 | CrateName::new(&name).expect("Fixture crate name should not contain dashes") | ||
126 | }), | ||
127 | meta.cfg, | ||
128 | meta.env, | ||
129 | Default::default(), | ||
130 | ); | ||
131 | crate_graph | ||
132 | } else { | ||
133 | let mut crate_graph = CrateGraph::default(); | ||
134 | crate_graph.add_crate_root( | ||
135 | file_id, | ||
136 | Edition::Edition2018, | ||
137 | None, | ||
138 | CfgOptions::default(), | ||
139 | Env::default(), | ||
140 | Default::default(), | ||
141 | ); | ||
142 | crate_graph | ||
143 | }; | ||
144 | |||
145 | db.set_file_text(file_id, Arc::new(ra_fixture.to_string())); | ||
146 | db.set_file_source_root(file_id, WORKSPACE); | ||
147 | db.set_source_root(WORKSPACE, Arc::new(source_root)); | ||
148 | db.set_crate_graph(Arc::new(crate_graph)); | ||
149 | |||
150 | file_id | ||
151 | } | ||
152 | |||
153 | fn with_files(db: &mut dyn SourceDatabaseExt, fixture: &str) -> Option<FilePosition> { | ||
154 | let fixture = parse_fixture(fixture); | ||
155 | 121 | ||
122 | let mut files = Vec::new(); | ||
156 | let mut crate_graph = CrateGraph::default(); | 123 | let mut crate_graph = CrateGraph::default(); |
157 | let mut crates = FxHashMap::default(); | 124 | let mut crates = FxHashMap::default(); |
158 | let mut crate_deps = Vec::new(); | 125 | let mut crate_deps = Vec::new(); |
159 | let mut default_crate_root: Option<FileId> = None; | 126 | let mut default_crate_root: Option<FileId> = None; |
160 | 127 | ||
161 | let mut file_set = FileSet::default(); | 128 | let mut file_set = FileSet::default(); |
162 | let mut source_root_id = WORKSPACE; | 129 | let source_root_id = WORKSPACE; |
163 | let mut source_root_prefix = "/".to_string(); | 130 | let source_root_prefix = "/".to_string(); |
164 | let mut file_id = FileId(0); | 131 | let mut file_id = FileId(0); |
165 | 132 | ||
166 | let mut file_position = None; | 133 | let mut file_position = None; |
167 | 134 | ||
168 | for entry in fixture.iter() { | 135 | for entry in fixture.iter() { |
169 | let meta = match ParsedMeta::from(&entry.meta) { | 136 | let meta = match ParsedMeta::from(entry) { |
170 | ParsedMeta::Root { path } => { | ||
171 | let file_set = std::mem::replace(&mut file_set, FileSet::default()); | ||
172 | db.set_source_root(source_root_id, Arc::new(SourceRoot::new_local(file_set))); | ||
173 | source_root_id.0 += 1; | ||
174 | source_root_prefix = path; | ||
175 | continue; | ||
176 | } | ||
177 | ParsedMeta::File(it) => it, | 137 | ParsedMeta::File(it) => it, |
178 | }; | 138 | }; |
179 | assert!(meta.path.starts_with(&source_root_prefix)); | 139 | assert!(meta.path.starts_with(&source_root_prefix)); |
@@ -198,9 +158,9 @@ fn with_files(db: &mut dyn SourceDatabaseExt, fixture: &str) -> Option<FilePosit | |||
198 | } | 158 | } |
199 | 159 | ||
200 | let text = if entry.text.contains(CURSOR_MARKER) { | 160 | let text = if entry.text.contains(CURSOR_MARKER) { |
201 | let (offset, text) = extract_offset(&entry.text); | 161 | let (range_or_offset, text) = extract_range_or_offset(&entry.text); |
202 | assert!(file_position.is_none()); | 162 | assert!(file_position.is_none()); |
203 | file_position = Some(FilePosition { file_id, offset }); | 163 | file_position = Some((file_id, range_or_offset)); |
204 | text.to_string() | 164 | text.to_string() |
205 | } else { | 165 | } else { |
206 | entry.text.to_string() | 166 | entry.text.to_string() |
@@ -210,7 +170,7 @@ fn with_files(db: &mut dyn SourceDatabaseExt, fixture: &str) -> Option<FilePosit | |||
210 | db.set_file_source_root(file_id, source_root_id); | 170 | db.set_file_source_root(file_id, source_root_id); |
211 | let path = VfsPath::new_virtual_path(meta.path); | 171 | let path = VfsPath::new_virtual_path(meta.path); |
212 | file_set.insert(file_id, path.into()); | 172 | file_set.insert(file_id, path.into()); |
213 | 173 | files.push(file_id); | |
214 | file_id.0 += 1; | 174 | file_id.0 += 1; |
215 | } | 175 | } |
216 | 176 | ||
@@ -235,11 +195,10 @@ fn with_files(db: &mut dyn SourceDatabaseExt, fixture: &str) -> Option<FilePosit | |||
235 | db.set_source_root(source_root_id, Arc::new(SourceRoot::new_local(file_set))); | 195 | db.set_source_root(source_root_id, Arc::new(SourceRoot::new_local(file_set))); |
236 | db.set_crate_graph(Arc::new(crate_graph)); | 196 | db.set_crate_graph(Arc::new(crate_graph)); |
237 | 197 | ||
238 | file_position | 198 | (file_position, files) |
239 | } | 199 | } |
240 | 200 | ||
241 | enum ParsedMeta { | 201 | enum ParsedMeta { |
242 | Root { path: String }, | ||
243 | File(FileMeta), | 202 | File(FileMeta), |
244 | } | 203 | } |
245 | 204 | ||
@@ -252,25 +211,22 @@ struct FileMeta { | |||
252 | env: Env, | 211 | env: Env, |
253 | } | 212 | } |
254 | 213 | ||
255 | impl From<&FixtureMeta> for ParsedMeta { | 214 | impl From<&Fixture> for ParsedMeta { |
256 | fn from(meta: &FixtureMeta) -> Self { | 215 | fn from(f: &Fixture) -> Self { |
257 | match meta { | 216 | let mut cfg = CfgOptions::default(); |
258 | FixtureMeta::Root { path } => { | 217 | f.cfg_atoms.iter().for_each(|it| cfg.insert_atom(it.into())); |
259 | // `Self::Root` causes a false warning: 'variant is never constructed: `Root` ' | 218 | f.cfg_key_values.iter().for_each(|(k, v)| cfg.insert_key_value(k.into(), v.into())); |
260 | // see https://github.com/rust-lang/rust/issues/69018 | 219 | |
261 | ParsedMeta::Root { path: path.to_owned() } | 220 | Self::File(FileMeta { |
262 | } | 221 | path: f.path.to_owned(), |
263 | FixtureMeta::File(f) => Self::File(FileMeta { | 222 | krate: f.crate_name.to_owned(), |
264 | path: f.path.to_owned(), | 223 | deps: f.deps.to_owned(), |
265 | krate: f.crate_name.to_owned(), | 224 | cfg, |
266 | deps: f.deps.to_owned(), | 225 | edition: f |
267 | cfg: f.cfg.to_owned(), | 226 | .edition |
268 | edition: f | 227 | .as_ref() |
269 | .edition | 228 | .map_or(Edition::Edition2018, |v| Edition::from_str(&v).unwrap()), |
270 | .as_ref() | 229 | env: Env::from(f.env.iter()), |
271 | .map_or(Edition::Edition2018, |v| Edition::from_str(&v).unwrap()), | 230 | }) |
272 | env: Env::from(f.env.iter()), | ||
273 | }), | ||
274 | } | ||
275 | } | 231 | } |
276 | } | 232 | } |
diff --git a/crates/ra_hir_def/src/body/scope.rs b/crates/ra_hir_def/src/body/scope.rs index 661f00407..0b74199d9 100644 --- a/crates/ra_hir_def/src/body/scope.rs +++ b/crates/ra_hir_def/src/body/scope.rs | |||
@@ -189,20 +189,22 @@ mod tests { | |||
189 | } | 189 | } |
190 | 190 | ||
191 | fn do_check(ra_fixture: &str, expected: &[&str]) { | 191 | fn do_check(ra_fixture: &str, expected: &[&str]) { |
192 | let (off, code) = extract_offset(ra_fixture); | 192 | let (offset, code) = extract_offset(ra_fixture); |
193 | let code = { | 193 | let code = { |
194 | let mut buf = String::new(); | 194 | let mut buf = String::new(); |
195 | let off: usize = off.into(); | 195 | let off: usize = offset.into(); |
196 | buf.push_str(&code[..off]); | 196 | buf.push_str(&code[..off]); |
197 | buf.push_str("marker"); | 197 | buf.push_str("<|>marker"); |
198 | buf.push_str(&code[off..]); | 198 | buf.push_str(&code[off..]); |
199 | buf | 199 | buf |
200 | }; | 200 | }; |
201 | 201 | ||
202 | let (db, file_id) = TestDB::with_single_file(&code); | 202 | let (db, position) = TestDB::with_position(&code); |
203 | let file_id = position.file_id; | ||
204 | let offset = position.offset; | ||
203 | 205 | ||
204 | let file_syntax = db.parse(file_id).syntax_node(); | 206 | let file_syntax = db.parse(file_id).syntax_node(); |
205 | let marker: ast::PathExpr = find_node_at_offset(&file_syntax, off).unwrap(); | 207 | let marker: ast::PathExpr = find_node_at_offset(&file_syntax, offset).unwrap(); |
206 | let function = find_function(&db, file_id); | 208 | let function = find_function(&db, file_id); |
207 | 209 | ||
208 | let scopes = db.expr_scopes(function.into()); | 210 | let scopes = db.expr_scopes(function.into()); |
@@ -302,27 +304,28 @@ mod tests { | |||
302 | fn test_bindings_after_at() { | 304 | fn test_bindings_after_at() { |
303 | do_check( | 305 | do_check( |
304 | r" | 306 | r" |
305 | fn foo() { | 307 | fn foo() { |
306 | match Some(()) { | 308 | match Some(()) { |
307 | opt @ Some(unit) => { | 309 | opt @ Some(unit) => { |
308 | <|> | 310 | <|> |
309 | } | 311 | } |
310 | _ => {} | 312 | _ => {} |
311 | } | 313 | } |
312 | }", | 314 | } |
315 | ", | ||
313 | &["opt", "unit"], | 316 | &["opt", "unit"], |
314 | ); | 317 | ); |
315 | } | 318 | } |
316 | 319 | ||
317 | fn do_check_local_name(code: &str, expected_offset: u32) { | 320 | fn do_check_local_name(ra_fixture: &str, expected_offset: u32) { |
318 | let (off, code) = extract_offset(code); | 321 | let (db, position) = TestDB::with_position(ra_fixture); |
319 | 322 | let file_id = position.file_id; | |
320 | let (db, file_id) = TestDB::with_single_file(&code); | 323 | let offset = position.offset; |
321 | 324 | ||
322 | let file = db.parse(file_id).ok().unwrap(); | 325 | let file = db.parse(file_id).ok().unwrap(); |
323 | let expected_name = find_node_at_offset::<ast::Name>(file.syntax(), expected_offset.into()) | 326 | let expected_name = find_node_at_offset::<ast::Name>(file.syntax(), expected_offset.into()) |
324 | .expect("failed to find a name at the target offset"); | 327 | .expect("failed to find a name at the target offset"); |
325 | let name_ref: ast::NameRef = find_node_at_offset(file.syntax(), off).unwrap(); | 328 | let name_ref: ast::NameRef = find_node_at_offset(file.syntax(), offset).unwrap(); |
326 | 329 | ||
327 | let function = find_function(&db, file_id); | 330 | let function = find_function(&db, file_id); |
328 | 331 | ||
@@ -350,15 +353,16 @@ mod tests { | |||
350 | fn test_resolve_local_name() { | 353 | fn test_resolve_local_name() { |
351 | do_check_local_name( | 354 | do_check_local_name( |
352 | r#" | 355 | r#" |
353 | fn foo(x: i32, y: u32) { | 356 | fn foo(x: i32, y: u32) { |
354 | { | 357 | { |
355 | let z = x * 2; | 358 | let z = x * 2; |
356 | } | 359 | } |
357 | { | 360 | { |
358 | let t = x<|> * 3; | 361 | let t = x<|> * 3; |
359 | } | 362 | } |
360 | }"#, | 363 | } |
361 | 21, | 364 | "#, |
365 | 7, | ||
362 | ); | 366 | ); |
363 | } | 367 | } |
364 | 368 | ||
@@ -366,10 +370,11 @@ mod tests { | |||
366 | fn test_resolve_local_name_declaration() { | 370 | fn test_resolve_local_name_declaration() { |
367 | do_check_local_name( | 371 | do_check_local_name( |
368 | r#" | 372 | r#" |
369 | fn foo(x: String) { | 373 | fn foo(x: String) { |
370 | let x : &str = &x<|>; | 374 | let x : &str = &x<|>; |
371 | }"#, | 375 | } |
372 | 21, | 376 | "#, |
377 | 7, | ||
373 | ); | 378 | ); |
374 | } | 379 | } |
375 | 380 | ||
@@ -377,12 +382,12 @@ mod tests { | |||
377 | fn test_resolve_local_name_shadow() { | 382 | fn test_resolve_local_name_shadow() { |
378 | do_check_local_name( | 383 | do_check_local_name( |
379 | r" | 384 | r" |
380 | fn foo(x: String) { | 385 | fn foo(x: String) { |
381 | let x : &str = &x; | 386 | let x : &str = &x; |
382 | x<|> | 387 | x<|> |
383 | } | 388 | } |
384 | ", | 389 | ", |
385 | 53, | 390 | 28, |
386 | ); | 391 | ); |
387 | } | 392 | } |
388 | 393 | ||
@@ -390,13 +395,13 @@ mod tests { | |||
390 | fn ref_patterns_contribute_bindings() { | 395 | fn ref_patterns_contribute_bindings() { |
391 | do_check_local_name( | 396 | do_check_local_name( |
392 | r" | 397 | r" |
393 | fn foo() { | 398 | fn foo() { |
394 | if let Some(&from) = bar() { | 399 | if let Some(&from) = bar() { |
395 | from<|>; | 400 | from<|>; |
396 | } | 401 | } |
397 | } | 402 | } |
398 | ", | 403 | ", |
399 | 53, | 404 | 28, |
400 | ); | 405 | ); |
401 | } | 406 | } |
402 | 407 | ||
diff --git a/crates/ra_hir_def/src/nameres/tests.rs b/crates/ra_hir_def/src/nameres/tests.rs index 05cd0297d..503099fb7 100644 --- a/crates/ra_hir_def/src/nameres/tests.rs +++ b/crates/ra_hir_def/src/nameres/tests.rs | |||
@@ -424,31 +424,6 @@ fn extern_crate_rename_2015_edition() { | |||
424 | } | 424 | } |
425 | 425 | ||
426 | #[test] | 426 | #[test] |
427 | fn import_across_source_roots() { | ||
428 | let map = def_map( | ||
429 | " | ||
430 | //- /main.rs crate:main deps:test_crate | ||
431 | use test_crate::a::b::C; | ||
432 | |||
433 | //- root /test_crate/ | ||
434 | |||
435 | //- /test_crate/lib.rs crate:test_crate | ||
436 | pub mod a { | ||
437 | pub mod b { | ||
438 | pub struct C; | ||
439 | } | ||
440 | } | ||
441 | |||
442 | ", | ||
443 | ); | ||
444 | |||
445 | assert_snapshot!(map, @r###" | ||
446 | â‹®crate | ||
447 | â‹®C: t v | ||
448 | "###); | ||
449 | } | ||
450 | |||
451 | #[test] | ||
452 | fn reexport_across_crates() { | 427 | fn reexport_across_crates() { |
453 | let map = def_map( | 428 | let map = def_map( |
454 | " | 429 | " |
diff --git a/crates/ra_hir_ty/src/tests/coercion.rs b/crates/ra_hir_ty/src/tests/coercion.rs index 6f777ed8c..a2601c68a 100644 --- a/crates/ra_hir_ty/src/tests/coercion.rs +++ b/crates/ra_hir_ty/src/tests/coercion.rs | |||
@@ -29,10 +29,10 @@ fn test() { | |||
29 | } | 29 | } |
30 | "#), | 30 | "#), |
31 | @r###" | 31 | @r###" |
32 | 11..41 '{ ...4 }; }': () | 32 | 10..40 '{ ...4 }; }': () |
33 | 21..22 'a': i32 | 33 | 20..21 'a': i32 |
34 | 30..38 '{ 1i64 }': i64 | 34 | 29..37 '{ 1i64 }': i64 |
35 | 32..36 '1i64': i64 | 35 | 31..35 '1i64': i64 |
36 | "###); | 36 | "###); |
37 | } | 37 | } |
38 | 38 | ||
@@ -63,50 +63,50 @@ fn test2() { | |||
63 | } | 63 | } |
64 | "#), | 64 | "#), |
65 | @r###" | 65 | @r###" |
66 | 31..32 '_': &[T] | 66 | 30..31 '_': &[T] |
67 | 45..56 '{ loop {} }': T | 67 | 44..55 '{ loop {} }': T |
68 | 47..54 'loop {}': ! | 68 | 46..53 'loop {}': ! |
69 | 52..54 '{}': () | 69 | 51..53 '{}': () |
70 | 65..66 '_': S<&[T]> | 70 | 64..65 '_': S<&[T]> |
71 | 82..93 '{ loop {} }': T | 71 | 81..92 '{ loop {} }': T |
72 | 84..91 'loop {}': ! | 72 | 83..90 'loop {}': ! |
73 | 89..91 '{}': () | 73 | 88..90 '{}': () |
74 | 122..133 '{ loop {} }': *mut [T; _] | 74 | 121..132 '{ loop {} }': *mut [T; _] |
75 | 124..131 'loop {}': ! | 75 | 123..130 'loop {}': ! |
76 | 129..131 '{}': () | 76 | 128..130 '{}': () |
77 | 160..173 '{ gen() }': *mut [U] | 77 | 159..172 '{ gen() }': *mut [U] |
78 | 166..169 'gen': fn gen<U>() -> *mut [U; _] | 78 | 165..168 'gen': fn gen<U>() -> *mut [U; _] |
79 | 166..171 'gen()': *mut [U; _] | 79 | 165..170 'gen()': *mut [U; _] |
80 | 186..420 '{ ...rr); }': () | 80 | 185..419 '{ ...rr); }': () |
81 | 196..199 'arr': &[u8; _] | 81 | 195..198 'arr': &[u8; _] |
82 | 212..216 '&[1]': &[u8; _] | 82 | 211..215 '&[1]': &[u8; _] |
83 | 213..216 '[1]': [u8; _] | 83 | 212..215 '[1]': [u8; _] |
84 | 214..215 '1': u8 | 84 | 213..214 '1': u8 |
85 | 227..228 'a': &[u8] | 85 | 226..227 'a': &[u8] |
86 | 237..240 'arr': &[u8; _] | 86 | 236..239 'arr': &[u8; _] |
87 | 250..251 'b': u8 | 87 | 249..250 'b': u8 |
88 | 254..255 'f': fn f<u8>(&[u8]) -> u8 | 88 | 253..254 'f': fn f<u8>(&[u8]) -> u8 |
89 | 254..260 'f(arr)': u8 | 89 | 253..259 'f(arr)': u8 |
90 | 256..259 'arr': &[u8; _] | 90 | 255..258 'arr': &[u8; _] |
91 | 270..271 'c': &[u8] | 91 | 269..270 'c': &[u8] |
92 | 280..287 '{ arr }': &[u8] | 92 | 279..286 '{ arr }': &[u8] |
93 | 282..285 'arr': &[u8; _] | 93 | 281..284 'arr': &[u8; _] |
94 | 297..298 'd': u8 | 94 | 296..297 'd': u8 |
95 | 301..302 'g': fn g<u8>(S<&[u8]>) -> u8 | 95 | 300..301 'g': fn g<u8>(S<&[u8]>) -> u8 |
96 | 301..316 'g(S { a: arr })': u8 | 96 | 300..315 'g(S { a: arr })': u8 |
97 | 303..315 'S { a: arr }': S<&[u8]> | 97 | 302..314 'S { a: arr }': S<&[u8]> |
98 | 310..313 'arr': &[u8; _] | 98 | 309..312 'arr': &[u8; _] |
99 | 326..327 'e': [&[u8]; _] | 99 | 325..326 'e': [&[u8]; _] |
100 | 341..346 '[arr]': [&[u8]; _] | 100 | 340..345 '[arr]': [&[u8]; _] |
101 | 342..345 'arr': &[u8; _] | 101 | 341..344 'arr': &[u8; _] |
102 | 356..357 'f': [&[u8]; _] | 102 | 355..356 'f': [&[u8]; _] |
103 | 371..379 '[arr; 2]': [&[u8]; _] | 103 | 370..378 '[arr; 2]': [&[u8]; _] |
104 | 372..375 'arr': &[u8; _] | 104 | 371..374 'arr': &[u8; _] |
105 | 377..378 '2': usize | 105 | 376..377 '2': usize |
106 | 389..390 'g': (&[u8], &[u8]) | 106 | 388..389 'g': (&[u8], &[u8]) |
107 | 407..417 '(arr, arr)': (&[u8], &[u8]) | 107 | 406..416 '(arr, arr)': (&[u8], &[u8]) |
108 | 408..411 'arr': &[u8; _] | 108 | 407..410 'arr': &[u8; _] |
109 | 413..416 'arr': &[u8; _] | 109 | 412..415 'arr': &[u8; _] |
110 | "### | 110 | "### |
111 | ); | 111 | ); |
112 | } | 112 | } |
@@ -121,15 +121,15 @@ fn test() { | |||
121 | } | 121 | } |
122 | "#), | 122 | "#), |
123 | @r###" | 123 | @r###" |
124 | 11..76 '{ ...[1]; }': () | 124 | 10..75 '{ ...[1]; }': () |
125 | 21..22 'x': &[isize] | 125 | 20..21 'x': &[isize] |
126 | 35..39 '&[1]': &[isize; _] | 126 | 34..38 '&[1]': &[isize; _] |
127 | 36..39 '[1]': [isize; _] | 127 | 35..38 '[1]': [isize; _] |
128 | 37..38 '1': isize | 128 | 36..37 '1': isize |
129 | 49..50 'x': *const [isize] | 129 | 48..49 'x': *const [isize] |
130 | 69..73 '&[1]': &[isize; _] | 130 | 68..72 '&[1]': &[isize; _] |
131 | 70..73 '[1]': [isize; _] | 131 | 69..72 '[1]': [isize; _] |
132 | 71..72 '1': isize | 132 | 70..71 '1': isize |
133 | "###); | 133 | "###); |
134 | } | 134 | } |
135 | 135 | ||
@@ -155,31 +155,31 @@ fn test(a: A<[u8; 2]>, b: B<[u8; 2]>, c: C<[u8; 2]>) { | |||
155 | } | 155 | } |
156 | "#), | 156 | "#), |
157 | @r###" | 157 | @r###" |
158 | 258..259 'x': A<[T]> | 158 | 257..258 'x': A<[T]> |
159 | 279..284 '{ x }': A<[T]> | 159 | 278..283 '{ x }': A<[T]> |
160 | 281..282 'x': A<[T]> | 160 | 280..281 'x': A<[T]> |
161 | 296..297 'x': B<[T]> | 161 | 295..296 'x': B<[T]> |
162 | 317..322 '{ x }': B<[T]> | 162 | 316..321 '{ x }': B<[T]> |
163 | 319..320 'x': B<[T]> | 163 | 318..319 'x': B<[T]> |
164 | 334..335 'x': C<[T]> | 164 | 333..334 'x': C<[T]> |
165 | 355..360 '{ x }': C<[T]> | 165 | 354..359 '{ x }': C<[T]> |
166 | 357..358 'x': C<[T]> | 166 | 356..357 'x': C<[T]> |
167 | 370..371 'a': A<[u8; _]> | 167 | 369..370 'a': A<[u8; _]> |
168 | 385..386 'b': B<[u8; _]> | 168 | 384..385 'b': B<[u8; _]> |
169 | 400..401 'c': C<[u8; _]> | 169 | 399..400 'c': C<[u8; _]> |
170 | 415..481 '{ ...(c); }': () | 170 | 414..480 '{ ...(c); }': () |
171 | 425..426 'd': A<[{unknown}]> | 171 | 424..425 'd': A<[{unknown}]> |
172 | 429..433 'foo1': fn foo1<{unknown}>(A<[{unknown}]>) -> A<[{unknown}]> | 172 | 428..432 'foo1': fn foo1<{unknown}>(A<[{unknown}]>) -> A<[{unknown}]> |
173 | 429..436 'foo1(a)': A<[{unknown}]> | 173 | 428..435 'foo1(a)': A<[{unknown}]> |
174 | 434..435 'a': A<[u8; _]> | 174 | 433..434 'a': A<[u8; _]> |
175 | 446..447 'e': B<[u8]> | 175 | 445..446 'e': B<[u8]> |
176 | 450..454 'foo2': fn foo2<u8>(B<[u8]>) -> B<[u8]> | 176 | 449..453 'foo2': fn foo2<u8>(B<[u8]>) -> B<[u8]> |
177 | 450..457 'foo2(b)': B<[u8]> | 177 | 449..456 'foo2(b)': B<[u8]> |
178 | 455..456 'b': B<[u8; _]> | 178 | 454..455 'b': B<[u8; _]> |
179 | 467..468 'f': C<[u8]> | 179 | 466..467 'f': C<[u8]> |
180 | 471..475 'foo3': fn foo3<u8>(C<[u8]>) -> C<[u8]> | 180 | 470..474 'foo3': fn foo3<u8>(C<[u8]>) -> C<[u8]> |
181 | 471..478 'foo3(c)': C<[u8]> | 181 | 470..477 'foo3(c)': C<[u8]> |
182 | 476..477 'c': C<[u8; _]> | 182 | 475..476 'c': C<[u8; _]> |
183 | "### | 183 | "### |
184 | ); | 184 | ); |
185 | } | 185 | } |
@@ -198,24 +198,24 @@ fn test() { | |||
198 | } | 198 | } |
199 | "#), | 199 | "#), |
200 | @r###" | 200 | @r###" |
201 | 11..12 'x': &[T] | 201 | 10..11 'x': &[T] |
202 | 28..39 '{ loop {} }': &[T] | 202 | 27..38 '{ loop {} }': &[T] |
203 | 30..37 'loop {}': ! | 203 | 29..36 'loop {}': ! |
204 | 35..37 '{}': () | 204 | 34..36 '{}': () |
205 | 50..126 '{ ... }; }': () | 205 | 49..125 '{ ... }; }': () |
206 | 60..61 'x': &[i32] | 206 | 59..60 'x': &[i32] |
207 | 64..123 'if tru... }': &[i32] | 207 | 63..122 'if tru... }': &[i32] |
208 | 67..71 'true': bool | 208 | 66..70 'true': bool |
209 | 72..97 '{ ... }': &[i32] | 209 | 71..96 '{ ... }': &[i32] |
210 | 82..85 'foo': fn foo<i32>(&[i32]) -> &[i32] | 210 | 81..84 'foo': fn foo<i32>(&[i32]) -> &[i32] |
211 | 82..91 'foo(&[1])': &[i32] | 211 | 81..90 'foo(&[1])': &[i32] |
212 | 86..90 '&[1]': &[i32; _] | 212 | 85..89 '&[1]': &[i32; _] |
213 | 87..90 '[1]': [i32; _] | 213 | 86..89 '[1]': [i32; _] |
214 | 88..89 '1': i32 | 214 | 87..88 '1': i32 |
215 | 103..123 '{ ... }': &[i32; _] | 215 | 102..122 '{ ... }': &[i32; _] |
216 | 113..117 '&[1]': &[i32; _] | 216 | 112..116 '&[1]': &[i32; _] |
217 | 114..117 '[1]': [i32; _] | 217 | 113..116 '[1]': [i32; _] |
218 | 115..116 '1': i32 | 218 | 114..115 '1': i32 |
219 | "### | 219 | "### |
220 | ); | 220 | ); |
221 | } | 221 | } |
@@ -234,24 +234,24 @@ fn test() { | |||
234 | } | 234 | } |
235 | "#), | 235 | "#), |
236 | @r###" | 236 | @r###" |
237 | 11..12 'x': &[T] | 237 | 10..11 'x': &[T] |
238 | 28..39 '{ loop {} }': &[T] | 238 | 27..38 '{ loop {} }': &[T] |
239 | 30..37 'loop {}': ! | 239 | 29..36 'loop {}': ! |
240 | 35..37 '{}': () | 240 | 34..36 '{}': () |
241 | 50..126 '{ ... }; }': () | 241 | 49..125 '{ ... }; }': () |
242 | 60..61 'x': &[i32] | 242 | 59..60 'x': &[i32] |
243 | 64..123 'if tru... }': &[i32] | 243 | 63..122 'if tru... }': &[i32] |
244 | 67..71 'true': bool | 244 | 66..70 'true': bool |
245 | 72..92 '{ ... }': &[i32; _] | 245 | 71..91 '{ ... }': &[i32; _] |
246 | 82..86 '&[1]': &[i32; _] | 246 | 81..85 '&[1]': &[i32; _] |
247 | 83..86 '[1]': [i32; _] | 247 | 82..85 '[1]': [i32; _] |
248 | 84..85 '1': i32 | 248 | 83..84 '1': i32 |
249 | 98..123 '{ ... }': &[i32] | 249 | 97..122 '{ ... }': &[i32] |
250 | 108..111 'foo': fn foo<i32>(&[i32]) -> &[i32] | 250 | 107..110 'foo': fn foo<i32>(&[i32]) -> &[i32] |
251 | 108..117 'foo(&[1])': &[i32] | 251 | 107..116 'foo(&[1])': &[i32] |
252 | 112..116 '&[1]': &[i32; _] | 252 | 111..115 '&[1]': &[i32; _] |
253 | 113..116 '[1]': [i32; _] | 253 | 112..115 '[1]': [i32; _] |
254 | 114..115 '1': i32 | 254 | 113..114 '1': i32 |
255 | "### | 255 | "### |
256 | ); | 256 | ); |
257 | } | 257 | } |
@@ -270,31 +270,31 @@ fn test(i: i32) { | |||
270 | } | 270 | } |
271 | "#), | 271 | "#), |
272 | @r###" | 272 | @r###" |
273 | 11..12 'x': &[T] | 273 | 10..11 'x': &[T] |
274 | 28..39 '{ loop {} }': &[T] | 274 | 27..38 '{ loop {} }': &[T] |
275 | 30..37 'loop {}': ! | 275 | 29..36 'loop {}': ! |
276 | 35..37 '{}': () | 276 | 34..36 '{}': () |
277 | 48..49 'i': i32 | 277 | 47..48 'i': i32 |
278 | 56..150 '{ ... }; }': () | 278 | 55..149 '{ ... }; }': () |
279 | 66..67 'x': &[i32] | 279 | 65..66 'x': &[i32] |
280 | 70..147 'match ... }': &[i32] | 280 | 69..146 'match ... }': &[i32] |
281 | 76..77 'i': i32 | 281 | 75..76 'i': i32 |
282 | 88..89 '2': i32 | 282 | 87..88 '2': i32 |
283 | 88..89 '2': i32 | 283 | 87..88 '2': i32 |
284 | 93..96 'foo': fn foo<i32>(&[i32]) -> &[i32] | 284 | 92..95 'foo': fn foo<i32>(&[i32]) -> &[i32] |
285 | 93..102 'foo(&[2])': &[i32] | 285 | 92..101 'foo(&[2])': &[i32] |
286 | 97..101 '&[2]': &[i32; _] | 286 | 96..100 '&[2]': &[i32; _] |
287 | 98..101 '[2]': [i32; _] | 287 | 97..100 '[2]': [i32; _] |
288 | 99..100 '2': i32 | 288 | 98..99 '2': i32 |
289 | 112..113 '1': i32 | 289 | 111..112 '1': i32 |
290 | 112..113 '1': i32 | 290 | 111..112 '1': i32 |
291 | 117..121 '&[1]': &[i32; _] | 291 | 116..120 '&[1]': &[i32; _] |
292 | 118..121 '[1]': [i32; _] | 292 | 117..120 '[1]': [i32; _] |
293 | 119..120 '1': i32 | 293 | 118..119 '1': i32 |
294 | 131..132 '_': i32 | 294 | 130..131 '_': i32 |
295 | 136..140 '&[3]': &[i32; _] | 295 | 135..139 '&[3]': &[i32; _] |
296 | 137..140 '[3]': [i32; _] | 296 | 136..139 '[3]': [i32; _] |
297 | 138..139 '3': i32 | 297 | 137..138 '3': i32 |
298 | "### | 298 | "### |
299 | ); | 299 | ); |
300 | } | 300 | } |
@@ -313,31 +313,31 @@ fn test(i: i32) { | |||
313 | } | 313 | } |
314 | "#), | 314 | "#), |
315 | @r###" | 315 | @r###" |
316 | 11..12 'x': &[T] | 316 | 10..11 'x': &[T] |
317 | 28..39 '{ loop {} }': &[T] | 317 | 27..38 '{ loop {} }': &[T] |
318 | 30..37 'loop {}': ! | 318 | 29..36 'loop {}': ! |
319 | 35..37 '{}': () | 319 | 34..36 '{}': () |
320 | 48..49 'i': i32 | 320 | 47..48 'i': i32 |
321 | 56..150 '{ ... }; }': () | 321 | 55..149 '{ ... }; }': () |
322 | 66..67 'x': &[i32] | 322 | 65..66 'x': &[i32] |
323 | 70..147 'match ... }': &[i32] | 323 | 69..146 'match ... }': &[i32] |
324 | 76..77 'i': i32 | 324 | 75..76 'i': i32 |
325 | 88..89 '1': i32 | 325 | 87..88 '1': i32 |
326 | 88..89 '1': i32 | 326 | 87..88 '1': i32 |
327 | 93..97 '&[1]': &[i32; _] | 327 | 92..96 '&[1]': &[i32; _] |
328 | 94..97 '[1]': [i32; _] | 328 | 93..96 '[1]': [i32; _] |
329 | 95..96 '1': i32 | 329 | 94..95 '1': i32 |
330 | 107..108 '2': i32 | 330 | 106..107 '2': i32 |
331 | 107..108 '2': i32 | 331 | 106..107 '2': i32 |
332 | 112..115 'foo': fn foo<i32>(&[i32]) -> &[i32] | 332 | 111..114 'foo': fn foo<i32>(&[i32]) -> &[i32] |
333 | 112..121 'foo(&[2])': &[i32] | 333 | 111..120 'foo(&[2])': &[i32] |
334 | 116..120 '&[2]': &[i32; _] | 334 | 115..119 '&[2]': &[i32; _] |
335 | 117..120 '[2]': [i32; _] | 335 | 116..119 '[2]': [i32; _] |
336 | 118..119 '2': i32 | 336 | 117..118 '2': i32 |
337 | 131..132 '_': i32 | 337 | 130..131 '_': i32 |
338 | 136..140 '&[3]': &[i32; _] | 338 | 135..139 '&[3]': &[i32; _] |
339 | 137..140 '[3]': [i32; _] | 339 | 136..139 '[3]': [i32; _] |
340 | 138..139 '3': i32 | 340 | 137..138 '3': i32 |
341 | "### | 341 | "### |
342 | ); | 342 | ); |
343 | } | 343 | } |
@@ -358,24 +358,24 @@ fn test() { | |||
358 | } | 358 | } |
359 | "#), | 359 | "#), |
360 | @r###" | 360 | @r###" |
361 | 11..145 '{ ... }; }': () | 361 | 10..144 '{ ... }; }': () |
362 | 21..22 't': &mut i32 | 362 | 20..21 't': &mut i32 |
363 | 25..31 '&mut 1': &mut i32 | 363 | 24..30 '&mut 1': &mut i32 |
364 | 30..31 '1': i32 | 364 | 29..30 '1': i32 |
365 | 41..42 'x': *const i32 | 365 | 40..41 'x': *const i32 |
366 | 45..142 'match ... }': *const i32 | 366 | 44..141 'match ... }': *const i32 |
367 | 51..52 '1': i32 | 367 | 50..51 '1': i32 |
368 | 63..64 '1': i32 | 368 | 62..63 '1': i32 |
369 | 63..64 '1': i32 | 369 | 62..63 '1': i32 |
370 | 68..69 't': &mut i32 | 370 | 67..68 't': &mut i32 |
371 | 68..81 't as *mut i32': *mut i32 | 371 | 67..80 't as *mut i32': *mut i32 |
372 | 91..92 '2': i32 | 372 | 90..91 '2': i32 |
373 | 91..92 '2': i32 | 373 | 90..91 '2': i32 |
374 | 96..97 't': &mut i32 | 374 | 95..96 't': &mut i32 |
375 | 96..105 't as &i32': &i32 | 375 | 95..104 't as &i32': &i32 |
376 | 115..116 '_': i32 | 376 | 114..115 '_': i32 |
377 | 120..121 't': &mut i32 | 377 | 119..120 't': &mut i32 |
378 | 120..135 't as *const i32': *const i32 | 378 | 119..134 't as *const i32': *const i32 |
379 | "### | 379 | "### |
380 | ); | 380 | ); |
381 | } | 381 | } |
@@ -389,9 +389,9 @@ fn foo() -> u32 { | |||
389 | } | 389 | } |
390 | "#, true), | 390 | "#, true), |
391 | @r###" | 391 | @r###" |
392 | 17..40 '{ ...own; }': u32 | 392 | 16..39 '{ ...own; }': u32 |
393 | 23..37 'return unknown': ! | 393 | 22..36 'return unknown': ! |
394 | 30..37 'unknown': u32 | 394 | 29..36 'unknown': u32 |
395 | "### | 395 | "### |
396 | ); | 396 | ); |
397 | } | 397 | } |
@@ -409,24 +409,24 @@ fn test() { | |||
409 | } | 409 | } |
410 | "#, true), | 410 | "#, true), |
411 | @r###" | 411 | @r###" |
412 | 30..31 'x': &Foo | 412 | 29..30 'x': &Foo |
413 | 39..41 '{}': () | 413 | 38..40 '{}': () |
414 | 52..133 '{ ...oo); }': () | 414 | 51..132 '{ ...oo); }': () |
415 | 58..71 'takes_ref_foo': fn takes_ref_foo(&Foo) | 415 | 57..70 'takes_ref_foo': fn takes_ref_foo(&Foo) |
416 | 58..77 'takes_...(&Foo)': () | 416 | 57..76 'takes_...(&Foo)': () |
417 | 72..76 '&Foo': &Foo | 417 | 71..75 '&Foo': &Foo |
418 | 73..76 'Foo': Foo | 418 | 72..75 'Foo': Foo |
419 | 83..96 'takes_ref_foo': fn takes_ref_foo(&Foo) | 419 | 82..95 'takes_ref_foo': fn takes_ref_foo(&Foo) |
420 | 83..103 'takes_...&&Foo)': () | 420 | 82..102 'takes_...&&Foo)': () |
421 | 97..102 '&&Foo': &&Foo | 421 | 96..101 '&&Foo': &&Foo |
422 | 98..102 '&Foo': &Foo | 422 | 97..101 '&Foo': &Foo |
423 | 99..102 'Foo': Foo | 423 | 98..101 'Foo': Foo |
424 | 109..122 'takes_ref_foo': fn takes_ref_foo(&Foo) | 424 | 108..121 'takes_ref_foo': fn takes_ref_foo(&Foo) |
425 | 109..130 'takes_...&&Foo)': () | 425 | 108..129 'takes_...&&Foo)': () |
426 | 123..129 '&&&Foo': &&&Foo | 426 | 122..128 '&&&Foo': &&&Foo |
427 | 124..129 '&&Foo': &&Foo | 427 | 123..128 '&&Foo': &&Foo |
428 | 125..129 '&Foo': &Foo | 428 | 124..128 '&Foo': &Foo |
429 | 126..129 'Foo': Foo | 429 | 125..128 'Foo': Foo |
430 | "### | 430 | "### |
431 | ); | 431 | ); |
432 | } | 432 | } |
@@ -444,26 +444,26 @@ fn test() { | |||
444 | } | 444 | } |
445 | "#, true), | 445 | "#, true), |
446 | @r###" | 446 | @r###" |
447 | 29..30 'x': &T | 447 | 28..29 'x': &T |
448 | 41..47 '{ *x }': T | 448 | 40..46 '{ *x }': T |
449 | 43..45 '*x': T | 449 | 42..44 '*x': T |
450 | 44..45 'x': &T | 450 | 43..44 'x': &T |
451 | 58..127 '{ ...oo); }': () | 451 | 57..126 '{ ...oo); }': () |
452 | 64..73 'takes_ref': fn takes_ref<Foo>(&Foo) -> Foo | 452 | 63..72 'takes_ref': fn takes_ref<Foo>(&Foo) -> Foo |
453 | 64..79 'takes_ref(&Foo)': Foo | 453 | 63..78 'takes_ref(&Foo)': Foo |
454 | 74..78 '&Foo': &Foo | 454 | 73..77 '&Foo': &Foo |
455 | 75..78 'Foo': Foo | 455 | 74..77 'Foo': Foo |
456 | 85..94 'takes_ref': fn takes_ref<&Foo>(&&Foo) -> &Foo | 456 | 84..93 'takes_ref': fn takes_ref<&Foo>(&&Foo) -> &Foo |
457 | 85..101 'takes_...&&Foo)': &Foo | 457 | 84..100 'takes_...&&Foo)': &Foo |
458 | 95..100 '&&Foo': &&Foo | 458 | 94..99 '&&Foo': &&Foo |
459 | 96..100 '&Foo': &Foo | 459 | 95..99 '&Foo': &Foo |
460 | 97..100 'Foo': Foo | 460 | 96..99 'Foo': Foo |
461 | 107..116 'takes_ref': fn takes_ref<&&Foo>(&&&Foo) -> &&Foo | 461 | 106..115 'takes_ref': fn takes_ref<&&Foo>(&&&Foo) -> &&Foo |
462 | 107..124 'takes_...&&Foo)': &&Foo | 462 | 106..123 'takes_...&&Foo)': &&Foo |
463 | 117..123 '&&&Foo': &&&Foo | 463 | 116..122 '&&&Foo': &&&Foo |
464 | 118..123 '&&Foo': &&Foo | 464 | 117..122 '&&Foo': &&Foo |
465 | 119..123 '&Foo': &Foo | 465 | 118..122 '&Foo': &Foo |
466 | 120..123 'Foo': Foo | 466 | 119..122 'Foo': Foo |
467 | "### | 467 | "### |
468 | ); | 468 | ); |
469 | } | 469 | } |
@@ -483,18 +483,18 @@ fn test() { | |||
483 | } | 483 | } |
484 | "#, true), | 484 | "#, true), |
485 | @r###" | 485 | @r###" |
486 | 127..128 'x': &str | 486 | 126..127 'x': &str |
487 | 136..138 '{}': () | 487 | 135..137 '{}': () |
488 | 169..180 '{ loop {} }': String | 488 | 168..179 '{ loop {} }': String |
489 | 171..178 'loop {}': ! | 489 | 170..177 'loop {}': ! |
490 | 176..178 '{}': () | 490 | 175..177 '{}': () |
491 | 191..236 '{ ... }); }': () | 491 | 190..235 '{ ... }); }': () |
492 | 197..210 'takes_ref_str': fn takes_ref_str(&str) | 492 | 196..209 'takes_ref_str': fn takes_ref_str(&str) |
493 | 197..233 'takes_...g() })': () | 493 | 196..232 'takes_...g() })': () |
494 | 211..232 '&{ ret...ng() }': &String | 494 | 210..231 '&{ ret...ng() }': &String |
495 | 212..232 '{ retu...ng() }': String | 495 | 211..231 '{ retu...ng() }': String |
496 | 214..228 'returns_string': fn returns_string() -> String | 496 | 213..227 'returns_string': fn returns_string() -> String |
497 | 214..230 'return...ring()': String | 497 | 213..229 'return...ring()': String |
498 | "### | 498 | "### |
499 | ); | 499 | ); |
500 | } | 500 | } |
@@ -513,19 +513,19 @@ fn foo() { | |||
513 | } | 513 | } |
514 | "#, true), | 514 | "#, true), |
515 | @r###" | 515 | @r###" |
516 | 10..106 '{ ... }; }': () | 516 | 9..105 '{ ... }; }': () |
517 | 20..21 'x': || -> &u32 | 517 | 19..20 'x': || -> &u32 |
518 | 24..103 '|| { ... }': || -> &u32 | 518 | 23..102 '|| { ... }': || -> &u32 |
519 | 27..103 '{ ... }': &u32 | 519 | 26..102 '{ ... }': &u32 |
520 | 37..82 'if tru... }': () | 520 | 36..81 'if tru... }': () |
521 | 40..44 'true': bool | 521 | 39..43 'true': bool |
522 | 45..82 '{ ... }': () | 522 | 44..81 '{ ... }': () |
523 | 59..71 'return &1u32': ! | 523 | 58..70 'return &1u32': ! |
524 | 66..71 '&1u32': &u32 | 524 | 65..70 '&1u32': &u32 |
525 | 67..71 '1u32': u32 | 525 | 66..70 '1u32': u32 |
526 | 91..97 '&&1u32': &&u32 | 526 | 90..96 '&&1u32': &&u32 |
527 | 92..97 '&1u32': &u32 | 527 | 91..96 '&1u32': &u32 |
528 | 93..97 '1u32': u32 | 528 | 92..96 '1u32': u32 |
529 | "### | 529 | "### |
530 | ); | 530 | ); |
531 | } | 531 | } |
@@ -540,12 +540,12 @@ fn test() { | |||
540 | } | 540 | } |
541 | "#, true), | 541 | "#, true), |
542 | @r###" | 542 | @r###" |
543 | 8..9 'x': u32 | 543 | 7..8 'x': u32 |
544 | 25..30 '{ 1 }': isize | 544 | 24..29 '{ 1 }': isize |
545 | 27..28 '1': isize | 545 | 26..27 '1': isize |
546 | 41..79 '{ ...foo; }': () | 546 | 40..78 '{ ...foo; }': () |
547 | 51..52 'f': fn(u32) -> isize | 547 | 50..51 'f': fn(u32) -> isize |
548 | 73..76 'foo': fn foo(u32) -> isize | 548 | 72..75 'foo': fn foo(u32) -> isize |
549 | "### | 549 | "### |
550 | ); | 550 | ); |
551 | } | 551 | } |
@@ -567,27 +567,27 @@ fn test() { | |||
567 | } | 567 | } |
568 | "#, true), | 568 | "#, true), |
569 | @r###" | 569 | @r###" |
570 | 9..10 'x': u32 | 570 | 8..9 'x': u32 |
571 | 26..31 '{ 1 }': isize | 571 | 25..30 '{ 1 }': isize |
572 | 28..29 '1': isize | 572 | 27..28 '1': isize |
573 | 40..41 'x': u32 | 573 | 39..40 'x': u32 |
574 | 57..62 '{ 2 }': isize | 574 | 56..61 '{ 2 }': isize |
575 | 59..60 '2': isize | 575 | 58..59 '2': isize |
576 | 71..72 'x': u32 | 576 | 70..71 'x': u32 |
577 | 88..93 '{ 3 }': isize | 577 | 87..92 '{ 3 }': isize |
578 | 90..91 '3': isize | 578 | 89..90 '3': isize |
579 | 104..193 '{ ... }; }': () | 579 | 103..192 '{ ... }; }': () |
580 | 114..115 'x': fn(u32) -> isize | 580 | 113..114 'x': fn(u32) -> isize |
581 | 118..190 'match ... }': fn(u32) -> isize | 581 | 117..189 'match ... }': fn(u32) -> isize |
582 | 124..125 '1': i32 | 582 | 123..124 '1': i32 |
583 | 136..137 '1': i32 | 583 | 135..136 '1': i32 |
584 | 136..137 '1': i32 | 584 | 135..136 '1': i32 |
585 | 141..145 'foo1': fn foo1(u32) -> isize | 585 | 140..144 'foo1': fn foo1(u32) -> isize |
586 | 155..156 '2': i32 | 586 | 154..155 '2': i32 |
587 | 155..156 '2': i32 | 587 | 154..155 '2': i32 |
588 | 160..164 'foo2': fn foo2(u32) -> isize | 588 | 159..163 'foo2': fn foo2(u32) -> isize |
589 | 174..175 '_': i32 | 589 | 173..174 '_': i32 |
590 | 179..183 'foo3': fn foo3(u32) -> isize | 590 | 178..182 'foo3': fn foo3(u32) -> isize |
591 | "### | 591 | "### |
592 | ); | 592 | ); |
593 | } | 593 | } |
@@ -601,12 +601,12 @@ fn test() { | |||
601 | } | 601 | } |
602 | "#, true), | 602 | "#, true), |
603 | @r###" | 603 | @r###" |
604 | 11..55 '{ ...1 }; }': () | 604 | 10..54 '{ ...1 }; }': () |
605 | 21..22 'f': fn(u32) -> isize | 605 | 20..21 'f': fn(u32) -> isize |
606 | 43..52 '|x| { 1 }': |u32| -> isize | 606 | 42..51 '|x| { 1 }': |u32| -> isize |
607 | 44..45 'x': u32 | 607 | 43..44 'x': u32 |
608 | 47..52 '{ 1 }': isize | 608 | 46..51 '{ 1 }': isize |
609 | 49..50 '1': isize | 609 | 48..49 '1': isize |
610 | "### | 610 | "### |
611 | ); | 611 | ); |
612 | } | 612 | } |
@@ -624,11 +624,11 @@ impl<TT> S<TT> { | |||
624 | } | 624 | } |
625 | "#, true), | 625 | "#, true), |
626 | @r###" | 626 | @r###" |
627 | 51..55 'self': &S<TT> | 627 | 50..54 'self': &S<TT> |
628 | 64..87 '{ ... }': &TT | 628 | 63..86 '{ ... }': &TT |
629 | 74..81 '&self.t': &TT | 629 | 73..80 '&self.t': &TT |
630 | 75..79 'self': &S<TT> | 630 | 74..78 'self': &S<TT> |
631 | 75..81 'self.t': TT | 631 | 74..80 'self.t': TT |
632 | "### | 632 | "### |
633 | ); | 633 | ); |
634 | } | 634 | } |
@@ -649,13 +649,13 @@ fn test() { | |||
649 | } | 649 | } |
650 | "#, true), | 650 | "#, true), |
651 | @r###" | 651 | @r###" |
652 | 162..199 '{ ... 3]; }': () | 652 | 161..198 '{ ... 3]; }': () |
653 | 172..173 'f': &[usize] | 653 | 171..172 'f': &[usize] |
654 | 186..196 '&[1, 2, 3]': &[usize; _] | 654 | 185..195 '&[1, 2, 3]': &[usize; _] |
655 | 187..196 '[1, 2, 3]': [usize; _] | 655 | 186..195 '[1, 2, 3]': [usize; _] |
656 | 188..189 '1': usize | 656 | 187..188 '1': usize |
657 | 191..192 '2': usize | 657 | 190..191 '2': usize |
658 | 194..195 '3': usize | 658 | 193..194 '3': usize |
659 | "### | 659 | "### |
660 | ); | 660 | ); |
661 | } | 661 | } |
@@ -689,19 +689,19 @@ fn test() { | |||
689 | } | 689 | } |
690 | "#, true), | 690 | "#, true), |
691 | @r###" | 691 | @r###" |
692 | 388..573 '{ ...bj2; }': () | 692 | 387..572 '{ ...bj2; }': () |
693 | 398..401 'obj': &dyn Baz<i8, i16> | 693 | 397..400 'obj': &dyn Baz<i8, i16> |
694 | 423..425 '&S': &S<i8, i16> | 694 | 422..424 '&S': &S<i8, i16> |
695 | 424..425 'S': S<i8, i16> | 695 | 423..424 'S': S<i8, i16> |
696 | 435..438 'obj': &dyn Bar<usize, i8, i16> | 696 | 434..437 'obj': &dyn Bar<usize, i8, i16> |
697 | 460..463 'obj': &dyn Baz<i8, i16> | 697 | 459..462 'obj': &dyn Baz<i8, i16> |
698 | 473..476 'obj': &dyn Foo<i8, usize> | 698 | 472..475 'obj': &dyn Foo<i8, usize> |
699 | 495..498 'obj': &dyn Bar<usize, i8, i16> | 699 | 494..497 'obj': &dyn Bar<usize, i8, i16> |
700 | 508..512 'obj2': &dyn Baz<i8, i16> | 700 | 507..511 'obj2': &dyn Baz<i8, i16> |
701 | 534..536 '&S': &S<i8, i16> | 701 | 533..535 '&S': &S<i8, i16> |
702 | 535..536 'S': S<i8, i16> | 702 | 534..535 'S': S<i8, i16> |
703 | 546..547 '_': &dyn Foo<i8, usize> | 703 | 545..546 '_': &dyn Foo<i8, usize> |
704 | 566..570 'obj2': &dyn Baz<i8, i16> | 704 | 565..569 'obj2': &dyn Baz<i8, i16> |
705 | "### | 705 | "### |
706 | ); | 706 | ); |
707 | } | 707 | } |
@@ -734,12 +734,12 @@ fn test() { | |||
734 | } | 734 | } |
735 | "#, true), | 735 | "#, true), |
736 | @r###" | 736 | @r###" |
737 | 292..348 '{ ...obj; }': () | 737 | 291..347 '{ ...obj; }': () |
738 | 302..305 'obj': &dyn D | 738 | 301..304 'obj': &dyn D |
739 | 316..318 '&S': &S | 739 | 315..317 '&S': &S |
740 | 317..318 'S': S | 740 | 316..317 'S': S |
741 | 328..331 'obj': &dyn A | 741 | 327..330 'obj': &dyn A |
742 | 342..345 'obj': &dyn D | 742 | 341..344 'obj': &dyn D |
743 | "### | 743 | "### |
744 | ); | 744 | ); |
745 | } | 745 | } |
diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/ra_hir_ty/src/tests/macros.rs index 4c6099aa2..be2b48dcc 100644 --- a/crates/ra_hir_ty/src/tests/macros.rs +++ b/crates/ra_hir_ty/src/tests/macros.rs | |||
@@ -71,8 +71,8 @@ fn main() { | |||
71 | !1..4 'Foo': Foo({unknown}) -> Foo | 71 | !1..4 'Foo': Foo({unknown}) -> Foo |
72 | !1..16 'Foo(vec![1,2,])': Foo | 72 | !1..16 'Foo(vec![1,2,])': Foo |
73 | !5..15 'vec![1,2,]': {unknown} | 73 | !5..15 'vec![1,2,]': {unknown} |
74 | 156..182 '{ ...,2); }': () | 74 | 155..181 '{ ...,2); }': () |
75 | 166..167 'x': Foo | 75 | 165..166 'x': Foo |
76 | "### | 76 | "### |
77 | ); | 77 | ); |
78 | } | 78 | } |
@@ -104,10 +104,10 @@ fn main() { | |||
104 | !1..4 'Foo': Foo({unknown}) -> Foo | 104 | !1..4 'Foo': Foo({unknown}) -> Foo |
105 | !1..16 'Foo(vec![1,2,])': Foo | 105 | !1..16 'Foo(vec![1,2,])': Foo |
106 | !5..15 'vec![1,2,]': {unknown} | 106 | !5..15 'vec![1,2,]': {unknown} |
107 | 195..251 '{ ...,2); }': () | 107 | 194..250 '{ ...,2); }': () |
108 | 205..206 'x': Foo | 108 | 204..205 'x': Foo |
109 | 228..229 'y': {unknown} | 109 | 227..228 'y': {unknown} |
110 | 232..248 'crate:...!(1,2)': {unknown} | 110 | 231..247 'crate:...!(1,2)': {unknown} |
111 | "### | 111 | "### |
112 | ); | 112 | ); |
113 | } | 113 | } |
@@ -133,9 +133,9 @@ fn main() { | |||
133 | @r###" | 133 | @r###" |
134 | !0..5 '42i32': i32 | 134 | !0..5 '42i32': i32 |
135 | !0..5 '42i32': i32 | 135 | !0..5 '42i32': i32 |
136 | 111..164 '{ ...!(); }': () | 136 | 110..163 '{ ...!(); }': () |
137 | 121..122 'x': i32 | 137 | 120..121 'x': i32 |
138 | 148..149 'y': i32 | 138 | 147..148 'y': i32 |
139 | "### | 139 | "### |
140 | ); | 140 | ); |
141 | } | 141 | } |
@@ -197,26 +197,26 @@ fn spam() { | |||
197 | !0..6 '1isize': isize | 197 | !0..6 '1isize': isize |
198 | !0..6 '1isize': isize | 198 | !0..6 '1isize': isize |
199 | !0..6 '1isize': isize | 199 | !0..6 '1isize': isize |
200 | 54..457 '{ ...!(); }': () | 200 | 53..456 '{ ...!(); }': () |
201 | 88..109 'spam!(...am!())': {unknown} | 201 | 87..108 'spam!(...am!())': {unknown} |
202 | 115..134 'for _ ...!() {}': () | 202 | 114..133 'for _ ...!() {}': () |
203 | 119..120 '_': {unknown} | 203 | 118..119 '_': {unknown} |
204 | 132..134 '{}': () | 204 | 131..133 '{}': () |
205 | 139..149 '|| spam!()': || -> isize | 205 | 138..148 '|| spam!()': || -> isize |
206 | 155..171 'while ...!() {}': () | 206 | 154..170 'while ...!() {}': () |
207 | 169..171 '{}': () | 207 | 168..170 '{}': () |
208 | 176..189 'break spam!()': ! | 208 | 175..188 'break spam!()': ! |
209 | 195..209 'return spam!()': ! | 209 | 194..208 'return spam!()': ! |
210 | 215..269 'match ... }': isize | 210 | 214..268 'match ... }': isize |
211 | 239..240 '_': isize | 211 | 238..239 '_': isize |
212 | 274..290 'spam!(...am!())': {unknown} | 212 | 273..289 'spam!(...am!())': {unknown} |
213 | 296..318 'Spam {...m!() }': {unknown} | 213 | 295..317 'Spam {...m!() }': {unknown} |
214 | 324..340 'spam!(...am!()]': {unknown} | 214 | 323..339 'spam!(...am!()]': {unknown} |
215 | 365..381 'spam!(... usize': usize | 215 | 364..380 'spam!(... usize': usize |
216 | 387..395 '&spam!()': &isize | 216 | 386..394 '&spam!()': &isize |
217 | 401..409 '-spam!()': isize | 217 | 400..408 '-spam!()': isize |
218 | 415..431 'spam!(...pam!()': {unknown} | 218 | 414..430 'spam!(...pam!()': {unknown} |
219 | 437..454 'spam!(...pam!()': isize | 219 | 436..453 'spam!(...pam!()': isize |
220 | "### | 220 | "### |
221 | ); | 221 | ); |
222 | } | 222 | } |
@@ -245,8 +245,8 @@ fn foo() { | |||
245 | "#), | 245 | "#), |
246 | @r###" | 246 | @r###" |
247 | !0..5 '42i32': i32 | 247 | !0..5 '42i32': i32 |
248 | 171..206 '{ ...32); }': () | 248 | 170..205 '{ ...32); }': () |
249 | 181..184 'foo': i32 | 249 | 180..183 'foo': i32 |
250 | "### | 250 | "### |
251 | ); | 251 | ); |
252 | } | 252 | } |
@@ -397,12 +397,12 @@ fn main() { | |||
397 | } | 397 | } |
398 | "#), | 398 | "#), |
399 | @r###" | 399 | @r###" |
400 | 159..164 '{ 0 }': u64 | 400 | 158..163 '{ 0 }': u64 |
401 | 161..162 '0': u64 | 401 | 160..161 '0': u64 |
402 | 175..197 '{ ...f(); }': () | 402 | 174..196 '{ ...f(); }': () |
403 | 185..187 '_a': u64 | 403 | 184..186 '_a': u64 |
404 | 191..192 'f': fn f() -> u64 | 404 | 190..191 'f': fn f() -> u64 |
405 | 191..194 'f()': u64 | 405 | 190..193 'f()': u64 |
406 | "### | 406 | "### |
407 | ); | 407 | ); |
408 | } | 408 | } |
@@ -419,10 +419,10 @@ fn main() { | |||
419 | } | 419 | } |
420 | "#), | 420 | "#), |
421 | @r###" | 421 | @r###" |
422 | !0..6 '1usize': usize | 422 | !0..6 '1usize': usize |
423 | 11..90 '{ ...!(); }': () | 423 | 10..89 '{ ...!(); }': () |
424 | 17..66 'macro_... }': {unknown} | 424 | 16..65 'macro_... }': {unknown} |
425 | 75..77 '_a': usize | 425 | 74..76 '_a': usize |
426 | "### | 426 | "### |
427 | ); | 427 | ); |
428 | } | 428 | } |
@@ -466,8 +466,8 @@ fn main() { | |||
466 | "#), | 466 | "#), |
467 | @r###" | 467 | @r###" |
468 | !0..1 '0': i32 | 468 | !0..1 '0': i32 |
469 | 64..88 '{ ...!(); }': () | 469 | 63..87 '{ ...!(); }': () |
470 | 74..75 'x': i32 | 470 | 73..74 'x': i32 |
471 | "### | 471 | "### |
472 | ); | 472 | ); |
473 | } | 473 | } |
@@ -485,8 +485,8 @@ fn main() { | |||
485 | "#), | 485 | "#), |
486 | @r###" | 486 | @r###" |
487 | !0..2 '""': &str | 487 | !0..2 '""': &str |
488 | 64..88 '{ ...!(); }': () | 488 | 63..87 '{ ...!(); }': () |
489 | 74..75 'x': &str | 489 | 73..74 'x': &str |
490 | "### | 490 | "### |
491 | ); | 491 | ); |
492 | } | 492 | } |
@@ -504,8 +504,8 @@ fn main() { | |||
504 | "#), | 504 | "#), |
505 | @r###" | 505 | @r###" |
506 | !0..1 '0': i32 | 506 | !0..1 '0': i32 |
507 | 66..92 '{ ...!(); }': () | 507 | 65..91 '{ ...!(); }': () |
508 | 76..77 'x': i32 | 508 | 75..76 'x': i32 |
509 | "### | 509 | "### |
510 | ); | 510 | ); |
511 | } | 511 | } |
@@ -523,8 +523,8 @@ fn main() { | |||
523 | "#), | 523 | "#), |
524 | @r###" | 524 | @r###" |
525 | !0..13 '"helloworld!"': &str | 525 | !0..13 '"helloworld!"': &str |
526 | 66..122 '{ ...")); }': () | 526 | 65..121 '{ ...")); }': () |
527 | 76..77 'x': &str | 527 | 75..76 'x': &str |
528 | "### | 528 | "### |
529 | ); | 529 | ); |
530 | } | 530 | } |
@@ -658,8 +658,8 @@ fn main() { | |||
658 | "#), | 658 | "#), |
659 | @r###" | 659 | @r###" |
660 | !0..13 '"helloworld!"': &str | 660 | !0..13 '"helloworld!"': &str |
661 | 104..161 '{ ...")); }': () | 661 | 103..160 '{ ...")); }': () |
662 | 114..115 'x': &str | 662 | 113..114 'x': &str |
663 | "### | 663 | "### |
664 | ); | 664 | ); |
665 | } | 665 | } |
@@ -677,9 +677,9 @@ fn main() { | |||
677 | } | 677 | } |
678 | "#), | 678 | "#), |
679 | @r###" | 679 | @r###" |
680 | !0..5 '"bar"': &str | 680 | !0..22 '"__RA_...TED__"': &str |
681 | 88..116 '{ ...o"); }': () | 681 | 62..90 '{ ...o"); }': () |
682 | 98..99 'x': &str | 682 | 72..73 'x': &str |
683 | "### | 683 | "### |
684 | ); | 684 | ); |
685 | } | 685 | } |
@@ -794,12 +794,12 @@ fn main() { | |||
794 | } | 794 | } |
795 | "#), | 795 | "#), |
796 | @r###" | 796 | @r###" |
797 | 52..111 '{ ... }; }': () | 797 | 51..110 '{ ... }; }': () |
798 | 62..63 'x': u32 | 798 | 61..62 'x': u32 |
799 | 66..108 'match ... }': u32 | 799 | 65..107 'match ... }': u32 |
800 | 72..74 '()': () | 800 | 71..73 '()': () |
801 | 85..92 'unit!()': () | 801 | 84..91 'unit!()': () |
802 | 96..101 '92u32': u32 | 802 | 95..100 '92u32': u32 |
803 | "### | 803 | "### |
804 | ); | 804 | ); |
805 | } | 805 | } |
diff --git a/crates/ra_hir_ty/src/tests/method_resolution.rs b/crates/ra_hir_ty/src/tests/method_resolution.rs index a98efb1cc..20329bae4 100644 --- a/crates/ra_hir_ty/src/tests/method_resolution.rs +++ b/crates/ra_hir_ty/src/tests/method_resolution.rs | |||
@@ -22,15 +22,15 @@ fn test(x: &[u8]) { | |||
22 | } | 22 | } |
23 | "#), | 23 | "#), |
24 | @r###" | 24 | @r###" |
25 | 45..49 'self': &[T] | 25 | 44..48 'self': &[T] |
26 | 56..79 '{ ... }': T | 26 | 55..78 '{ ... }': T |
27 | 66..73 'loop {}': ! | 27 | 65..72 'loop {}': ! |
28 | 71..73 '{}': () | 28 | 70..72 '{}': () |
29 | 131..132 'x': &[u8] | 29 | 130..131 'x': &[u8] |
30 | 141..163 '{ ...(x); }': () | 30 | 140..162 '{ ...(x); }': () |
31 | 147..157 '<[_]>::foo': fn foo<u8>(&[u8]) -> u8 | 31 | 146..156 '<[_]>::foo': fn foo<u8>(&[u8]) -> u8 |
32 | 147..160 '<[_]>::foo(x)': u8 | 32 | 146..159 '<[_]>::foo(x)': u8 |
33 | 158..159 'x': &[u8] | 33 | 157..158 'x': &[u8] |
34 | "### | 34 | "### |
35 | ); | 35 | ); |
36 | } | 36 | } |
@@ -52,15 +52,15 @@ fn test() { | |||
52 | } | 52 | } |
53 | "#), | 53 | "#), |
54 | @r###" | 54 | @r###" |
55 | 49..75 '{ ... }': A | 55 | 48..74 '{ ... }': A |
56 | 59..69 'A { x: 0 }': A | 56 | 58..68 'A { x: 0 }': A |
57 | 66..67 '0': u32 | 57 | 65..66 '0': u32 |
58 | 88..122 '{ ...a.x; }': () | 58 | 87..121 '{ ...a.x; }': () |
59 | 98..99 'a': A | 59 | 97..98 'a': A |
60 | 102..108 'A::new': fn new() -> A | 60 | 101..107 'A::new': fn new() -> A |
61 | 102..110 'A::new()': A | 61 | 101..109 'A::new()': A |
62 | 116..117 'a': A | 62 | 115..116 'a': A |
63 | 116..119 'a.x': u32 | 63 | 115..118 'a.x': u32 |
64 | "### | 64 | "### |
65 | ); | 65 | ); |
66 | } | 66 | } |
@@ -87,19 +87,19 @@ fn test() { | |||
87 | } | 87 | } |
88 | "#), | 88 | "#), |
89 | @r###" | 89 | @r###" |
90 | 47..67 '{ ... }': A | 90 | 46..66 '{ ... }': A |
91 | 57..61 'A::B': A | 91 | 56..60 'A::B': A |
92 | 88..108 '{ ... }': A | 92 | 87..107 '{ ... }': A |
93 | 98..102 'A::C': A | 93 | 97..101 'A::C': A |
94 | 121..178 '{ ... c; }': () | 94 | 120..177 '{ ... c; }': () |
95 | 131..132 'a': A | 95 | 130..131 'a': A |
96 | 135..139 'A::b': fn b() -> A | 96 | 134..138 'A::b': fn b() -> A |
97 | 135..141 'A::b()': A | 97 | 134..140 'A::b()': A |
98 | 147..148 'a': A | 98 | 146..147 'a': A |
99 | 158..159 'c': A | 99 | 157..158 'c': A |
100 | 162..166 'A::c': fn c() -> A | 100 | 161..165 'A::c': fn c() -> A |
101 | 162..168 'A::c()': A | 101 | 161..167 'A::c()': A |
102 | 174..175 'c': A | 102 | 173..174 'c': A |
103 | "### | 103 | "### |
104 | ); | 104 | ); |
105 | } | 105 | } |
@@ -131,22 +131,22 @@ fn test() { | |||
131 | } | 131 | } |
132 | "#), | 132 | "#), |
133 | @r###" | 133 | @r###" |
134 | 56..64 '{ A {} }': A | 134 | 55..63 '{ A {} }': A |
135 | 58..62 'A {}': A | 135 | 57..61 'A {}': A |
136 | 126..132 '{ 99 }': u32 | 136 | 125..131 '{ 99 }': u32 |
137 | 128..130 '99': u32 | 137 | 127..129 '99': u32 |
138 | 202..210 '{ C {} }': C | 138 | 201..209 '{ C {} }': C |
139 | 204..208 'C {}': C | 139 | 203..207 'C {}': C |
140 | 241..325 '{ ...g(); }': () | 140 | 240..324 '{ ...g(); }': () |
141 | 251..252 'x': A | 141 | 250..251 'x': A |
142 | 255..266 'a::A::thing': fn thing() -> A | 142 | 254..265 'a::A::thing': fn thing() -> A |
143 | 255..268 'a::A::thing()': A | 143 | 254..267 'a::A::thing()': A |
144 | 278..279 'y': u32 | 144 | 277..278 'y': u32 |
145 | 282..293 'b::B::thing': fn thing() -> u32 | 145 | 281..292 'b::B::thing': fn thing() -> u32 |
146 | 282..295 'b::B::thing()': u32 | 146 | 281..294 'b::B::thing()': u32 |
147 | 305..306 'z': C | 147 | 304..305 'z': C |
148 | 309..320 'c::C::thing': fn thing() -> C | 148 | 308..319 'c::C::thing': fn thing() -> C |
149 | 309..322 'c::C::thing()': C | 149 | 308..321 'c::C::thing()': C |
150 | "### | 150 | "### |
151 | ); | 151 | ); |
152 | } | 152 | } |
@@ -170,15 +170,15 @@ fn test() { | |||
170 | } | 170 | } |
171 | "#), | 171 | "#), |
172 | @r###" | 172 | @r###" |
173 | 64..67 'val': T | 173 | 63..66 'val': T |
174 | 82..109 '{ ... }': Gen<T> | 174 | 81..108 '{ ... }': Gen<T> |
175 | 92..103 'Gen { val }': Gen<T> | 175 | 91..102 'Gen { val }': Gen<T> |
176 | 98..101 'val': T | 176 | 97..100 'val': T |
177 | 123..155 '{ ...32); }': () | 177 | 122..154 '{ ...32); }': () |
178 | 133..134 'a': Gen<u32> | 178 | 132..133 'a': Gen<u32> |
179 | 137..146 'Gen::make': fn make<u32>(u32) -> Gen<u32> | 179 | 136..145 'Gen::make': fn make<u32>(u32) -> Gen<u32> |
180 | 137..152 'Gen::make(0u32)': Gen<u32> | 180 | 136..151 'Gen::make(0u32)': Gen<u32> |
181 | 147..151 '0u32': u32 | 181 | 146..150 '0u32': u32 |
182 | "### | 182 | "### |
183 | ); | 183 | ); |
184 | } | 184 | } |
@@ -202,13 +202,13 @@ fn test() { | |||
202 | } | 202 | } |
203 | "#), | 203 | "#), |
204 | @r###" | 204 | @r###" |
205 | 76..100 '{ ... }': Gen<T> | 205 | 75..99 '{ ... }': Gen<T> |
206 | 86..94 'loop { }': ! | 206 | 85..93 'loop { }': ! |
207 | 91..94 '{ }': () | 207 | 90..93 '{ }': () |
208 | 114..149 '{ ...e(); }': () | 208 | 113..148 '{ ...e(); }': () |
209 | 124..125 'a': Gen<u32> | 209 | 123..124 'a': Gen<u32> |
210 | 128..144 'Gen::<...::make': fn make<u32>() -> Gen<u32> | 210 | 127..143 'Gen::<...::make': fn make<u32>() -> Gen<u32> |
211 | 128..146 'Gen::<...make()': Gen<u32> | 211 | 127..145 'Gen::<...make()': Gen<u32> |
212 | "### | 212 | "### |
213 | ); | 213 | ); |
214 | } | 214 | } |
@@ -233,13 +233,13 @@ fn test() { | |||
233 | } | 233 | } |
234 | "#), | 234 | "#), |
235 | @r###" | 235 | @r###" |
236 | 102..126 '{ ... }': Gen<u32, T> | 236 | 101..125 '{ ... }': Gen<u32, T> |
237 | 112..120 'loop { }': ! | 237 | 111..119 'loop { }': ! |
238 | 117..120 '{ }': () | 238 | 116..119 '{ }': () |
239 | 140..180 '{ ...e(); }': () | 239 | 139..179 '{ ...e(); }': () |
240 | 150..151 'a': Gen<u32, u64> | 240 | 149..150 'a': Gen<u32, u64> |
241 | 154..175 'Gen::<...::make': fn make<u64>() -> Gen<u32, u64> | 241 | 153..174 'Gen::<...::make': fn make<u64>() -> Gen<u32, u64> |
242 | 154..177 'Gen::<...make()': Gen<u32, u64> | 242 | 153..176 'Gen::<...make()': Gen<u32, u64> |
243 | "### | 243 | "### |
244 | ); | 244 | ); |
245 | } | 245 | } |
@@ -287,13 +287,13 @@ fn test() { | |||
287 | } | 287 | } |
288 | "#), | 288 | "#), |
289 | @r###" | 289 | @r###" |
290 | 31..35 'self': &Self | 290 | 30..34 'self': &Self |
291 | 110..114 'self': &Self | 291 | 109..113 'self': &Self |
292 | 170..228 '{ ...i128 }': () | 292 | 169..227 '{ ...i128 }': () |
293 | 176..178 'S1': S1 | 293 | 175..177 'S1': S1 |
294 | 176..187 'S1.method()': u32 | 294 | 175..186 'S1.method()': u32 |
295 | 203..205 'S2': S2 | 295 | 202..204 'S2': S2 |
296 | 203..214 'S2.method()': i128 | 296 | 202..213 'S2.method()': i128 |
297 | "### | 297 | "### |
298 | ); | 298 | ); |
299 | } | 299 | } |
@@ -334,14 +334,14 @@ mod bar_test { | |||
334 | } | 334 | } |
335 | "#), | 335 | "#), |
336 | @r###" | 336 | @r###" |
337 | 63..67 'self': &Self | 337 | 62..66 'self': &Self |
338 | 169..173 'self': &Self | 338 | 168..172 'self': &Self |
339 | 300..337 '{ ... }': () | 339 | 299..336 '{ ... }': () |
340 | 310..311 'S': S | 340 | 309..310 'S': S |
341 | 310..320 'S.method()': u32 | 341 | 309..319 'S.method()': u32 |
342 | 416..454 '{ ... }': () | 342 | 415..453 '{ ... }': () |
343 | 426..427 'S': S | 343 | 425..426 'S': S |
344 | 426..436 'S.method()': i128 | 344 | 425..435 'S.method()': i128 |
345 | "### | 345 | "### |
346 | ); | 346 | ); |
347 | } | 347 | } |
@@ -361,10 +361,10 @@ fn test() { | |||
361 | } | 361 | } |
362 | "#), | 362 | "#), |
363 | @r###" | 363 | @r###" |
364 | 33..37 'self': &Self | 364 | 32..36 'self': &Self |
365 | 92..111 '{ ...d(); }': () | 365 | 91..110 '{ ...d(); }': () |
366 | 98..99 'S': S | 366 | 97..98 'S': S |
367 | 98..108 'S.method()': u32 | 367 | 97..107 'S.method()': u32 |
368 | "### | 368 | "### |
369 | ); | 369 | ); |
370 | } | 370 | } |
@@ -390,17 +390,17 @@ fn test() { | |||
390 | } | 390 | } |
391 | "#), | 391 | "#), |
392 | @r###" | 392 | @r###" |
393 | 43..47 'self': &Self | 393 | 42..46 'self': &Self |
394 | 82..86 'self': &Self | 394 | 81..85 'self': &Self |
395 | 210..361 '{ ..., i8 }': () | 395 | 209..360 '{ ..., i8 }': () |
396 | 216..218 'S1': S1 | 396 | 215..217 'S1': S1 |
397 | 216..228 'S1.method1()': (u8, u16, u32) | 397 | 215..227 'S1.method1()': (u8, u16, u32) |
398 | 250..252 'S1': S1 | 398 | 249..251 'S1': S1 |
399 | 250..262 'S1.method2()': (u32, u16, u8) | 399 | 249..261 'S1.method2()': (u32, u16, u8) |
400 | 284..286 'S2': S2 | 400 | 283..285 'S2': S2 |
401 | 284..296 'S2.method1()': (i8, i16, {unknown}) | 401 | 283..295 'S2.method1()': (i8, i16, {unknown}) |
402 | 324..326 'S2': S2 | 402 | 323..325 'S2': S2 |
403 | 324..336 'S2.method2()': ({unknown}, i16, i8) | 403 | 323..335 'S2.method2()': ({unknown}, i16, i8) |
404 | "### | 404 | "### |
405 | ); | 405 | ); |
406 | } | 406 | } |
@@ -420,12 +420,12 @@ fn test() { | |||
420 | } | 420 | } |
421 | "#), | 421 | "#), |
422 | @r###" | 422 | @r###" |
423 | 33..37 'self': &Self | 423 | 32..36 'self': &Self |
424 | 102..127 '{ ...d(); }': () | 424 | 101..126 '{ ...d(); }': () |
425 | 108..109 'S': S<u32>(u32) -> S<u32> | 425 | 107..108 'S': S<u32>(u32) -> S<u32> |
426 | 108..115 'S(1u32)': S<u32> | 426 | 107..114 'S(1u32)': S<u32> |
427 | 108..124 'S(1u32...thod()': u32 | 427 | 107..123 'S(1u32...thod()': u32 |
428 | 110..114 '1u32': u32 | 428 | 109..113 '1u32': u32 |
429 | "### | 429 | "### |
430 | ); | 430 | ); |
431 | } | 431 | } |
@@ -446,16 +446,16 @@ fn test() { | |||
446 | } | 446 | } |
447 | "#), | 447 | "#), |
448 | @r###" | 448 | @r###" |
449 | 87..193 '{ ...t(); }': () | 449 | 86..192 '{ ...t(); }': () |
450 | 97..99 's1': S | 450 | 96..98 's1': S |
451 | 105..121 'Defaul...efault': fn default<S>() -> S | 451 | 104..120 'Defaul...efault': fn default<S>() -> S |
452 | 105..123 'Defaul...ault()': S | 452 | 104..122 'Defaul...ault()': S |
453 | 133..135 's2': S | 453 | 132..134 's2': S |
454 | 138..148 'S::default': fn default<S>() -> S | 454 | 137..147 'S::default': fn default<S>() -> S |
455 | 138..150 'S::default()': S | 455 | 137..149 'S::default()': S |
456 | 160..162 's3': S | 456 | 159..161 's3': S |
457 | 165..188 '<S as ...efault': fn default<S>() -> S | 457 | 164..187 '<S as ...efault': fn default<S>() -> S |
458 | 165..190 '<S as ...ault()': S | 458 | 164..189 '<S as ...ault()': S |
459 | "### | 459 | "### |
460 | ); | 460 | ); |
461 | } | 461 | } |
@@ -478,16 +478,16 @@ fn test() { | |||
478 | } | 478 | } |
479 | "#), | 479 | "#), |
480 | @r###" | 480 | @r###" |
481 | 127..211 '{ ...e(); }': () | 481 | 126..210 '{ ...e(); }': () |
482 | 137..138 'a': u32 | 482 | 136..137 'a': u32 |
483 | 141..148 'S::make': fn make<S, u32>() -> u32 | 483 | 140..147 'S::make': fn make<S, u32>() -> u32 |
484 | 141..150 'S::make()': u32 | 484 | 140..149 'S::make()': u32 |
485 | 160..161 'b': u64 | 485 | 159..160 'b': u64 |
486 | 164..178 'G::<u64>::make': fn make<G<u64>, u64>() -> u64 | 486 | 163..177 'G::<u64>::make': fn make<G<u64>, u64>() -> u64 |
487 | 164..180 'G::<u6...make()': u64 | 487 | 163..179 'G::<u6...make()': u64 |
488 | 190..191 'c': f64 | 488 | 189..190 'c': f64 |
489 | 199..206 'G::make': fn make<G<f64>, f64>() -> f64 | 489 | 198..205 'G::make': fn make<G<f64>, f64>() -> f64 |
490 | 199..208 'G::make()': f64 | 490 | 198..207 'G::make()': f64 |
491 | "### | 491 | "### |
492 | ); | 492 | ); |
493 | } | 493 | } |
@@ -512,22 +512,22 @@ fn test() { | |||
512 | } | 512 | } |
513 | "#), | 513 | "#), |
514 | @r###" | 514 | @r###" |
515 | 135..313 '{ ...e(); }': () | 515 | 134..312 '{ ...e(); }': () |
516 | 145..146 'a': (u32, i64) | 516 | 144..145 'a': (u32, i64) |
517 | 149..163 'S::make::<i64>': fn make<S, u32, i64>() -> (u32, i64) | 517 | 148..162 'S::make::<i64>': fn make<S, u32, i64>() -> (u32, i64) |
518 | 149..165 'S::mak...i64>()': (u32, i64) | 518 | 148..164 'S::mak...i64>()': (u32, i64) |
519 | 175..176 'b': (u32, i64) | 519 | 174..175 'b': (u32, i64) |
520 | 189..196 'S::make': fn make<S, u32, i64>() -> (u32, i64) | 520 | 188..195 'S::make': fn make<S, u32, i64>() -> (u32, i64) |
521 | 189..198 'S::make()': (u32, i64) | 521 | 188..197 'S::make()': (u32, i64) |
522 | 208..209 'c': (u32, i64) | 522 | 207..208 'c': (u32, i64) |
523 | 212..233 'G::<u3...:<i64>': fn make<G<u32>, u32, i64>() -> (u32, i64) | 523 | 211..232 'G::<u3...:<i64>': fn make<G<u32>, u32, i64>() -> (u32, i64) |
524 | 212..235 'G::<u3...i64>()': (u32, i64) | 524 | 211..234 'G::<u3...i64>()': (u32, i64) |
525 | 245..246 'd': (u32, i64) | 525 | 244..245 'd': (u32, i64) |
526 | 259..273 'G::make::<i64>': fn make<G<u32>, u32, i64>() -> (u32, i64) | 526 | 258..272 'G::make::<i64>': fn make<G<u32>, u32, i64>() -> (u32, i64) |
527 | 259..275 'G::mak...i64>()': (u32, i64) | 527 | 258..274 'G::mak...i64>()': (u32, i64) |
528 | 285..286 'e': (u32, i64) | 528 | 284..285 'e': (u32, i64) |
529 | 301..308 'G::make': fn make<G<u32>, u32, i64>() -> (u32, i64) | 529 | 300..307 'G::make': fn make<G<u32>, u32, i64>() -> (u32, i64) |
530 | 301..310 'G::make()': (u32, i64) | 530 | 300..309 'G::make()': (u32, i64) |
531 | "### | 531 | "### |
532 | ); | 532 | ); |
533 | } | 533 | } |
@@ -546,10 +546,10 @@ fn test() { | |||
546 | } | 546 | } |
547 | "#), | 547 | "#), |
548 | @r###" | 548 | @r###" |
549 | 101..127 '{ ...e(); }': () | 549 | 100..126 '{ ...e(); }': () |
550 | 111..112 'a': (S<i32>, i64) | 550 | 110..111 'a': (S<i32>, i64) |
551 | 115..122 'S::make': fn make<S<i32>, i64>() -> (S<i32>, i64) | 551 | 114..121 'S::make': fn make<S<i32>, i64>() -> (S<i32>, i64) |
552 | 115..124 'S::make()': (S<i32>, i64) | 552 | 114..123 'S::make()': (S<i32>, i64) |
553 | "### | 553 | "### |
554 | ); | 554 | ); |
555 | } | 555 | } |
@@ -570,13 +570,13 @@ fn test() { | |||
570 | } | 570 | } |
571 | "#), | 571 | "#), |
572 | @r###" | 572 | @r###" |
573 | 131..203 '{ ...e(); }': () | 573 | 130..202 '{ ...e(); }': () |
574 | 141..142 'a': (S<u64>, i64) | 574 | 140..141 'a': (S<u64>, i64) |
575 | 158..165 'S::make': fn make<S<u64>, i64>() -> (S<u64>, i64) | 575 | 157..164 'S::make': fn make<S<u64>, i64>() -> (S<u64>, i64) |
576 | 158..167 'S::make()': (S<u64>, i64) | 576 | 157..166 'S::make()': (S<u64>, i64) |
577 | 177..178 'b': (S<u32>, i32) | 577 | 176..177 'b': (S<u32>, i32) |
578 | 191..198 'S::make': fn make<S<u32>, i32>() -> (S<u32>, i32) | 578 | 190..197 'S::make': fn make<S<u32>, i32>() -> (S<u32>, i32) |
579 | 191..200 'S::make()': (S<u32>, i32) | 579 | 190..199 'S::make()': (S<u32>, i32) |
580 | "### | 580 | "### |
581 | ); | 581 | ); |
582 | } | 582 | } |
@@ -596,13 +596,13 @@ fn test() { | |||
596 | } | 596 | } |
597 | "#), | 597 | "#), |
598 | @r###" | 598 | @r###" |
599 | 107..211 '{ ...>(); }': () | 599 | 106..210 '{ ...>(); }': () |
600 | 117..118 'a': (S<u64>, i64, u8) | 600 | 116..117 'a': (S<u64>, i64, u8) |
601 | 121..150 '<S as ...::<u8>': fn make<S<u64>, i64, u8>() -> (S<u64>, i64, u8) | 601 | 120..149 '<S as ...::<u8>': fn make<S<u64>, i64, u8>() -> (S<u64>, i64, u8) |
602 | 121..152 '<S as ...<u8>()': (S<u64>, i64, u8) | 602 | 120..151 '<S as ...<u8>()': (S<u64>, i64, u8) |
603 | 162..163 'b': (S<u64>, i64, u8) | 603 | 161..162 'b': (S<u64>, i64, u8) |
604 | 182..206 'Trait:...::<u8>': fn make<S<u64>, i64, u8>() -> (S<u64>, i64, u8) | 604 | 181..205 'Trait:...::<u8>': fn make<S<u64>, i64, u8>() -> (S<u64>, i64, u8) |
605 | 182..208 'Trait:...<u8>()': (S<u64>, i64, u8) | 605 | 181..207 'Trait:...<u8>()': (S<u64>, i64, u8) |
606 | "### | 606 | "### |
607 | ); | 607 | ); |
608 | } | 608 | } |
@@ -619,11 +619,11 @@ fn test<T: Trait>(t: T) { | |||
619 | } | 619 | } |
620 | "#), | 620 | "#), |
621 | @r###" | 621 | @r###" |
622 | 30..34 'self': &Self | 622 | 29..33 'self': &Self |
623 | 64..65 't': T | 623 | 63..64 't': T |
624 | 70..89 '{ ...d(); }': () | 624 | 69..88 '{ ...d(); }': () |
625 | 76..77 't': T | 625 | 75..76 't': T |
626 | 76..86 't.method()': u32 | 626 | 75..85 't.method()': u32 |
627 | "### | 627 | "### |
628 | ); | 628 | ); |
629 | } | 629 | } |
@@ -640,11 +640,11 @@ fn test<U, T: Trait<U>>(t: T) { | |||
640 | } | 640 | } |
641 | "#), | 641 | "#), |
642 | @r###" | 642 | @r###" |
643 | 33..37 'self': &Self | 643 | 32..36 'self': &Self |
644 | 71..72 't': T | 644 | 70..71 't': T |
645 | 77..96 '{ ...d(); }': () | 645 | 76..95 '{ ...d(); }': () |
646 | 83..84 't': T | 646 | 82..83 't': T |
647 | 83..93 't.method()': U | 647 | 82..92 't.method()': U |
648 | "### | 648 | "### |
649 | ); | 649 | ); |
650 | } | 650 | } |
@@ -666,18 +666,18 @@ fn test() { | |||
666 | } | 666 | } |
667 | "#), | 667 | "#), |
668 | @r###" | 668 | @r###" |
669 | 29..33 'self': Self | 669 | 28..32 'self': Self |
670 | 111..202 '{ ...(S); }': () | 670 | 110..201 '{ ...(S); }': () |
671 | 121..122 'x': u32 | 671 | 120..121 'x': u32 |
672 | 130..131 'S': S | 672 | 129..130 'S': S |
673 | 130..138 'S.into()': u32 | 673 | 129..137 'S.into()': u32 |
674 | 148..149 'y': u64 | 674 | 147..148 'y': u64 |
675 | 157..158 'S': S | 675 | 156..157 'S': S |
676 | 157..165 'S.into()': u64 | 676 | 156..164 'S.into()': u64 |
677 | 175..176 'z': u64 | 677 | 174..175 'z': u64 |
678 | 179..196 'Into::...::into': fn into<S, u64>(S) -> u64 | 678 | 178..195 'Into::...::into': fn into<S, u64>(S) -> u64 |
679 | 179..199 'Into::...nto(S)': u64 | 679 | 178..198 'Into::...nto(S)': u64 |
680 | 197..198 'S': S | 680 | 196..197 'S': S |
681 | "### | 681 | "### |
682 | ); | 682 | ); |
683 | } | 683 | } |
@@ -1063,13 +1063,13 @@ fn test(d: &dyn Trait) { | |||
1063 | } | 1063 | } |
1064 | "#), | 1064 | "#), |
1065 | @r###" | 1065 | @r###" |
1066 | 52..56 'self': &Self | 1066 | 51..55 'self': &Self |
1067 | 65..70 '{ 0 }': u32 | 1067 | 64..69 '{ 0 }': u32 |
1068 | 67..68 '0': u32 | 1068 | 66..67 '0': u32 |
1069 | 177..178 'd': &dyn Trait | 1069 | 176..177 'd': &dyn Trait |
1070 | 192..208 '{ ...o(); }': () | 1070 | 191..207 '{ ...o(); }': () |
1071 | 198..199 'd': &dyn Trait | 1071 | 197..198 'd': &dyn Trait |
1072 | 198..205 'd.foo()': u32 | 1072 | 197..204 'd.foo()': u32 |
1073 | "### | 1073 | "### |
1074 | ); | 1074 | ); |
1075 | } | 1075 | } |
diff --git a/crates/ra_hir_ty/src/tests/never_type.rs b/crates/ra_hir_ty/src/tests/never_type.rs index 082c47208..ab9a990f5 100644 --- a/crates/ra_hir_ty/src/tests/never_type.rs +++ b/crates/ra_hir_ty/src/tests/never_type.rs | |||
@@ -291,40 +291,40 @@ fn test6() { | |||
291 | true, | 291 | true, |
292 | ); | 292 | ); |
293 | assert_snapshot!(t, @r###" | 293 | assert_snapshot!(t, @r###" |
294 | 25..53 '{ ...urn; }': () | 294 | 11..39 '{ ...urn; }': () |
295 | 35..36 'x': u32 | 295 | 21..22 'x': u32 |
296 | 44..50 'return': ! | 296 | 30..36 'return': ! |
297 | 65..98 '{ ...; }; }': () | 297 | 51..84 '{ ...; }; }': () |
298 | 75..76 'x': u32 | 298 | 61..62 'x': u32 |
299 | 84..95 '{ return; }': u32 | 299 | 70..81 '{ return; }': u32 |
300 | 86..92 'return': ! | 300 | 72..78 'return': ! |
301 | 110..139 '{ ... {}; }': () | 301 | 96..125 '{ ... {}; }': () |
302 | 120..121 'x': u32 | 302 | 106..107 'x': u32 |
303 | 129..136 'loop {}': ! | 303 | 115..122 'loop {}': ! |
304 | 134..136 '{}': () | 304 | 120..122 '{}': () |
305 | 151..184 '{ ...} }; }': () | 305 | 137..170 '{ ...} }; }': () |
306 | 161..162 'x': u32 | 306 | 147..148 'x': u32 |
307 | 170..181 '{ loop {} }': u32 | 307 | 156..167 '{ loop {} }': u32 |
308 | 172..179 'loop {}': ! | 308 | 158..165 'loop {}': ! |
309 | 177..179 '{}': () | 309 | 163..165 '{}': () |
310 | 196..260 '{ ...} }; }': () | 310 | 182..246 '{ ...} }; }': () |
311 | 206..207 'x': u32 | 311 | 192..193 'x': u32 |
312 | 215..257 '{ if t...}; } }': u32 | 312 | 201..243 '{ if t...}; } }': u32 |
313 | 217..255 'if tru... {}; }': u32 | 313 | 203..241 'if tru... {}; }': u32 |
314 | 220..224 'true': bool | 314 | 206..210 'true': bool |
315 | 225..237 '{ loop {}; }': u32 | 315 | 211..223 '{ loop {}; }': u32 |
316 | 227..234 'loop {}': ! | 316 | 213..220 'loop {}': ! |
317 | 232..234 '{}': () | 317 | 218..220 '{}': () |
318 | 243..255 '{ loop {}; }': u32 | 318 | 229..241 '{ loop {}; }': u32 |
319 | 245..252 'loop {}': ! | 319 | 231..238 'loop {}': ! |
320 | 250..252 '{}': () | 320 | 236..238 '{}': () |
321 | 272..324 '{ ...; }; }': () | 321 | 258..310 '{ ...; }; }': () |
322 | 282..283 'x': u32 | 322 | 268..269 'x': u32 |
323 | 291..321 '{ let ...; }; }': u32 | 323 | 277..307 '{ let ...; }; }': u32 |
324 | 297..298 'y': u32 | 324 | 283..284 'y': u32 |
325 | 306..318 '{ loop {}; }': u32 | 325 | 292..304 '{ loop {}; }': u32 |
326 | 308..315 'loop {}': ! | 326 | 294..301 'loop {}': ! |
327 | 313..315 '{}': () | 327 | 299..301 '{}': () |
328 | "###); | 328 | "###); |
329 | } | 329 | } |
330 | 330 | ||
@@ -341,14 +341,14 @@ fn test1() { | |||
341 | true, | 341 | true, |
342 | ); | 342 | ); |
343 | assert_snapshot!(t, @r###" | 343 | assert_snapshot!(t, @r###" |
344 | 25..98 '{ ..." }; }': () | 344 | 11..84 '{ ..." }; }': () |
345 | 68..69 'x': u32 | 345 | 54..55 'x': u32 |
346 | 77..95 '{ loop...foo" }': &str | 346 | 63..81 '{ loop...foo" }': &str |
347 | 79..86 'loop {}': ! | 347 | 65..72 'loop {}': ! |
348 | 84..86 '{}': () | 348 | 70..72 '{}': () |
349 | 88..93 '"foo"': &str | 349 | 74..79 '"foo"': &str |
350 | 77..95: expected u32, got &str | 350 | 63..81: expected u32, got &str |
351 | 88..93: expected u32, got &str | 351 | 74..79: expected u32, got &str |
352 | "###); | 352 | "###); |
353 | } | 353 | } |
354 | 354 | ||
@@ -381,58 +381,58 @@ fn test3() { | |||
381 | true, | 381 | true, |
382 | ); | 382 | ); |
383 | assert_snapshot!(t, @r###" | 383 | assert_snapshot!(t, @r###" |
384 | 25..99 '{ ...} }; }': () | 384 | 11..85 '{ ...} }; }': () |
385 | 68..69 'x': u32 | 385 | 54..55 'x': u32 |
386 | 77..96 '{ loop...k; } }': () | 386 | 63..82 '{ loop...k; } }': () |
387 | 79..94 'loop { break; }': () | 387 | 65..80 'loop { break; }': () |
388 | 84..94 '{ break; }': () | 388 | 70..80 '{ break; }': () |
389 | 86..91 'break': ! | 389 | 72..77 'break': ! |
390 | 77..96: expected u32, got () | 390 | 63..82: expected u32, got () |
391 | 79..94: expected u32, got () | 391 | 65..80: expected u32, got () |
392 | 111..357 '{ ...; }; }': () | 392 | 97..343 '{ ...; }; }': () |
393 | 154..155 'x': u32 | 393 | 140..141 'x': u32 |
394 | 163..189 '{ for ...; }; }': () | 394 | 149..175 '{ for ...; }; }': () |
395 | 165..186 'for a ...eak; }': () | 395 | 151..172 'for a ...eak; }': () |
396 | 169..170 'a': {unknown} | 396 | 155..156 'a': {unknown} |
397 | 174..175 'b': {unknown} | 397 | 160..161 'b': {unknown} |
398 | 176..186 '{ break; }': () | 398 | 162..172 '{ break; }': () |
399 | 178..183 'break': ! | 399 | 164..169 'break': ! |
400 | 240..241 'x': u32 | 400 | 226..227 'x': u32 |
401 | 249..267 '{ for ... {}; }': () | 401 | 235..253 '{ for ... {}; }': () |
402 | 251..264 'for a in b {}': () | 402 | 237..250 'for a in b {}': () |
403 | 255..256 'a': {unknown} | 403 | 241..242 'a': {unknown} |
404 | 260..261 'b': {unknown} | 404 | 246..247 'b': {unknown} |
405 | 262..264 '{}': () | 405 | 248..250 '{}': () |
406 | 318..319 'x': u32 | 406 | 304..305 'x': u32 |
407 | 327..354 '{ for ...; }; }': () | 407 | 313..340 '{ for ...; }; }': () |
408 | 329..351 'for a ...urn; }': () | 408 | 315..337 'for a ...urn; }': () |
409 | 333..334 'a': {unknown} | 409 | 319..320 'a': {unknown} |
410 | 338..339 'b': {unknown} | 410 | 324..325 'b': {unknown} |
411 | 340..351 '{ return; }': () | 411 | 326..337 '{ return; }': () |
412 | 342..348 'return': ! | 412 | 328..334 'return': ! |
413 | 163..189: expected u32, got () | 413 | 149..175: expected u32, got () |
414 | 249..267: expected u32, got () | 414 | 235..253: expected u32, got () |
415 | 327..354: expected u32, got () | 415 | 313..340: expected u32, got () |
416 | 369..668 '{ ...; }; }': () | 416 | 355..654 '{ ...; }; }': () |
417 | 412..413 'x': u32 | 417 | 398..399 'x': u32 |
418 | 421..447 '{ whil...; }; }': () | 418 | 407..433 '{ whil...; }; }': () |
419 | 423..444 'while ...eak; }': () | 419 | 409..430 'while ...eak; }': () |
420 | 429..433 'true': bool | 420 | 415..419 'true': bool |
421 | 434..444 '{ break; }': () | 421 | 420..430 '{ break; }': () |
422 | 436..441 'break': ! | 422 | 422..427 'break': ! |
423 | 551..552 'x': u32 | 423 | 537..538 'x': u32 |
424 | 560..578 '{ whil... {}; }': () | 424 | 546..564 '{ whil... {}; }': () |
425 | 562..575 'while true {}': () | 425 | 548..561 'while true {}': () |
426 | 568..572 'true': bool | 426 | 554..558 'true': bool |
427 | 573..575 '{}': () | 427 | 559..561 '{}': () |
428 | 629..630 'x': u32 | 428 | 615..616 'x': u32 |
429 | 638..665 '{ whil...; }; }': () | 429 | 624..651 '{ whil...; }; }': () |
430 | 640..662 'while ...urn; }': () | 430 | 626..648 'while ...urn; }': () |
431 | 646..650 'true': bool | 431 | 632..636 'true': bool |
432 | 651..662 '{ return; }': () | 432 | 637..648 '{ return; }': () |
433 | 653..659 'return': ! | 433 | 639..645 'return': ! |
434 | 421..447: expected u32, got () | 434 | 407..433: expected u32, got () |
435 | 560..578: expected u32, got () | 435 | 546..564: expected u32, got () |
436 | 638..665: expected u32, got () | 436 | 624..651: expected u32, got () |
437 | "###); | 437 | "###); |
438 | } | 438 | } |
diff --git a/crates/ra_hir_ty/src/tests/patterns.rs b/crates/ra_hir_ty/src/tests/patterns.rs index fe62587c0..8fa296137 100644 --- a/crates/ra_hir_ty/src/tests/patterns.rs +++ b/crates/ra_hir_ty/src/tests/patterns.rs | |||
@@ -30,54 +30,54 @@ fn test(x: &i32) { | |||
30 | } | 30 | } |
31 | "#), | 31 | "#), |
32 | @r###" | 32 | @r###" |
33 | 9..10 'x': &i32 | 33 | 8..9 'x': &i32 |
34 | 18..369 '{ ...o_x; }': () | 34 | 17..368 '{ ...o_x; }': () |
35 | 28..29 'y': &i32 | 35 | 27..28 'y': &i32 |
36 | 32..33 'x': &i32 | 36 | 31..32 'x': &i32 |
37 | 43..45 '&z': &i32 | 37 | 42..44 '&z': &i32 |
38 | 44..45 'z': i32 | 38 | 43..44 'z': i32 |
39 | 48..49 'x': &i32 | 39 | 47..48 'x': &i32 |
40 | 59..60 'a': i32 | 40 | 58..59 'a': i32 |
41 | 63..64 'z': i32 | 41 | 62..63 'z': i32 |
42 | 74..80 '(c, d)': (i32, &str) | 42 | 73..79 '(c, d)': (i32, &str) |
43 | 75..76 'c': i32 | 43 | 74..75 'c': i32 |
44 | 78..79 'd': &str | 44 | 77..78 'd': &str |
45 | 83..95 '(1, "hello")': (i32, &str) | 45 | 82..94 '(1, "hello")': (i32, &str) |
46 | 84..85 '1': i32 | 46 | 83..84 '1': i32 |
47 | 87..94 '"hello"': &str | 47 | 86..93 '"hello"': &str |
48 | 102..152 'for (e... }': () | 48 | 101..151 'for (e... }': () |
49 | 106..112 '(e, f)': ({unknown}, {unknown}) | 49 | 105..111 '(e, f)': ({unknown}, {unknown}) |
50 | 107..108 'e': {unknown} | 50 | 106..107 'e': {unknown} |
51 | 110..111 'f': {unknown} | 51 | 109..110 'f': {unknown} |
52 | 116..125 'some_iter': {unknown} | 52 | 115..124 'some_iter': {unknown} |
53 | 126..152 '{ ... }': () | 53 | 125..151 '{ ... }': () |
54 | 140..141 'g': {unknown} | 54 | 139..140 'g': {unknown} |
55 | 144..145 'e': {unknown} | 55 | 143..144 'e': {unknown} |
56 | 158..205 'if let... }': () | 56 | 157..204 'if let... }': () |
57 | 165..170 '[val]': [{unknown}] | 57 | 164..169 '[val]': [{unknown}] |
58 | 166..169 'val': {unknown} | 58 | 165..168 'val': {unknown} |
59 | 173..176 'opt': [{unknown}] | 59 | 172..175 'opt': [{unknown}] |
60 | 177..205 '{ ... }': () | 60 | 176..204 '{ ... }': () |
61 | 191..192 'h': {unknown} | 61 | 190..191 'h': {unknown} |
62 | 195..198 'val': {unknown} | 62 | 194..197 'val': {unknown} |
63 | 215..221 'lambda': |u64, u64, i32| -> i32 | 63 | 214..220 'lambda': |u64, u64, i32| -> i32 |
64 | 224..256 '|a: u6...b; c }': |u64, u64, i32| -> i32 | 64 | 223..255 '|a: u6...b; c }': |u64, u64, i32| -> i32 |
65 | 225..226 'a': u64 | 65 | 224..225 'a': u64 |
66 | 233..234 'b': u64 | 66 | 232..233 'b': u64 |
67 | 236..237 'c': i32 | 67 | 235..236 'c': i32 |
68 | 244..256 '{ a + b; c }': i32 | 68 | 243..255 '{ a + b; c }': i32 |
69 | 246..247 'a': u64 | 69 | 245..246 'a': u64 |
70 | 246..251 'a + b': u64 | 70 | 245..250 'a + b': u64 |
71 | 250..251 'b': u64 | 71 | 249..250 'b': u64 |
72 | 253..254 'c': i32 | 72 | 252..253 'c': i32 |
73 | 267..279 'ref ref_to_x': &&i32 | 73 | 266..278 'ref ref_to_x': &&i32 |
74 | 282..283 'x': &i32 | 74 | 281..282 'x': &i32 |
75 | 293..302 'mut mut_x': &i32 | 75 | 292..301 'mut mut_x': &i32 |
76 | 305..306 'x': &i32 | 76 | 304..305 'x': &i32 |
77 | 316..336 'ref mu...f_to_x': &mut &i32 | 77 | 315..335 'ref mu...f_to_x': &mut &i32 |
78 | 339..340 'x': &i32 | 78 | 338..339 'x': &i32 |
79 | 350..351 'k': &mut &i32 | 79 | 349..350 'k': &mut &i32 |
80 | 354..366 'mut_ref_to_x': &mut &i32 | 80 | 353..365 'mut_ref_to_x': &mut &i32 |
81 | "### | 81 | "### |
82 | ); | 82 | ); |
83 | } | 83 | } |
@@ -97,47 +97,47 @@ fn test(x: &i32) { | |||
97 | } | 97 | } |
98 | "#, true), | 98 | "#, true), |
99 | @r###" | 99 | @r###" |
100 | 18..29 '{ loop {} }': T | 100 | 17..28 '{ loop {} }': T |
101 | 20..27 'loop {}': ! | 101 | 19..26 'loop {}': ! |
102 | 25..27 '{}': () | 102 | 24..26 '{}': () |
103 | 38..39 'x': &i32 | 103 | 37..38 'x': &i32 |
104 | 47..209 '{ ...) {} }': () | 104 | 46..208 '{ ...) {} }': () |
105 | 53..76 'if let...y() {}': () | 105 | 52..75 'if let...y() {}': () |
106 | 60..65 '"foo"': &str | 106 | 59..64 '"foo"': &str |
107 | 60..65 '"foo"': &str | 107 | 59..64 '"foo"': &str |
108 | 68..71 'any': fn any<&str>() -> &str | 108 | 67..70 'any': fn any<&str>() -> &str |
109 | 68..73 'any()': &str | 109 | 67..72 'any()': &str |
110 | 74..76 '{}': () | 110 | 73..75 '{}': () |
111 | 81..100 'if let...y() {}': () | 111 | 80..99 'if let...y() {}': () |
112 | 88..89 '1': i32 | 112 | 87..88 '1': i32 |
113 | 88..89 '1': i32 | 113 | 87..88 '1': i32 |
114 | 92..95 'any': fn any<i32>() -> i32 | 114 | 91..94 'any': fn any<i32>() -> i32 |
115 | 92..97 'any()': i32 | 115 | 91..96 'any()': i32 |
116 | 98..100 '{}': () | 116 | 97..99 '{}': () |
117 | 105..127 'if let...y() {}': () | 117 | 104..126 'if let...y() {}': () |
118 | 112..116 '1u32': u32 | 118 | 111..115 '1u32': u32 |
119 | 112..116 '1u32': u32 | 119 | 111..115 '1u32': u32 |
120 | 119..122 'any': fn any<u32>() -> u32 | 120 | 118..121 'any': fn any<u32>() -> u32 |
121 | 119..124 'any()': u32 | 121 | 118..123 'any()': u32 |
122 | 125..127 '{}': () | 122 | 124..126 '{}': () |
123 | 132..154 'if let...y() {}': () | 123 | 131..153 'if let...y() {}': () |
124 | 139..143 '1f32': f32 | 124 | 138..142 '1f32': f32 |
125 | 139..143 '1f32': f32 | 125 | 138..142 '1f32': f32 |
126 | 146..149 'any': fn any<f32>() -> f32 | 126 | 145..148 'any': fn any<f32>() -> f32 |
127 | 146..151 'any()': f32 | 127 | 145..150 'any()': f32 |
128 | 152..154 '{}': () | 128 | 151..153 '{}': () |
129 | 159..180 'if let...y() {}': () | 129 | 158..179 'if let...y() {}': () |
130 | 166..169 '1.0': f64 | 130 | 165..168 '1.0': f64 |
131 | 166..169 '1.0': f64 | 131 | 165..168 '1.0': f64 |
132 | 172..175 'any': fn any<f64>() -> f64 | 132 | 171..174 'any': fn any<f64>() -> f64 |
133 | 172..177 'any()': f64 | 133 | 171..176 'any()': f64 |
134 | 178..180 '{}': () | 134 | 177..179 '{}': () |
135 | 185..207 'if let...y() {}': () | 135 | 184..206 'if let...y() {}': () |
136 | 192..196 'true': bool | 136 | 191..195 'true': bool |
137 | 192..196 'true': bool | 137 | 191..195 'true': bool |
138 | 199..202 'any': fn any<bool>() -> bool | 138 | 198..201 'any': fn any<bool>() -> bool |
139 | 199..204 'any()': bool | 139 | 198..203 'any()': bool |
140 | 205..207 '{}': () | 140 | 204..206 '{}': () |
141 | "### | 141 | "### |
142 | ); | 142 | ); |
143 | } | 143 | } |
@@ -152,16 +152,16 @@ fn test(x: &i32) { | |||
152 | } | 152 | } |
153 | "#, true), | 153 | "#, true), |
154 | @r###" | 154 | @r###" |
155 | 9..10 'x': &i32 | 155 | 8..9 'x': &i32 |
156 | 18..76 '{ ...2 {} }': () | 156 | 17..75 '{ ...2 {} }': () |
157 | 24..46 'if let...u32 {}': () | 157 | 23..45 'if let...u32 {}': () |
158 | 31..36 '1..76': u32 | 158 | 30..35 '1..76': u32 |
159 | 39..43 '2u32': u32 | 159 | 38..42 '2u32': u32 |
160 | 44..46 '{}': () | 160 | 43..45 '{}': () |
161 | 51..74 'if let...u32 {}': () | 161 | 50..73 'if let...u32 {}': () |
162 | 58..64 '1..=76': u32 | 162 | 57..63 '1..=76': u32 |
163 | 67..71 '2u32': u32 | 163 | 66..70 '2u32': u32 |
164 | 72..74 '{}': () | 164 | 71..73 '{}': () |
165 | "### | 165 | "### |
166 | ); | 166 | ); |
167 | } | 167 | } |
@@ -178,19 +178,19 @@ fn test() { | |||
178 | } | 178 | } |
179 | "#), | 179 | "#), |
180 | @r###" | 180 | @r###" |
181 | 28..79 '{ ...(1); }': () | 181 | 27..78 '{ ...(1); }': () |
182 | 38..42 'A(n)': A<i32> | 182 | 37..41 'A(n)': A<i32> |
183 | 40..41 'n': &i32 | 183 | 39..40 'n': &i32 |
184 | 45..50 '&A(1)': &A<i32> | 184 | 44..49 '&A(1)': &A<i32> |
185 | 46..47 'A': A<i32>(i32) -> A<i32> | 185 | 45..46 'A': A<i32>(i32) -> A<i32> |
186 | 46..50 'A(1)': A<i32> | 186 | 45..49 'A(1)': A<i32> |
187 | 48..49 '1': i32 | 187 | 47..48 '1': i32 |
188 | 60..64 'A(n)': A<i32> | 188 | 59..63 'A(n)': A<i32> |
189 | 62..63 'n': &mut i32 | 189 | 61..62 'n': &mut i32 |
190 | 67..76 '&mut A(1)': &mut A<i32> | 190 | 66..75 '&mut A(1)': &mut A<i32> |
191 | 72..73 'A': A<i32>(i32) -> A<i32> | 191 | 71..72 'A': A<i32>(i32) -> A<i32> |
192 | 72..76 'A(1)': A<i32> | 192 | 71..75 'A(1)': A<i32> |
193 | 74..75 '1': i32 | 193 | 73..74 '1': i32 |
194 | "### | 194 | "### |
195 | ); | 195 | ); |
196 | } | 196 | } |
@@ -206,18 +206,18 @@ fn test() { | |||
206 | } | 206 | } |
207 | "#), | 207 | "#), |
208 | @r###" | 208 | @r###" |
209 | 11..57 '{ ...= v; }': () | 209 | 10..56 '{ ...= v; }': () |
210 | 21..22 'v': &(i32, &i32) | 210 | 20..21 'v': &(i32, &i32) |
211 | 25..33 '&(1, &2)': &(i32, &i32) | 211 | 24..32 '&(1, &2)': &(i32, &i32) |
212 | 26..33 '(1, &2)': (i32, &i32) | 212 | 25..32 '(1, &2)': (i32, &i32) |
213 | 27..28 '1': i32 | 213 | 26..27 '1': i32 |
214 | 30..32 '&2': &i32 | 214 | 29..31 '&2': &i32 |
215 | 31..32 '2': i32 | 215 | 30..31 '2': i32 |
216 | 43..50 '(_, &w)': (i32, &i32) | 216 | 42..49 '(_, &w)': (i32, &i32) |
217 | 44..45 '_': i32 | 217 | 43..44 '_': i32 |
218 | 47..49 '&w': &i32 | 218 | 46..48 '&w': &i32 |
219 | 48..49 'w': i32 | 219 | 47..48 'w': i32 |
220 | 53..54 'v': &(i32, &i32) | 220 | 52..53 'v': &(i32, &i32) |
221 | "### | 221 | "### |
222 | ); | 222 | ); |
223 | } | 223 | } |
@@ -242,30 +242,30 @@ fn test() { | |||
242 | } | 242 | } |
243 | "#), | 243 | "#), |
244 | @r###" | 244 | @r###" |
245 | 11..210 '{ ... } }': () | 245 | 10..209 '{ ... } }': () |
246 | 21..26 'slice': &[f64] | 246 | 20..25 'slice': &[f64] |
247 | 37..43 '&[0.0]': &[f64; _] | 247 | 36..42 '&[0.0]': &[f64; _] |
248 | 38..43 '[0.0]': [f64; _] | 248 | 37..42 '[0.0]': [f64; _] |
249 | 39..42 '0.0': f64 | 249 | 38..41 '0.0': f64 |
250 | 49..208 'match ... }': () | 250 | 48..207 'match ... }': () |
251 | 55..60 'slice': &[f64] | 251 | 54..59 'slice': &[f64] |
252 | 71..74 '&[]': &[f64] | 252 | 70..73 '&[]': &[f64] |
253 | 72..74 '[]': [f64] | 253 | 71..73 '[]': [f64] |
254 | 78..80 '{}': () | 254 | 77..79 '{}': () |
255 | 90..94 '&[a]': &[f64] | 255 | 89..93 '&[a]': &[f64] |
256 | 91..94 '[a]': [f64] | 256 | 90..93 '[a]': [f64] |
257 | 92..93 'a': f64 | 257 | 91..92 'a': f64 |
258 | 98..124 '{ ... }': () | 258 | 97..123 '{ ... }': () |
259 | 112..113 'a': f64 | 259 | 111..112 'a': f64 |
260 | 134..141 '&[b, c]': &[f64] | 260 | 133..140 '&[b, c]': &[f64] |
261 | 135..141 '[b, c]': [f64] | 261 | 134..140 '[b, c]': [f64] |
262 | 136..137 'b': f64 | 262 | 135..136 'b': f64 |
263 | 139..140 'c': f64 | 263 | 138..139 'c': f64 |
264 | 145..186 '{ ... }': () | 264 | 144..185 '{ ... }': () |
265 | 159..160 'b': f64 | 265 | 158..159 'b': f64 |
266 | 174..175 'c': f64 | 266 | 173..174 'c': f64 |
267 | 195..196 '_': &[f64] | 267 | 194..195 '_': &[f64] |
268 | 200..202 '{}': () | 268 | 199..201 '{}': () |
269 | "### | 269 | "### |
270 | ); | 270 | ); |
271 | } | 271 | } |
@@ -288,25 +288,25 @@ fn test() { | |||
288 | } | 288 | } |
289 | "#), | 289 | "#), |
290 | @r###" | 290 | @r###" |
291 | 11..180 '{ ... } }': () | 291 | 10..179 '{ ... } }': () |
292 | 21..24 'arr': [f64; _] | 292 | 20..23 'arr': [f64; _] |
293 | 37..47 '[0.0, 1.0]': [f64; _] | 293 | 36..46 '[0.0, 1.0]': [f64; _] |
294 | 38..41 '0.0': f64 | 294 | 37..40 '0.0': f64 |
295 | 43..46 '1.0': f64 | 295 | 42..45 '1.0': f64 |
296 | 53..178 'match ... }': () | 296 | 52..177 'match ... }': () |
297 | 59..62 'arr': [f64; _] | 297 | 58..61 'arr': [f64; _] |
298 | 73..81 '[1.0, a]': [f64; _] | 298 | 72..80 '[1.0, a]': [f64; _] |
299 | 74..77 '1.0': f64 | 299 | 73..76 '1.0': f64 |
300 | 74..77 '1.0': f64 | 300 | 73..76 '1.0': f64 |
301 | 79..80 'a': f64 | 301 | 78..79 'a': f64 |
302 | 85..111 '{ ... }': () | 302 | 84..110 '{ ... }': () |
303 | 99..100 'a': f64 | 303 | 98..99 'a': f64 |
304 | 121..127 '[b, c]': [f64; _] | 304 | 120..126 '[b, c]': [f64; _] |
305 | 122..123 'b': f64 | 305 | 121..122 'b': f64 |
306 | 125..126 'c': f64 | 306 | 124..125 'c': f64 |
307 | 131..172 '{ ... }': () | 307 | 130..171 '{ ... }': () |
308 | 145..146 'b': f64 | 308 | 144..145 'b': f64 |
309 | 160..161 'c': f64 | 309 | 159..160 'c': f64 |
310 | "### | 310 | "### |
311 | ); | 311 | ); |
312 | } | 312 | } |
@@ -339,31 +339,31 @@ fn test() { | |||
339 | } | 339 | } |
340 | "#), | 340 | "#), |
341 | @r###" | 341 | @r###" |
342 | 68..289 '{ ... d; }': () | 342 | 67..288 '{ ... d; }': () |
343 | 78..79 'e': E | 343 | 77..78 'e': E |
344 | 82..95 'E::A { x: 3 }': E | 344 | 81..94 'E::A { x: 3 }': E |
345 | 92..93 '3': usize | 345 | 91..92 '3': usize |
346 | 106..113 'S(y, z)': S | 346 | 105..112 'S(y, z)': S |
347 | 108..109 'y': u32 | 347 | 107..108 'y': u32 |
348 | 111..112 'z': E | 348 | 110..111 'z': E |
349 | 116..119 'foo': S | 349 | 115..118 'foo': S |
350 | 129..148 'E::A {..._var }': E | 350 | 128..147 'E::A {..._var }': E |
351 | 139..146 'new_var': usize | 351 | 138..145 'new_var': usize |
352 | 151..152 'e': E | 352 | 150..151 'e': E |
353 | 159..245 'match ... }': usize | 353 | 158..244 'match ... }': usize |
354 | 165..166 'e': E | 354 | 164..165 'e': E |
355 | 177..187 'E::A { x }': E | 355 | 176..186 'E::A { x }': E |
356 | 184..185 'x': usize | 356 | 183..184 'x': usize |
357 | 191..192 'x': usize | 357 | 190..191 'x': usize |
358 | 202..206 'E::B': E | 358 | 201..205 'E::B': E |
359 | 210..213 'foo': bool | 359 | 209..212 'foo': bool |
360 | 217..218 '1': usize | 360 | 216..217 '1': usize |
361 | 228..232 'E::B': E | 361 | 227..231 'E::B': E |
362 | 236..238 '10': usize | 362 | 235..237 '10': usize |
363 | 256..275 'ref d ...{ .. }': &E | 363 | 255..274 'ref d ...{ .. }': &E |
364 | 264..275 'E::A { .. }': E | 364 | 263..274 'E::A { .. }': E |
365 | 278..279 'e': E | 365 | 277..278 'e': E |
366 | 285..286 'd': &E | 366 | 284..285 'd': &E |
367 | "### | 367 | "### |
368 | ); | 368 | ); |
369 | } | 369 | } |
@@ -389,20 +389,20 @@ impl E { | |||
389 | } | 389 | } |
390 | "#), | 390 | "#), |
391 | @r###" | 391 | @r###" |
392 | 76..218 '{ ... }': () | 392 | 75..217 '{ ... }': () |
393 | 86..211 'match ... }': () | 393 | 85..210 'match ... }': () |
394 | 93..100 'loop {}': ! | 394 | 92..99 'loop {}': ! |
395 | 98..100 '{}': () | 395 | 97..99 '{}': () |
396 | 116..129 'Self::A { x }': E | 396 | 115..128 'Self::A { x }': E |
397 | 126..127 'x': usize | 397 | 125..126 'x': usize |
398 | 133..139 '{ x; }': () | 398 | 132..138 '{ x; }': () |
399 | 135..136 'x': usize | 399 | 134..135 'x': usize |
400 | 153..163 'Self::B(x)': E | 400 | 152..162 'Self::B(x)': E |
401 | 161..162 'x': usize | 401 | 160..161 'x': usize |
402 | 167..173 '{ x; }': () | 402 | 166..172 '{ x; }': () |
403 | 169..170 'x': usize | 403 | 168..169 'x': usize |
404 | 187..194 'Self::C': E | 404 | 186..193 'Self::C': E |
405 | 198..200 '{}': () | 405 | 197..199 '{}': () |
406 | "### | 406 | "### |
407 | ); | 407 | ); |
408 | } | 408 | } |
@@ -430,23 +430,23 @@ fn test(a1: A<u32>, o: Option<u64>) { | |||
430 | } | 430 | } |
431 | "#), | 431 | "#), |
432 | @r###" | 432 | @r###" |
433 | 79..81 'a1': A<u32> | 433 | 78..80 'a1': A<u32> |
434 | 91..92 'o': Option<u64> | 434 | 90..91 'o': Option<u64> |
435 | 107..244 '{ ... }; }': () | 435 | 106..243 '{ ... }; }': () |
436 | 117..128 'A { x: x2 }': A<u32> | 436 | 116..127 'A { x: x2 }': A<u32> |
437 | 124..126 'x2': u32 | 437 | 123..125 'x2': u32 |
438 | 131..133 'a1': A<u32> | 438 | 130..132 'a1': A<u32> |
439 | 143..161 'A::<i6...: x3 }': A<i64> | 439 | 142..160 'A::<i6...: x3 }': A<i64> |
440 | 157..159 'x3': i64 | 440 | 156..158 'x3': i64 |
441 | 164..174 'A { x: 1 }': A<i64> | 441 | 163..173 'A { x: 1 }': A<i64> |
442 | 171..172 '1': i64 | 442 | 170..171 '1': i64 |
443 | 180..241 'match ... }': u64 | 443 | 179..240 'match ... }': u64 |
444 | 186..187 'o': Option<u64> | 444 | 185..186 'o': Option<u64> |
445 | 198..213 'Option::Some(t)': Option<u64> | 445 | 197..212 'Option::Some(t)': Option<u64> |
446 | 211..212 't': u64 | 446 | 210..211 't': u64 |
447 | 217..218 't': u64 | 447 | 216..217 't': u64 |
448 | 228..229 '_': Option<u64> | 448 | 227..228 '_': Option<u64> |
449 | 233..234 '1': u64 | 449 | 232..233 '1': u64 |
450 | "### | 450 | "### |
451 | ); | 451 | ); |
452 | } | 452 | } |
@@ -470,27 +470,27 @@ fn test() { | |||
470 | } | 470 | } |
471 | "#, true), | 471 | "#, true), |
472 | @r###" | 472 | @r###" |
473 | 74..75 '1': usize | 473 | 73..74 '1': usize |
474 | 88..310 '{ ...atch }': () | 474 | 87..309 '{ ...atch }': () |
475 | 98..99 'a': Option<u32> | 475 | 97..98 'a': Option<u32> |
476 | 115..119 'None': Option<u32> | 476 | 114..118 'None': Option<u32> |
477 | 129..130 'b': Option<i64> | 477 | 128..129 'b': Option<i64> |
478 | 146..183 'match ... }': Option<i64> | 478 | 145..182 'match ... }': Option<i64> |
479 | 152..153 'a': Option<u32> | 479 | 151..152 'a': Option<u32> |
480 | 164..168 'None': Option<u32> | 480 | 163..167 'None': Option<u32> |
481 | 172..176 'None': Option<i64> | 481 | 171..175 'None': Option<i64> |
482 | 193..194 '_': () | 482 | 192..193 '_': () |
483 | 201..224 'match ... Foo }': Foo | 483 | 200..223 'match ... Foo }': Foo |
484 | 207..209 '()': () | 484 | 206..208 '()': () |
485 | 212..215 'Foo': Foo | 485 | 211..214 'Foo': Foo |
486 | 219..222 'Foo': Foo | 486 | 218..221 'Foo': Foo |
487 | 255..256 '_': () | 487 | 254..255 '_': () |
488 | 263..286 'match ... Bar }': usize | 488 | 262..285 'match ... Bar }': usize |
489 | 269..271 '()': () | 489 | 268..270 '()': () |
490 | 274..277 'Bar': usize | 490 | 273..276 'Bar': usize |
491 | 281..284 'Bar': usize | 491 | 280..283 'Bar': usize |
492 | 201..224: expected (), got Foo | 492 | 200..223: expected (), got Foo |
493 | 263..286: expected (), got usize | 493 | 262..285: expected (), got usize |
494 | "### | 494 | "### |
495 | ); | 495 | ); |
496 | } | 496 | } |
@@ -507,18 +507,18 @@ fn main() { | |||
507 | s if s.foo() => (), | 507 | s if s.foo() => (), |
508 | } | 508 | } |
509 | } | 509 | } |
510 | "#), @" | 510 | "#), @r###" |
511 | 28..32 'self': &S | 511 | 27..31 'self': &S |
512 | 42..51 '{ false }': bool | 512 | 41..50 '{ false }': bool |
513 | 44..49 'false': bool | 513 | 43..48 'false': bool |
514 | 65..116 '{ ... } }': () | 514 | 64..115 '{ ... } }': () |
515 | 71..114 'match ... }': () | 515 | 70..113 'match ... }': () |
516 | 77..78 'S': S | 516 | 76..77 'S': S |
517 | 89..90 's': S | 517 | 88..89 's': S |
518 | 94..95 's': S | 518 | 93..94 's': S |
519 | 94..101 's.foo()': bool | 519 | 93..100 's.foo()': bool |
520 | 105..107 '()': () | 520 | 104..106 '()': () |
521 | ") | 521 | "###) |
522 | } | 522 | } |
523 | 523 | ||
524 | #[test] | 524 | #[test] |
@@ -538,35 +538,35 @@ fn test() { | |||
538 | } | 538 | } |
539 | "#), | 539 | "#), |
540 | @r###" | 540 | @r###" |
541 | 94..95 't': T | 541 | 93..94 't': T |
542 | 100..101 'f': F | 542 | 99..100 'f': F |
543 | 111..122 '{ loop {} }': U | 543 | 110..121 '{ loop {} }': U |
544 | 113..120 'loop {}': ! | 544 | 112..119 'loop {}': ! |
545 | 118..120 '{}': () | 545 | 117..119 '{}': () |
546 | 134..233 '{ ... x); }': () | 546 | 133..232 '{ ... x); }': () |
547 | 140..143 'foo': fn foo<&(i32, &str), i32, |&(i32, &str)| -> i32>(&(i32, &str), |&(i32, &str)| -> i32) -> i32 | 547 | 139..142 'foo': fn foo<&(i32, &str), i32, |&(i32, &str)| -> i32>(&(i32, &str), |&(i32, &str)| -> i32) -> i32 |
548 | 140..167 'foo(&(...y)| x)': i32 | 548 | 139..166 'foo(&(...y)| x)': i32 |
549 | 144..153 '&(1, "a")': &(i32, &str) | 549 | 143..152 '&(1, "a")': &(i32, &str) |
550 | 145..153 '(1, "a")': (i32, &str) | 550 | 144..152 '(1, "a")': (i32, &str) |
551 | 146..147 '1': i32 | 551 | 145..146 '1': i32 |
552 | 149..152 '"a"': &str | 552 | 148..151 '"a"': &str |
553 | 155..166 '|&(x, y)| x': |&(i32, &str)| -> i32 | 553 | 154..165 '|&(x, y)| x': |&(i32, &str)| -> i32 |
554 | 156..163 '&(x, y)': &(i32, &str) | 554 | 155..162 '&(x, y)': &(i32, &str) |
555 | 157..163 '(x, y)': (i32, &str) | 555 | 156..162 '(x, y)': (i32, &str) |
556 | 158..159 'x': i32 | 556 | 157..158 'x': i32 |
557 | 161..162 'y': &str | 557 | 160..161 'y': &str |
558 | 165..166 'x': i32 | 558 | 164..165 'x': i32 |
559 | 204..207 'foo': fn foo<&(i32, &str), &i32, |&(i32, &str)| -> &i32>(&(i32, &str), |&(i32, &str)| -> &i32) -> &i32 | 559 | 203..206 'foo': fn foo<&(i32, &str), &i32, |&(i32, &str)| -> &i32>(&(i32, &str), |&(i32, &str)| -> &i32) -> &i32 |
560 | 204..230 'foo(&(...y)| x)': &i32 | 560 | 203..229 'foo(&(...y)| x)': &i32 |
561 | 208..217 '&(1, "a")': &(i32, &str) | 561 | 207..216 '&(1, "a")': &(i32, &str) |
562 | 209..217 '(1, "a")': (i32, &str) | 562 | 208..216 '(1, "a")': (i32, &str) |
563 | 210..211 '1': i32 | 563 | 209..210 '1': i32 |
564 | 213..216 '"a"': &str | 564 | 212..215 '"a"': &str |
565 | 219..229 '|(x, y)| x': |&(i32, &str)| -> &i32 | 565 | 218..228 '|(x, y)| x': |&(i32, &str)| -> &i32 |
566 | 220..226 '(x, y)': (i32, &str) | 566 | 219..225 '(x, y)': (i32, &str) |
567 | 221..222 'x': &i32 | 567 | 220..221 'x': &i32 |
568 | 224..225 'y': &&str | 568 | 223..224 'y': &&str |
569 | 228..229 'x': &i32 | 569 | 227..228 'x': &i32 |
570 | "### | 570 | "### |
571 | ); | 571 | ); |
572 | } | 572 | } |
diff --git a/crates/ra_hir_ty/src/tests/regression.rs b/crates/ra_hir_ty/src/tests/regression.rs index 4da2e972b..eedaa27ba 100644 --- a/crates/ra_hir_ty/src/tests/regression.rs +++ b/crates/ra_hir_ty/src/tests/regression.rs | |||
@@ -15,11 +15,11 @@ fn test() { | |||
15 | } | 15 | } |
16 | "#), | 16 | "#), |
17 | @r###" | 17 | @r###" |
18 | 11..37 '{ l... {}; }': () | 18 | 10..36 '{ l... {}; }': () |
19 | 20..21 'x': () | 19 | 19..20 'x': () |
20 | 24..34 'if true {}': () | 20 | 23..33 'if true {}': () |
21 | 27..31 'true': bool | 21 | 26..30 'true': bool |
22 | 32..34 '{}': () | 22 | 31..33 '{}': () |
23 | "### | 23 | "### |
24 | ); | 24 | ); |
25 | } | 25 | } |
@@ -35,10 +35,10 @@ fn test(x: X) { | |||
35 | } | 35 | } |
36 | "#), | 36 | "#), |
37 | @r###" | 37 | @r###" |
38 | 20..21 'x': X | 38 | 19..20 'x': X |
39 | 26..47 '{ ...eld; }': () | 39 | 25..46 '{ ...eld; }': () |
40 | 32..33 'x': X | 40 | 31..32 'x': X |
41 | 32..44 'x.some_field': {unknown} | 41 | 31..43 'x.some_field': {unknown} |
42 | "### | 42 | "### |
43 | ); | 43 | ); |
44 | } | 44 | } |
@@ -56,14 +56,14 @@ fn test() { | |||
56 | } | 56 | } |
57 | "#), | 57 | "#), |
58 | @r###" | 58 | @r###" |
59 | 11..89 '{ ... } }': () | 59 | 10..88 '{ ... } }': () |
60 | 17..21 'X {}': {unknown} | 60 | 16..20 'X {}': {unknown} |
61 | 27..87 'match ... }': () | 61 | 26..86 'match ... }': () |
62 | 33..34 'x': {unknown} | 62 | 32..33 'x': {unknown} |
63 | 45..52 'A::B {}': {unknown} | 63 | 44..51 'A::B {}': {unknown} |
64 | 56..58 '()': () | 64 | 55..57 '()': () |
65 | 68..74 'A::Y()': {unknown} | 65 | 67..73 'A::Y()': {unknown} |
66 | 78..80 '()': () | 66 | 77..79 '()': () |
67 | "### | 67 | "### |
68 | ); | 68 | ); |
69 | } | 69 | } |
@@ -78,12 +78,12 @@ fn quux() { | |||
78 | } | 78 | } |
79 | "#), | 79 | "#), |
80 | @r###" | 80 | @r###" |
81 | 11..41 '{ ...+ y; }': () | 81 | 10..40 '{ ...+ y; }': () |
82 | 21..22 'y': i32 | 82 | 20..21 'y': i32 |
83 | 25..27 '92': i32 | 83 | 24..26 '92': i32 |
84 | 33..34 '1': i32 | 84 | 32..33 '1': i32 |
85 | 33..38 '1 + y': i32 | 85 | 32..37 '1 + y': i32 |
86 | 37..38 'y': i32 | 86 | 36..37 'y': i32 |
87 | "### | 87 | "### |
88 | ); | 88 | ); |
89 | } | 89 | } |
@@ -100,13 +100,13 @@ fn test() { | |||
100 | } | 100 | } |
101 | "#), | 101 | "#), |
102 | @r###" | 102 | @r###" |
103 | 11..48 '{ ...&y]; }': () | 103 | 10..47 '{ ...&y]; }': () |
104 | 21..22 'y': &{unknown} | 104 | 20..21 'y': &{unknown} |
105 | 25..32 'unknown': &{unknown} | 105 | 24..31 'unknown': &{unknown} |
106 | 38..45 '[y, &y]': [&&{unknown}; _] | 106 | 37..44 '[y, &y]': [&&{unknown}; _] |
107 | 39..40 'y': &{unknown} | 107 | 38..39 'y': &{unknown} |
108 | 42..44 '&y': &&{unknown} | 108 | 41..43 '&y': &&{unknown} |
109 | 43..44 'y': &{unknown} | 109 | 42..43 'y': &{unknown} |
110 | "### | 110 | "### |
111 | ); | 111 | ); |
112 | } | 112 | } |
@@ -122,20 +122,20 @@ fn test() { | |||
122 | } | 122 | } |
123 | "#), | 123 | "#), |
124 | @r###" | 124 | @r###" |
125 | 11..80 '{ ...x)]; }': () | 125 | 10..79 '{ ...x)]; }': () |
126 | 21..22 'x': &&{unknown} | 126 | 20..21 'x': &&{unknown} |
127 | 25..32 'unknown': &&{unknown} | 127 | 24..31 'unknown': &&{unknown} |
128 | 42..43 'y': &&{unknown} | 128 | 41..42 'y': &&{unknown} |
129 | 46..53 'unknown': &&{unknown} | 129 | 45..52 'unknown': &&{unknown} |
130 | 59..77 '[(x, y..., &x)]': [(&&&{unknown}, &&&{unknown}); _] | 130 | 58..76 '[(x, y..., &x)]': [(&&&{unknown}, &&&{unknown}); _] |
131 | 60..66 '(x, y)': (&&&{unknown}, &&&{unknown}) | 131 | 59..65 '(x, y)': (&&&{unknown}, &&&{unknown}) |
132 | 61..62 'x': &&{unknown} | 132 | 60..61 'x': &&{unknown} |
133 | 64..65 'y': &&{unknown} | 133 | 63..64 'y': &&{unknown} |
134 | 68..76 '(&y, &x)': (&&&{unknown}, &&&{unknown}) | 134 | 67..75 '(&y, &x)': (&&&{unknown}, &&&{unknown}) |
135 | 69..71 '&y': &&&{unknown} | 135 | 68..70 '&y': &&&{unknown} |
136 | 70..71 'y': &&{unknown} | 136 | 69..70 'y': &&{unknown} |
137 | 73..75 '&x': &&&{unknown} | 137 | 72..74 '&x': &&&{unknown} |
138 | 74..75 'x': &&{unknown} | 138 | 73..74 'x': &&{unknown} |
139 | "### | 139 | "### |
140 | ); | 140 | ); |
141 | } | 141 | } |
@@ -157,12 +157,12 @@ fn write() { | |||
157 | } | 157 | } |
158 | "#), | 158 | "#), |
159 | @r###" | 159 | @r###" |
160 | 54..139 '{ ... } }': () | 160 | 53..138 '{ ... } }': () |
161 | 60..137 'match ... }': () | 161 | 59..136 'match ... }': () |
162 | 66..83 'someth...nknown': Maybe<{unknown}> | 162 | 65..82 'someth...nknown': Maybe<{unknown}> |
163 | 94..124 'Maybe:...thing)': Maybe<{unknown}> | 163 | 93..123 'Maybe:...thing)': Maybe<{unknown}> |
164 | 106..123 'ref mu...ething': &mut {unknown} | 164 | 105..122 'ref mu...ething': &mut {unknown} |
165 | 128..130 '()': () | 165 | 127..129 '()': () |
166 | "### | 166 | "### |
167 | ); | 167 | ); |
168 | } | 168 | } |
@@ -178,13 +178,13 @@ fn test_line_buffer() { | |||
178 | } | 178 | } |
179 | "#), | 179 | "#), |
180 | @r###" | 180 | @r###" |
181 | 23..53 '{ ...n']; }': () | 181 | 22..52 '{ ...n']; }': () |
182 | 29..50 '&[0, b...b'\n']': &[u8; _] | 182 | 28..49 '&[0, b...b'\n']': &[u8; _] |
183 | 30..50 '[0, b'...b'\n']': [u8; _] | 183 | 29..49 '[0, b'...b'\n']': [u8; _] |
184 | 31..32 '0': u8 | 184 | 30..31 '0': u8 |
185 | 34..39 'b'\n'': u8 | 185 | 33..38 'b'\n'': u8 |
186 | 41..42 '1': u8 | 186 | 40..41 '1': u8 |
187 | 44..49 'b'\n'': u8 | 187 | 43..48 'b'\n'': u8 |
188 | "### | 188 | "### |
189 | ); | 189 | ); |
190 | } | 190 | } |
@@ -201,14 +201,14 @@ pub fn compute() { | |||
201 | } | 201 | } |
202 | "#), | 202 | "#), |
203 | @r###" | 203 | @r###" |
204 | 18..108 '{ ... } }': () | 204 | 17..107 '{ ... } }': () |
205 | 24..106 'match ... }': () | 205 | 23..105 'match ... }': () |
206 | 30..37 'nope!()': {unknown} | 206 | 29..36 'nope!()': {unknown} |
207 | 48..94 'SizeSk...tail }': {unknown} | 207 | 47..93 'SizeSk...tail }': {unknown} |
208 | 82..86 'true': bool | 208 | 81..85 'true': bool |
209 | 82..86 'true': bool | 209 | 81..85 'true': bool |
210 | 88..92 'tail': {unknown} | 210 | 87..91 'tail': {unknown} |
211 | 98..100 '{}': () | 211 | 97..99 '{}': () |
212 | "### | 212 | "### |
213 | ); | 213 | ); |
214 | } | 214 | } |
@@ -225,14 +225,14 @@ pub fn primitive_type() { | |||
225 | } | 225 | } |
226 | "#), | 226 | "#), |
227 | @r###" | 227 | @r###" |
228 | 25..106 '{ ... } }': () | 228 | 24..105 '{ ... } }': () |
229 | 31..104 'match ... }': () | 229 | 30..103 'match ... }': () |
230 | 37..42 '*self': {unknown} | 230 | 36..41 '*self': {unknown} |
231 | 38..42 'self': {unknown} | 231 | 37..41 'self': {unknown} |
232 | 53..91 'Borrow...), ..}': {unknown} | 232 | 52..90 'Borrow...), ..}': {unknown} |
233 | 74..86 'Primitive(p)': {unknown} | 233 | 73..85 'Primitive(p)': {unknown} |
234 | 84..85 'p': {unknown} | 234 | 83..84 'p': {unknown} |
235 | 95..97 '{}': () | 235 | 94..96 '{}': () |
236 | "### | 236 | "### |
237 | ); | 237 | ); |
238 | } | 238 | } |
@@ -259,29 +259,29 @@ fn extra_compiler_flags() { | |||
259 | } | 259 | } |
260 | "#), | 260 | "#), |
261 | @r###" | 261 | @r###" |
262 | 27..323 '{ ... } }': () | 262 | 26..322 '{ ... } }': () |
263 | 33..321 'for co... }': () | 263 | 32..320 'for co... }': () |
264 | 37..44 'content': &{unknown} | 264 | 36..43 'content': &{unknown} |
265 | 48..61 'doesnt_matter': {unknown} | 265 | 47..60 'doesnt_matter': {unknown} |
266 | 62..321 '{ ... }': () | 266 | 61..320 '{ ... }': () |
267 | 76..80 'name': &&{unknown} | 267 | 75..79 'name': &&{unknown} |
268 | 83..167 'if doe... }': &&{unknown} | 268 | 82..166 'if doe... }': &&{unknown} |
269 | 86..99 'doesnt_matter': bool | 269 | 85..98 'doesnt_matter': bool |
270 | 100..129 '{ ... }': &&{unknown} | 270 | 99..128 '{ ... }': &&{unknown} |
271 | 114..119 'first': &&{unknown} | 271 | 113..118 'first': &&{unknown} |
272 | 135..167 '{ ... }': &&{unknown} | 272 | 134..166 '{ ... }': &&{unknown} |
273 | 149..157 '&content': &&{unknown} | 273 | 148..156 '&content': &&{unknown} |
274 | 150..157 'content': &{unknown} | 274 | 149..156 'content': &{unknown} |
275 | 182..189 'content': &{unknown} | 275 | 181..188 'content': &{unknown} |
276 | 192..314 'if ICE... }': &{unknown} | 276 | 191..313 'if ICE... }': &{unknown} |
277 | 195..232 'ICE_RE..._VALUE': {unknown} | 277 | 194..231 'ICE_RE..._VALUE': {unknown} |
278 | 195..248 'ICE_RE...&name)': bool | 278 | 194..247 'ICE_RE...&name)': bool |
279 | 242..247 '&name': &&&{unknown} | 279 | 241..246 '&name': &&&{unknown} |
280 | 243..247 'name': &&{unknown} | 280 | 242..246 'name': &&{unknown} |
281 | 249..277 '{ ... }': &&{unknown} | 281 | 248..276 '{ ... }': &&{unknown} |
282 | 263..267 'name': &&{unknown} | 282 | 262..266 'name': &&{unknown} |
283 | 283..314 '{ ... }': &{unknown} | 283 | 282..313 '{ ... }': &{unknown} |
284 | 297..304 'content': &{unknown} | 284 | 296..303 'content': &{unknown} |
285 | "### | 285 | "### |
286 | ); | 286 | ); |
287 | } | 287 | } |
@@ -302,11 +302,11 @@ fn test<R>(query_response: Canonical<QueryResponse<R>>) { | |||
302 | } | 302 | } |
303 | "#), | 303 | "#), |
304 | @r###" | 304 | @r###" |
305 | 92..106 'query_response': Canonical<QueryResponse<R>> | 305 | 91..105 'query_response': Canonical<QueryResponse<R>> |
306 | 137..167 '{ ...lue; }': () | 306 | 136..166 '{ ...lue; }': () |
307 | 143..164 '&query....value': &QueryResponse<R> | 307 | 142..163 '&query....value': &QueryResponse<R> |
308 | 144..158 'query_response': Canonical<QueryResponse<R>> | 308 | 143..157 'query_response': Canonical<QueryResponse<R>> |
309 | 144..164 'query_....value': QueryResponse<R> | 309 | 143..163 'query_....value': QueryResponse<R> |
310 | "### | 310 | "### |
311 | ); | 311 | ); |
312 | } | 312 | } |
@@ -322,9 +322,9 @@ fn test() { | |||
322 | "#), | 322 | "#), |
323 | @r###" | 323 | @r###" |
324 | !0..4 '0u32': u32 | 324 | !0..4 '0u32': u32 |
325 | 45..70 '{ ...()); }': () | 325 | 44..69 '{ ...()); }': () |
326 | 55..56 'a': u32 | 326 | 54..55 'a': u32 |
327 | "### | 327 | "### |
328 | ); | 328 | ); |
329 | } | 329 | } |
330 | 330 | ||
@@ -344,10 +344,10 @@ pub fn main_loop() { | |||
344 | } | 344 | } |
345 | "#), | 345 | "#), |
346 | @r###" | 346 | @r###" |
347 | 144..146 '{}': () | 347 | 143..145 '{}': () |
348 | 169..198 '{ ...t(); }': () | 348 | 168..197 '{ ...t(); }': () |
349 | 175..193 'FxHash...efault': fn default<{unknown}, FxHasher>() -> HashSet<{unknown}, FxHasher> | 349 | 174..192 'FxHash...efault': fn default<{unknown}, FxHasher>() -> HashSet<{unknown}, FxHasher> |
350 | 175..195 'FxHash...ault()': HashSet<{unknown}, FxHasher> | 350 | 174..194 'FxHash...ault()': HashSet<{unknown}, FxHasher> |
351 | "### | 351 | "### |
352 | ); | 352 | ); |
353 | } | 353 | } |
@@ -395,9 +395,9 @@ fn test() { | |||
395 | } | 395 | } |
396 | "#), | 396 | "#), |
397 | @r###" | 397 | @r###" |
398 | 26..53 '{ ...oo() }': () | 398 | 25..52 '{ ...oo() }': () |
399 | 32..49 '<Trait...>::foo': {unknown} | 399 | 31..48 '<Trait...>::foo': {unknown} |
400 | 32..51 '<Trait...:foo()': () | 400 | 31..50 '<Trait...:foo()': () |
401 | "### | 401 | "### |
402 | ); | 402 | ); |
403 | } | 403 | } |
@@ -495,13 +495,13 @@ fn foo(params: &[usize]) { | |||
495 | } | 495 | } |
496 | "#), | 496 | "#), |
497 | @r###" | 497 | @r###" |
498 | 8..14 'params': &[usize] | 498 | 7..13 'params': &[usize] |
499 | 26..81 '{ ... } }': () | 499 | 25..80 '{ ... } }': () |
500 | 32..79 'match ... }': () | 500 | 31..78 'match ... }': () |
501 | 38..44 'params': &[usize] | 501 | 37..43 'params': &[usize] |
502 | 55..67 '[ps @ .., _]': [usize] | 502 | 54..66 '[ps @ .., _]': [usize] |
503 | 65..66 '_': usize | 503 | 64..65 '_': usize |
504 | 71..73 '{}': () | 504 | 70..72 '{}': () |
505 | "### | 505 | "### |
506 | ); | 506 | ); |
507 | } | 507 | } |
@@ -522,13 +522,13 @@ fn foo(b: Bar) { | |||
522 | } | 522 | } |
523 | "#), | 523 | "#), |
524 | @r###" | 524 | @r###" |
525 | 36..37 'b': Bar | 525 | 35..36 'b': Bar |
526 | 44..96 '{ ... } }': () | 526 | 43..95 '{ ... } }': () |
527 | 50..94 'match ... }': () | 527 | 49..93 'match ... }': () |
528 | 56..57 'b': Bar | 528 | 55..56 'b': Bar |
529 | 68..81 'Bar { a: .. }': Bar | 529 | 67..80 'Bar { a: .. }': Bar |
530 | 77..79 '..': bool | 530 | 76..78 '..': bool |
531 | 85..87 '{}': () | 531 | 84..86 '{}': () |
532 | "### | 532 | "### |
533 | ); | 533 | ); |
534 | } | 534 | } |
@@ -549,16 +549,16 @@ fn main() { | |||
549 | a.foo(); | 549 | a.foo(); |
550 | } | 550 | } |
551 | "#), @r###" | 551 | "#), @r###" |
552 | 32..38 'FOO {}': FOO | 552 | 31..37 'FOO {}': FOO |
553 | 64..68 'self': &FOO | 553 | 63..67 'self': &FOO |
554 | 70..72 '{}': () | 554 | 69..71 '{}': () |
555 | 86..120 '{ ...o(); }': () | 555 | 85..119 '{ ...o(); }': () |
556 | 96..97 'a': &FOO | 556 | 95..96 'a': &FOO |
557 | 100..104 '&FOO': &FOO | 557 | 99..103 '&FOO': &FOO |
558 | 101..104 'FOO': FOO | 558 | 100..103 'FOO': FOO |
559 | 110..111 'a': &FOO | 559 | 109..110 'a': &FOO |
560 | 110..117 'a.foo()': () | 560 | 109..116 'a.foo()': () |
561 | "### | 561 | "### |
562 | ); | 562 | ); |
563 | } | 563 | } |
564 | 564 | ||
@@ -580,17 +580,17 @@ fn main() { | |||
580 | let _a = foo!(); | 580 | let _a = foo!(); |
581 | } | 581 | } |
582 | "#), @r###" | 582 | "#), @r###" |
583 | 45..60 '{ loop {} }': T | 583 | 44..59 '{ loop {} }': T |
584 | 51..58 'loop {}': ! | 584 | 50..57 'loop {}': ! |
585 | 56..58 '{}': () | 585 | 55..57 '{}': () |
586 | !0..31 '{letr:...g();r}': Foo | 586 | !0..31 '{letr:...g();r}': Foo |
587 | !4..5 'r': Foo | 587 | !4..5 'r': Foo |
588 | !18..26 'anything': fn anything<Foo>() -> Foo | 588 | !18..26 'anything': fn anything<Foo>() -> Foo |
589 | !18..28 'anything()': Foo | 589 | !18..28 'anything()': Foo |
590 | !29..30 'r': Foo | 590 | !29..30 'r': Foo |
591 | 164..188 '{ ...!(); }': () | 591 | 163..187 '{ ...!(); }': () |
592 | 174..176 '_a': Foo | 592 | 173..175 '_a': Foo |
593 | "###); | 593 | "###); |
594 | } | 594 | } |
595 | 595 | ||
596 | #[test] | 596 | #[test] |
@@ -623,13 +623,13 @@ where | |||
623 | } | 623 | } |
624 | "#), | 624 | "#), |
625 | @r###" | 625 | @r###" |
626 | 66..70 'self': Self | 626 | 65..69 'self': Self |
627 | 268..272 'self': Self | 627 | 267..271 'self': Self |
628 | 467..471 'self': SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}> | 628 | 466..470 'self': SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}> |
629 | 489..523 '{ ... }': () | 629 | 488..522 '{ ... }': () |
630 | 499..503 'self': SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}> | 630 | 498..502 'self': SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}> |
631 | 499..509 'self.order': O | 631 | 498..508 'self.order': O |
632 | 499..516 'self.o...into()': dyn QueryFragment<DB> | 632 | 498..515 'self.o...into()': dyn QueryFragment<DB> |
633 | "### | 633 | "### |
634 | ); | 634 | ); |
635 | } | 635 | } |
@@ -644,10 +644,10 @@ impl Foo { | |||
644 | } | 644 | } |
645 | "#), | 645 | "#), |
646 | @r###" | 646 | @r###" |
647 | 59..73 '{ Self(0i64) }': Foo | 647 | 58..72 '{ Self(0i64) }': Foo |
648 | 61..65 'Self': Foo(i64) -> Foo | 648 | 60..64 'Self': Foo(i64) -> Foo |
649 | 61..71 'Self(0i64)': Foo | 649 | 60..70 'Self(0i64)': Foo |
650 | 66..70 '0i64': i64 | 650 | 65..69 '0i64': i64 |
651 | "### | 651 | "### |
652 | ); | 652 | ); |
653 | assert_snapshot!( | 653 | assert_snapshot!( |
@@ -658,10 +658,10 @@ impl Foo<i64> { | |||
658 | } | 658 | } |
659 | "#), | 659 | "#), |
660 | @r###" | 660 | @r###" |
661 | 65..79 '{ Self(0i64) }': Foo<i64> | 661 | 64..78 '{ Self(0i64) }': Foo<i64> |
662 | 67..71 'Self': Foo<i64>(i64) -> Foo<i64> | 662 | 66..70 'Self': Foo<i64>(i64) -> Foo<i64> |
663 | 67..77 'Self(0i64)': Foo<i64> | 663 | 66..76 'Self(0i64)': Foo<i64> |
664 | 72..76 '0i64': i64 | 664 | 71..75 '0i64': i64 |
665 | "### | 665 | "### |
666 | ); | 666 | ); |
667 | } | 667 | } |
@@ -685,11 +685,11 @@ fn check<T: PrimInt>(i: T) { | |||
685 | } | 685 | } |
686 | "#), | 686 | "#), |
687 | @r###" | 687 | @r###" |
688 | 118..122 'self': Self | 688 | 117..121 'self': Self |
689 | 149..150 'i': T | 689 | 148..149 'i': T |
690 | 155..171 '{ ...w(); }': () | 690 | 154..170 '{ ...w(); }': () |
691 | 161..162 'i': T | 691 | 160..161 'i': T |
692 | 161..168 'i.pow()': () | 692 | 160..167 'i.pow()': () |
693 | "### | 693 | "### |
694 | ); | 694 | ); |
695 | } | 695 | } |
@@ -720,13 +720,13 @@ where | |||
720 | } | 720 | } |
721 | "#), | 721 | "#), |
722 | @r###" | 722 | @r###" |
723 | 137..140 'key': &K | 723 | 136..139 'key': &K |
724 | 199..215 '{ ...key) }': impl Future<Output = <K as Foo<R>>::Bar> | 724 | 198..214 '{ ...key) }': impl Future<Output = <K as Foo<R>>::Bar> |
725 | 205..208 'bar': fn bar<R, K>(&K) -> impl Future<Output = <K as Foo<R>>::Bar> | 725 | 204..207 'bar': fn bar<R, K>(&K) -> impl Future<Output = <K as Foo<R>>::Bar> |
726 | 205..213 'bar(key)': impl Future<Output = <K as Foo<R>>::Bar> | 726 | 204..212 'bar(key)': impl Future<Output = <K as Foo<R>>::Bar> |
727 | 209..212 'key': &K | 727 | 208..211 'key': &K |
728 | 229..232 'key': &K | 728 | 228..231 'key': &K |
729 | 291..294 '{ }': () | 729 | 290..293 '{ }': () |
730 | "### | 730 | "### |
731 | ); | 731 | ); |
732 | } | 732 | } |
@@ -776,11 +776,11 @@ pub trait Service<Request> { | |||
776 | } | 776 | } |
777 | "#), | 777 | "#), |
778 | @r###" | 778 | @r###" |
779 | 380..384 'self': &mut PeerSet<D> | 779 | 379..383 'self': &mut PeerSet<D> |
780 | 402..425 '{ ... }': dyn Future<Output = ()> | 780 | 401..424 '{ ... }': dyn Future<Output = ()> |
781 | 412..419 'loop {}': ! | 781 | 411..418 'loop {}': ! |
782 | 417..419 '{}': () | 782 | 416..418 '{}': () |
783 | 576..580 'self': &mut Self | 783 | 575..579 'self': &mut Self |
784 | "### | 784 | "### |
785 | ); | 785 | ); |
786 | } | 786 | } |
diff --git a/crates/ra_hir_ty/src/tests/simple.rs b/crates/ra_hir_ty/src/tests/simple.rs index 37659cd02..d7ef9add6 100644 --- a/crates/ra_hir_ty/src/tests/simple.rs +++ b/crates/ra_hir_ty/src/tests/simple.rs | |||
@@ -64,9 +64,9 @@ impl S<u32> { | |||
64 | } | 64 | } |
65 | "#, | 65 | "#, |
66 | ), @r###" | 66 | ), @r###" |
67 | 63..93 '{ ... }': () | 67 | 49..79 '{ ... }': () |
68 | 73..86 'Self { x: 1 }': S<u32> | 68 | 59..72 'Self { x: 1 }': S<u32> |
69 | 83..84 '1': u32 | 69 | 69..70 '1': u32 |
70 | "###); | 70 | "###); |
71 | } | 71 | } |
72 | 72 | ||
@@ -85,9 +85,9 @@ fn foo() { | |||
85 | 85 | ||
86 | "#, | 86 | "#, |
87 | ), @r###" | 87 | ), @r###" |
88 | 64..84 '{ ...1 }; }': () | 88 | 50..70 '{ ...1 }; }': () |
89 | 70..81 'SS { x: 1 }': S<u32> | 89 | 56..67 'SS { x: 1 }': S<u32> |
90 | 78..79 '1': u32 | 90 | 64..65 '1': u32 |
91 | "###); | 91 | "###); |
92 | } | 92 | } |
93 | 93 | ||
@@ -175,19 +175,19 @@ fn test(a: u32, b: isize, c: !, d: &str) { | |||
175 | 1.0f32; | 175 | 1.0f32; |
176 | }"#), | 176 | }"#), |
177 | @r###" | 177 | @r###" |
178 | 9..10 'a': u32 | 178 | 8..9 'a': u32 |
179 | 17..18 'b': isize | 179 | 16..17 'b': isize |
180 | 27..28 'c': ! | 180 | 26..27 'c': ! |
181 | 33..34 'd': &str | 181 | 32..33 'd': &str |
182 | 42..121 '{ ...f32; }': () | 182 | 41..120 '{ ...f32; }': () |
183 | 48..49 'a': u32 | 183 | 47..48 'a': u32 |
184 | 55..56 'b': isize | 184 | 54..55 'b': isize |
185 | 62..63 'c': ! | 185 | 61..62 'c': ! |
186 | 69..70 'd': &str | 186 | 68..69 'd': &str |
187 | 76..82 '1usize': usize | 187 | 75..81 '1usize': usize |
188 | 88..94 '1isize': isize | 188 | 87..93 '1isize': isize |
189 | 100..106 '"test"': &str | 189 | 99..105 '"test"': &str |
190 | 112..118 '1.0f32': f32 | 190 | 111..117 '1.0f32': f32 |
191 | "### | 191 | "### |
192 | ); | 192 | ); |
193 | } | 193 | } |
@@ -206,17 +206,17 @@ fn test() { | |||
206 | } | 206 | } |
207 | "#), | 207 | "#), |
208 | @r###" | 208 | @r###" |
209 | 11..118 '{ ...= e; }': () | 209 | 10..117 '{ ...= e; }': () |
210 | 21..22 'a': isize | 210 | 20..21 'a': isize |
211 | 25..31 '1isize': isize | 211 | 24..30 '1isize': isize |
212 | 41..42 'b': usize | 212 | 40..41 'b': usize |
213 | 52..53 '1': usize | 213 | 51..52 '1': usize |
214 | 63..64 'c': usize | 214 | 62..63 'c': usize |
215 | 67..68 'b': usize | 215 | 66..67 'b': usize |
216 | 78..79 'd': u32 | 216 | 77..78 'd': u32 |
217 | 94..95 'e': i32 | 217 | 93..94 'e': i32 |
218 | 105..106 'f': i32 | 218 | 104..105 'f': i32 |
219 | 114..115 'e': i32 | 219 | 113..114 'e': i32 |
220 | "### | 220 | "### |
221 | ); | 221 | ); |
222 | } | 222 | } |
@@ -237,15 +237,15 @@ fn test() { | |||
237 | } | 237 | } |
238 | "#), | 238 | "#), |
239 | @r###" | 239 | @r###" |
240 | 15..20 '{ 1 }': u32 | 240 | 14..19 '{ 1 }': u32 |
241 | 17..18 '1': u32 | 241 | 16..17 '1': u32 |
242 | 48..53 '{ 1 }': u32 | 242 | 47..52 '{ 1 }': u32 |
243 | 50..51 '1': u32 | 243 | 49..50 '1': u32 |
244 | 67..91 '{ ...c(); }': () | 244 | 66..90 '{ ...c(); }': () |
245 | 73..74 'a': fn a() -> u32 | 245 | 72..73 'a': fn a() -> u32 |
246 | 73..76 'a()': u32 | 246 | 72..75 'a()': u32 |
247 | 82..86 'b::c': fn c() -> u32 | 247 | 81..85 'b::c': fn c() -> u32 |
248 | 82..88 'b::c()': u32 | 248 | 81..87 'b::c()': u32 |
249 | "### | 249 | "### |
250 | ); | 250 | ); |
251 | } | 251 | } |
@@ -266,13 +266,13 @@ fn test() { | |||
266 | } | 266 | } |
267 | "#), | 267 | "#), |
268 | @r###" | 268 | @r###" |
269 | 41..46 '{ 1 }': i32 | 269 | 40..45 '{ 1 }': i32 |
270 | 43..44 '1': i32 | 270 | 42..43 '1': i32 |
271 | 60..93 '{ ...o(); }': () | 271 | 59..92 '{ ...o(); }': () |
272 | 66..72 'S::foo': fn foo() -> i32 | 272 | 65..71 'S::foo': fn foo() -> i32 |
273 | 66..74 'S::foo()': i32 | 273 | 65..73 'S::foo()': i32 |
274 | 80..88 '<S>::foo': fn foo() -> i32 | 274 | 79..87 '<S>::foo': fn foo() -> i32 |
275 | 80..90 '<S>::foo()': i32 | 275 | 79..89 '<S>::foo()': i32 |
276 | "### | 276 | "### |
277 | ); | 277 | ); |
278 | } | 278 | } |
@@ -297,22 +297,22 @@ fn test() { | |||
297 | } | 297 | } |
298 | "#), | 298 | "#), |
299 | @r###" | 299 | @r###" |
300 | 72..154 '{ ...a.c; }': () | 300 | 71..153 '{ ...a.c; }': () |
301 | 82..83 'c': C | 301 | 81..82 'c': C |
302 | 86..87 'C': C(usize) -> C | 302 | 85..86 'C': C(usize) -> C |
303 | 86..90 'C(1)': C | 303 | 85..89 'C(1)': C |
304 | 88..89 '1': usize | 304 | 87..88 '1': usize |
305 | 96..97 'B': B | 305 | 95..96 'B': B |
306 | 107..108 'a': A | 306 | 106..107 'a': A |
307 | 114..133 'A { b:...C(1) }': A | 307 | 113..132 'A { b:...C(1) }': A |
308 | 121..122 'B': B | 308 | 120..121 'B': B |
309 | 127..128 'C': C(usize) -> C | 309 | 126..127 'C': C(usize) -> C |
310 | 127..131 'C(1)': C | 310 | 126..130 'C(1)': C |
311 | 129..130 '1': usize | 311 | 128..129 '1': usize |
312 | 139..140 'a': A | 312 | 138..139 'a': A |
313 | 139..142 'a.b': B | 313 | 138..141 'a.b': B |
314 | 148..149 'a': A | 314 | 147..148 'a': A |
315 | 148..151 'a.c': C | 315 | 147..150 'a.c': C |
316 | "### | 316 | "### |
317 | ); | 317 | ); |
318 | } | 318 | } |
@@ -330,10 +330,10 @@ fn test() { | |||
330 | E::V2; | 330 | E::V2; |
331 | }"#), | 331 | }"#), |
332 | @r###" | 332 | @r###" |
333 | 48..82 '{ E:...:V2; }': () | 333 | 47..81 '{ E:...:V2; }': () |
334 | 52..70 'E::V1 ...d: 1 }': E | 334 | 51..69 'E::V1 ...d: 1 }': E |
335 | 67..68 '1': u32 | 335 | 66..67 '1': u32 |
336 | 74..79 'E::V2': E | 336 | 73..78 'E::V2': E |
337 | "### | 337 | "### |
338 | ); | 338 | ); |
339 | } | 339 | } |
@@ -357,29 +357,29 @@ fn test(a: &u32, b: &mut u32, c: *const u32, d: *mut u32) { | |||
357 | } | 357 | } |
358 | "#), | 358 | "#), |
359 | @r###" | 359 | @r###" |
360 | 9..10 'a': &u32 | 360 | 8..9 'a': &u32 |
361 | 18..19 'b': &mut u32 | 361 | 17..18 'b': &mut u32 |
362 | 31..32 'c': *const u32 | 362 | 30..31 'c': *const u32 |
363 | 46..47 'd': *mut u32 | 363 | 45..46 'd': *mut u32 |
364 | 59..150 '{ ... *d; }': () | 364 | 58..149 '{ ... *d; }': () |
365 | 65..66 'a': &u32 | 365 | 64..65 'a': &u32 |
366 | 72..74 '*a': u32 | 366 | 71..73 '*a': u32 |
367 | 73..74 'a': &u32 | 367 | 72..73 'a': &u32 |
368 | 80..82 '&a': &&u32 | 368 | 79..81 '&a': &&u32 |
369 | 81..82 'a': &u32 | 369 | 80..81 'a': &u32 |
370 | 88..94 '&mut a': &mut &u32 | 370 | 87..93 '&mut a': &mut &u32 |
371 | 93..94 'a': &u32 | 371 | 92..93 'a': &u32 |
372 | 100..101 'b': &mut u32 | 372 | 99..100 'b': &mut u32 |
373 | 107..109 '*b': u32 | 373 | 106..108 '*b': u32 |
374 | 108..109 'b': &mut u32 | 374 | 107..108 'b': &mut u32 |
375 | 115..117 '&b': &&mut u32 | 375 | 114..116 '&b': &&mut u32 |
376 | 116..117 'b': &mut u32 | 376 | 115..116 'b': &mut u32 |
377 | 123..124 'c': *const u32 | 377 | 122..123 'c': *const u32 |
378 | 130..132 '*c': u32 | 378 | 129..131 '*c': u32 |
379 | 131..132 'c': *const u32 | 379 | 130..131 'c': *const u32 |
380 | 138..139 'd': *mut u32 | 380 | 137..138 'd': *mut u32 |
381 | 145..147 '*d': u32 | 381 | 144..146 '*d': u32 |
382 | 146..147 'd': *mut u32 | 382 | 145..146 'd': *mut u32 |
383 | "### | 383 | "### |
384 | ); | 384 | ); |
385 | } | 385 | } |
@@ -394,12 +394,12 @@ fn test(a: i32) { | |||
394 | } | 394 | } |
395 | "#), | 395 | "#), |
396 | @r###" | 396 | @r###" |
397 | 9..10 'a': i32 | 397 | 8..9 'a': i32 |
398 | 17..54 '{ ...t a; }': () | 398 | 16..53 '{ ...t a; }': () |
399 | 23..33 '&raw mut a': *mut i32 | 399 | 22..32 '&raw mut a': *mut i32 |
400 | 32..33 'a': i32 | 400 | 31..32 'a': i32 |
401 | 39..51 '&raw const a': *const i32 | 401 | 38..50 '&raw const a': *const i32 |
402 | 50..51 'a': i32 | 402 | 49..50 'a': i32 |
403 | "### | 403 | "### |
404 | ); | 404 | ); |
405 | } | 405 | } |
@@ -429,20 +429,20 @@ fn test() { | |||
429 | } | 429 | } |
430 | "##), | 430 | "##), |
431 | @r###" | 431 | @r###" |
432 | 11..221 '{ ...o"#; }': () | 432 | 10..220 '{ ...o"#; }': () |
433 | 17..21 '5i32': i32 | 433 | 16..20 '5i32': i32 |
434 | 27..31 '5f32': f32 | 434 | 26..30 '5f32': f32 |
435 | 37..41 '5f64': f64 | 435 | 36..40 '5f64': f64 |
436 | 47..54 '"hello"': &str | 436 | 46..53 '"hello"': &str |
437 | 60..68 'b"bytes"': &[u8; _] | 437 | 59..67 'b"bytes"': &[u8; _] |
438 | 74..77 ''c'': char | 438 | 73..76 ''c'': char |
439 | 83..87 'b'b'': u8 | 439 | 82..86 'b'b'': u8 |
440 | 93..97 '3.14': f64 | 440 | 92..96 '3.14': f64 |
441 | 103..107 '5000': i32 | 441 | 102..106 '5000': i32 |
442 | 113..118 'false': bool | 442 | 112..117 'false': bool |
443 | 124..128 'true': bool | 443 | 123..127 'true': bool |
444 | 134..202 'r#" ... "#': &str | 444 | 133..201 'r#" ... "#': &str |
445 | 208..218 'br#"yolo"#': &[u8; _] | 445 | 207..217 'br#"yolo"#': &[u8; _] |
446 | "### | 446 | "### |
447 | ); | 447 | ); |
448 | } | 448 | } |
@@ -472,47 +472,47 @@ fn test(x: SomeType) { | |||
472 | } | 472 | } |
473 | "#), | 473 | "#), |
474 | @r###" | 474 | @r###" |
475 | 27..28 'x': SomeType | 475 | 26..27 'x': SomeType |
476 | 40..272 '{ ...lo"; }': () | 476 | 39..271 '{ ...lo"; }': () |
477 | 50..51 'b': bool | 477 | 49..50 'b': bool |
478 | 54..59 'false': bool | 478 | 53..58 'false': bool |
479 | 69..70 'c': bool | 479 | 68..69 'c': bool |
480 | 73..75 '!b': bool | 480 | 72..74 '!b': bool |
481 | 74..75 'b': bool | 481 | 73..74 'b': bool |
482 | 85..86 'a': i128 | 482 | 84..85 'a': i128 |
483 | 89..92 '100': i128 | 483 | 88..91 '100': i128 |
484 | 102..103 'd': i128 | 484 | 101..102 'd': i128 |
485 | 112..114 '-a': i128 | 485 | 111..113 '-a': i128 |
486 | 113..114 'a': i128 | 486 | 112..113 'a': i128 |
487 | 124..125 'e': i32 | 487 | 123..124 'e': i32 |
488 | 128..132 '-100': i32 | 488 | 127..131 '-100': i32 |
489 | 129..132 '100': i32 | 489 | 128..131 '100': i32 |
490 | 142..143 'f': bool | 490 | 141..142 'f': bool |
491 | 146..153 '!!!true': bool | 491 | 145..152 '!!!true': bool |
492 | 147..153 '!!true': bool | 492 | 146..152 '!!true': bool |
493 | 148..153 '!true': bool | 493 | 147..152 '!true': bool |
494 | 149..153 'true': bool | 494 | 148..152 'true': bool |
495 | 163..164 'g': i32 | 495 | 162..163 'g': i32 |
496 | 167..170 '!42': i32 | 496 | 166..169 '!42': i32 |
497 | 168..170 '42': i32 | 497 | 167..169 '42': i32 |
498 | 180..181 'h': u32 | 498 | 179..180 'h': u32 |
499 | 184..190 '!10u32': u32 | 499 | 183..189 '!10u32': u32 |
500 | 185..190 '10u32': u32 | 500 | 184..189 '10u32': u32 |
501 | 200..201 'j': i128 | 501 | 199..200 'j': i128 |
502 | 204..206 '!a': i128 | 502 | 203..205 '!a': i128 |
503 | 205..206 'a': i128 | 503 | 204..205 'a': i128 |
504 | 212..217 '-3.14': f64 | 504 | 211..216 '-3.14': f64 |
505 | 213..217 '3.14': f64 | 505 | 212..216 '3.14': f64 |
506 | 223..225 '!3': i32 | 506 | 222..224 '!3': i32 |
507 | 224..225 '3': i32 | 507 | 223..224 '3': i32 |
508 | 231..233 '-x': {unknown} | 508 | 230..232 '-x': {unknown} |
509 | 232..233 'x': SomeType | 509 | 231..232 'x': SomeType |
510 | 239..241 '!x': {unknown} | 510 | 238..240 '!x': {unknown} |
511 | 240..241 'x': SomeType | 511 | 239..240 'x': SomeType |
512 | 247..255 '-"hello"': {unknown} | 512 | 246..254 '-"hello"': {unknown} |
513 | 248..255 '"hello"': &str | 513 | 247..254 '"hello"': &str |
514 | 261..269 '!"hello"': {unknown} | 514 | 260..268 '!"hello"': {unknown} |
515 | 262..269 '"hello"': &str | 515 | 261..268 '"hello"': &str |
516 | "### | 516 | "### |
517 | ); | 517 | ); |
518 | } | 518 | } |
@@ -535,26 +535,26 @@ fn test() -> &mut &f64 { | |||
535 | } | 535 | } |
536 | "#), | 536 | "#), |
537 | @r###" | 537 | @r###" |
538 | 14..15 'x': u32 | 538 | 13..14 'x': u32 |
539 | 22..24 '{}': () | 539 | 21..23 '{}': () |
540 | 78..231 '{ ...t &c }': &mut &f64 | 540 | 77..230 '{ ...t &c }': &mut &f64 |
541 | 88..89 'a': u32 | 541 | 87..88 'a': u32 |
542 | 92..108 'unknow...nction': {unknown} | 542 | 91..107 'unknow...nction': {unknown} |
543 | 92..110 'unknow...tion()': u32 | 543 | 91..109 'unknow...tion()': u32 |
544 | 116..125 'takes_u32': fn takes_u32(u32) | 544 | 115..124 'takes_u32': fn takes_u32(u32) |
545 | 116..128 'takes_u32(a)': () | 545 | 115..127 'takes_u32(a)': () |
546 | 126..127 'a': u32 | 546 | 125..126 'a': u32 |
547 | 138..139 'b': i32 | 547 | 137..138 'b': i32 |
548 | 142..158 'unknow...nction': {unknown} | 548 | 141..157 'unknow...nction': {unknown} |
549 | 142..160 'unknow...tion()': i32 | 549 | 141..159 'unknow...tion()': i32 |
550 | 166..184 'S { i3...d: b }': S | 550 | 165..183 'S { i3...d: b }': S |
551 | 181..182 'b': i32 | 551 | 180..181 'b': i32 |
552 | 194..195 'c': f64 | 552 | 193..194 'c': f64 |
553 | 198..214 'unknow...nction': {unknown} | 553 | 197..213 'unknow...nction': {unknown} |
554 | 198..216 'unknow...tion()': f64 | 554 | 197..215 'unknow...tion()': f64 |
555 | 222..229 '&mut &c': &mut &f64 | 555 | 221..228 '&mut &c': &mut &f64 |
556 | 227..229 '&c': &f64 | 556 | 226..228 '&c': &f64 |
557 | 228..229 'c': f64 | 557 | 227..228 'c': f64 |
558 | "### | 558 | "### |
559 | ); | 559 | ); |
560 | } | 560 | } |
@@ -581,16 +581,16 @@ impl S { | |||
581 | } | 581 | } |
582 | "#), | 582 | "#), |
583 | @r###" | 583 | @r###" |
584 | 34..38 'self': &S | 584 | 33..37 'self': &S |
585 | 40..61 '{ ... }': () | 585 | 39..60 '{ ... }': () |
586 | 50..54 'self': &S | 586 | 49..53 'self': &S |
587 | 75..79 'self': &S | 587 | 74..78 'self': &S |
588 | 88..109 '{ ... }': () | 588 | 87..108 '{ ... }': () |
589 | 98..102 'self': &S | 589 | 97..101 'self': &S |
590 | 133..153 '{ ... }': S | 590 | 132..152 '{ ... }': S |
591 | 143..147 'S {}': S | 591 | 142..146 'S {}': S |
592 | 177..200 '{ ... }': S | 592 | 176..199 '{ ... }': S |
593 | 187..194 'Self {}': S | 593 | 186..193 'Self {}': S |
594 | "### | 594 | "### |
595 | ); | 595 | ); |
596 | } | 596 | } |
@@ -624,17 +624,17 @@ impl E { | |||
624 | } | 624 | } |
625 | "#), | 625 | "#), |
626 | @r###" | 626 | @r###" |
627 | 87..108 '{ ... }': () | 627 | 86..107 '{ ... }': () |
628 | 97..101 'Self': S1 | 628 | 96..100 'Self': S1 |
629 | 135..159 '{ ... }': () | 629 | 134..158 '{ ... }': () |
630 | 145..149 'Self': S2(isize) -> S2 | 630 | 144..148 'Self': S2(isize) -> S2 |
631 | 145..152 'Self(1)': S2 | 631 | 144..151 'Self(1)': S2 |
632 | 150..151 '1': isize | 632 | 149..150 '1': isize |
633 | 185..231 '{ ... }': () | 633 | 184..230 '{ ... }': () |
634 | 195..203 'Self::V1': E | 634 | 194..202 'Self::V1': E |
635 | 213..221 'Self::V2': V2(u32) -> E | 635 | 212..220 'Self::V2': V2(u32) -> E |
636 | 213..224 'Self::V2(1)': E | 636 | 212..223 'Self::V2(1)': E |
637 | 222..223 '1': u32 | 637 | 221..222 '1': u32 |
638 | "### | 638 | "### |
639 | ); | 639 | ); |
640 | } | 640 | } |
@@ -664,56 +664,56 @@ fn test() -> bool { | |||
664 | } | 664 | } |
665 | "#), | 665 | "#), |
666 | @r###" | 666 | @r###" |
667 | 6..7 'x': bool | 667 | 5..6 'x': bool |
668 | 22..34 '{ 0i32 }': i32 | 668 | 21..33 '{ 0i32 }': i32 |
669 | 28..32 '0i32': i32 | 669 | 27..31 '0i32': i32 |
670 | 54..370 '{ ... < 3 }': bool | 670 | 53..369 '{ ... < 3 }': bool |
671 | 64..65 'x': bool | 671 | 63..64 'x': bool |
672 | 68..69 'a': bool | 672 | 67..68 'a': bool |
673 | 68..74 'a && b': bool | 673 | 67..73 'a && b': bool |
674 | 73..74 'b': bool | 674 | 72..73 'b': bool |
675 | 84..85 'y': bool | 675 | 83..84 'y': bool |
676 | 88..92 'true': bool | 676 | 87..91 'true': bool |
677 | 88..101 'true || false': bool | 677 | 87..100 'true || false': bool |
678 | 96..101 'false': bool | 678 | 95..100 'false': bool |
679 | 111..112 'z': bool | 679 | 110..111 'z': bool |
680 | 115..116 'x': bool | 680 | 114..115 'x': bool |
681 | 115..121 'x == y': bool | 681 | 114..120 'x == y': bool |
682 | 120..121 'y': bool | 682 | 119..120 'y': bool |
683 | 131..132 't': bool | 683 | 130..131 't': bool |
684 | 135..136 'x': bool | 684 | 134..135 'x': bool |
685 | 135..141 'x != y': bool | 685 | 134..140 'x != y': bool |
686 | 140..141 'y': bool | 686 | 139..140 'y': bool |
687 | 151..162 'minus_forty': isize | 687 | 150..161 'minus_forty': isize |
688 | 172..180 '-40isize': isize | 688 | 171..179 '-40isize': isize |
689 | 173..180 '40isize': isize | 689 | 172..179 '40isize': isize |
690 | 190..191 'h': bool | 690 | 189..190 'h': bool |
691 | 194..205 'minus_forty': isize | 691 | 193..204 'minus_forty': isize |
692 | 194..216 'minus_...ONST_2': bool | 692 | 193..215 'minus_...ONST_2': bool |
693 | 209..216 'CONST_2': isize | 693 | 208..215 'CONST_2': isize |
694 | 226..227 'c': i32 | 694 | 225..226 'c': i32 |
695 | 230..231 'f': fn f(bool) -> i32 | 695 | 229..230 'f': fn f(bool) -> i32 |
696 | 230..239 'f(z || y)': i32 | 696 | 229..238 'f(z || y)': i32 |
697 | 230..243 'f(z || y) + 5': i32 | 697 | 229..242 'f(z || y) + 5': i32 |
698 | 232..233 'z': bool | 698 | 231..232 'z': bool |
699 | 232..238 'z || y': bool | 699 | 231..237 'z || y': bool |
700 | 237..238 'y': bool | 700 | 236..237 'y': bool |
701 | 242..243 '5': i32 | 701 | 241..242 '5': i32 |
702 | 253..254 'd': {unknown} | 702 | 252..253 'd': {unknown} |
703 | 257..258 'b': {unknown} | 703 | 256..257 'b': {unknown} |
704 | 268..269 'g': () | 704 | 267..268 'g': () |
705 | 272..283 'minus_forty': isize | 705 | 271..282 'minus_forty': isize |
706 | 272..288 'minus_...y ^= i': () | 706 | 271..287 'minus_...y ^= i': () |
707 | 287..288 'i': isize | 707 | 286..287 'i': isize |
708 | 298..301 'ten': usize | 708 | 297..300 'ten': usize |
709 | 311..313 '10': usize | 709 | 310..312 '10': usize |
710 | 323..336 'ten_is_eleven': bool | 710 | 322..335 'ten_is_eleven': bool |
711 | 339..342 'ten': usize | 711 | 338..341 'ten': usize |
712 | 339..354 'ten == some_num': bool | 712 | 338..353 'ten == some_num': bool |
713 | 346..354 'some_num': usize | 713 | 345..353 'some_num': usize |
714 | 361..364 'ten': usize | 714 | 360..363 'ten': usize |
715 | 361..368 'ten < 3': bool | 715 | 360..367 'ten < 3': bool |
716 | 367..368 '3': usize | 716 | 366..367 '3': usize |
717 | "### | 717 | "### |
718 | ); | 718 | ); |
719 | } | 719 | } |
@@ -728,13 +728,13 @@ fn test() { | |||
728 | } | 728 | } |
729 | "#), | 729 | "#), |
730 | @r###" | 730 | @r###" |
731 | 11..48 '{ ...5u8; }': () | 731 | 10..47 '{ ...5u8; }': () |
732 | 17..21 '1u32': u32 | 732 | 16..20 '1u32': u32 |
733 | 17..28 '1u32 << 5u8': u32 | 733 | 16..27 '1u32 << 5u8': u32 |
734 | 25..28 '5u8': u8 | 734 | 24..27 '5u8': u8 |
735 | 34..38 '1u32': u32 | 735 | 33..37 '1u32': u32 |
736 | 34..45 '1u32 >> 5u8': u32 | 736 | 33..44 '1u32 >> 5u8': u32 |
737 | 42..45 '5u8': u8 | 737 | 41..44 '5u8': u8 |
738 | "### | 738 | "### |
739 | ); | 739 | ); |
740 | } | 740 | } |
@@ -767,49 +767,49 @@ fn test2(a1: *const A, a2: *mut A) { | |||
767 | } | 767 | } |
768 | "#), | 768 | "#), |
769 | @r###" | 769 | @r###" |
770 | 44..45 'a': A | 770 | 43..44 'a': A |
771 | 50..213 '{ ...5.b; }': () | 771 | 49..212 '{ ...5.b; }': () |
772 | 60..62 'a1': A | 772 | 59..61 'a1': A |
773 | 65..66 'a': A | 773 | 64..65 'a': A |
774 | 72..74 'a1': A | 774 | 71..73 'a1': A |
775 | 72..76 'a1.b': B | 775 | 71..75 'a1.b': B |
776 | 86..88 'a2': &A | 776 | 85..87 'a2': &A |
777 | 91..93 '&a': &A | 777 | 90..92 '&a': &A |
778 | 92..93 'a': A | 778 | 91..92 'a': A |
779 | 99..101 'a2': &A | 779 | 98..100 'a2': &A |
780 | 99..103 'a2.b': B | 780 | 98..102 'a2.b': B |
781 | 113..115 'a3': &mut A | 781 | 112..114 'a3': &mut A |
782 | 118..124 '&mut a': &mut A | 782 | 117..123 '&mut a': &mut A |
783 | 123..124 'a': A | 783 | 122..123 'a': A |
784 | 130..132 'a3': &mut A | 784 | 129..131 'a3': &mut A |
785 | 130..134 'a3.b': B | 785 | 129..133 'a3.b': B |
786 | 144..146 'a4': &&&&&&&A | 786 | 143..145 'a4': &&&&&&&A |
787 | 149..157 '&&&&&&&a': &&&&&&&A | 787 | 148..156 '&&&&&&&a': &&&&&&&A |
788 | 150..157 '&&&&&&a': &&&&&&A | 788 | 149..156 '&&&&&&a': &&&&&&A |
789 | 151..157 '&&&&&a': &&&&&A | 789 | 150..156 '&&&&&a': &&&&&A |
790 | 152..157 '&&&&a': &&&&A | 790 | 151..156 '&&&&a': &&&&A |
791 | 153..157 '&&&a': &&&A | 791 | 152..156 '&&&a': &&&A |
792 | 154..157 '&&a': &&A | 792 | 153..156 '&&a': &&A |
793 | 155..157 '&a': &A | 793 | 154..156 '&a': &A |
794 | 156..157 'a': A | 794 | 155..156 'a': A |
795 | 163..165 'a4': &&&&&&&A | 795 | 162..164 'a4': &&&&&&&A |
796 | 163..167 'a4.b': B | 796 | 162..166 'a4.b': B |
797 | 177..179 'a5': &mut &&mut &&mut A | 797 | 176..178 'a5': &mut &&mut &&mut A |
798 | 182..200 '&mut &...&mut a': &mut &&mut &&mut A | 798 | 181..199 '&mut &...&mut a': &mut &&mut &&mut A |
799 | 187..200 '&&mut &&mut a': &&mut &&mut A | 799 | 186..199 '&&mut &&mut a': &&mut &&mut A |
800 | 188..200 '&mut &&mut a': &mut &&mut A | 800 | 187..199 '&mut &&mut a': &mut &&mut A |
801 | 193..200 '&&mut a': &&mut A | 801 | 192..199 '&&mut a': &&mut A |
802 | 194..200 '&mut a': &mut A | 802 | 193..199 '&mut a': &mut A |
803 | 199..200 'a': A | 803 | 198..199 'a': A |
804 | 206..208 'a5': &mut &&mut &&mut A | 804 | 205..207 'a5': &mut &&mut &&mut A |
805 | 206..210 'a5.b': B | 805 | 205..209 'a5.b': B |
806 | 224..226 'a1': *const A | 806 | 223..225 'a1': *const A |
807 | 238..240 'a2': *mut A | 807 | 237..239 'a2': *mut A |
808 | 250..273 '{ ...2.b; }': () | 808 | 249..272 '{ ...2.b; }': () |
809 | 256..258 'a1': *const A | 809 | 255..257 'a1': *const A |
810 | 256..260 'a1.b': B | 810 | 255..259 'a1.b': B |
811 | 266..268 'a2': *mut A | 811 | 265..267 'a2': *mut A |
812 | 266..270 'a2.b': B | 812 | 265..269 'a2.b': B |
813 | "### | 813 | "### |
814 | ); | 814 | ); |
815 | } | 815 | } |
@@ -846,30 +846,30 @@ fn test() { | |||
846 | } | 846 | } |
847 | "#), | 847 | "#), |
848 | @r###" | 848 | @r###" |
849 | 68..72 'self': &Self | 849 | 67..71 'self': &Self |
850 | 139..143 'self': &A<T> | 850 | 138..142 'self': &A<T> |
851 | 151..174 '{ ... }': &T | 851 | 150..173 '{ ... }': &T |
852 | 161..168 '&self.0': &T | 852 | 160..167 '&self.0': &T |
853 | 162..166 'self': &A<T> | 853 | 161..165 'self': &A<T> |
854 | 162..168 'self.0': T | 854 | 161..167 'self.0': T |
855 | 255..259 'self': &B<T> | 855 | 254..258 'self': &B<T> |
856 | 278..301 '{ ... }': &T | 856 | 277..300 '{ ... }': &T |
857 | 288..295 '&self.0': &T | 857 | 287..294 '&self.0': &T |
858 | 289..293 'self': &B<T> | 858 | 288..292 'self': &B<T> |
859 | 289..295 'self.0': T | 859 | 288..294 'self.0': T |
860 | 315..353 '{ ...))); }': () | 860 | 314..352 '{ ...))); }': () |
861 | 325..326 't': &i32 | 861 | 324..325 't': &i32 |
862 | 329..335 'A::foo': fn foo<i32>(&A<i32>) -> &i32 | 862 | 328..334 'A::foo': fn foo<i32>(&A<i32>) -> &i32 |
863 | 329..350 'A::foo...42))))': &i32 | 863 | 328..349 'A::foo...42))))': &i32 |
864 | 336..349 '&&B(B(A(42)))': &&B<B<A<i32>>> | 864 | 335..348 '&&B(B(A(42)))': &&B<B<A<i32>>> |
865 | 337..349 '&B(B(A(42)))': &B<B<A<i32>>> | 865 | 336..348 '&B(B(A(42)))': &B<B<A<i32>>> |
866 | 338..339 'B': B<B<A<i32>>>(B<A<i32>>) -> B<B<A<i32>>> | 866 | 337..338 'B': B<B<A<i32>>>(B<A<i32>>) -> B<B<A<i32>>> |
867 | 338..349 'B(B(A(42)))': B<B<A<i32>>> | 867 | 337..348 'B(B(A(42)))': B<B<A<i32>>> |
868 | 340..341 'B': B<A<i32>>(A<i32>) -> B<A<i32>> | 868 | 339..340 'B': B<A<i32>>(A<i32>) -> B<A<i32>> |
869 | 340..348 'B(A(42))': B<A<i32>> | 869 | 339..347 'B(A(42))': B<A<i32>> |
870 | 342..343 'A': A<i32>(i32) -> A<i32> | 870 | 341..342 'A': A<i32>(i32) -> A<i32> |
871 | 342..347 'A(42)': A<i32> | 871 | 341..346 'A(42)': A<i32> |
872 | 344..346 '42': i32 | 872 | 343..345 '42': i32 |
873 | "### | 873 | "### |
874 | ); | 874 | ); |
875 | } | 875 | } |
@@ -906,34 +906,34 @@ fn test(a: A<i32>) { | |||
906 | } | 906 | } |
907 | "#), | 907 | "#), |
908 | @r###" | 908 | @r###" |
909 | 68..72 'self': &Self | 909 | 67..71 'self': &Self |
910 | 144..148 'self': &A<T> | 910 | 143..147 'self': &A<T> |
911 | 150..151 'x': &A<T> | 911 | 149..150 'x': &A<T> |
912 | 166..187 '{ ... }': &T | 912 | 165..186 '{ ... }': &T |
913 | 176..181 '&*x.0': &T | 913 | 175..180 '&*x.0': &T |
914 | 177..181 '*x.0': T | 914 | 176..180 '*x.0': T |
915 | 178..179 'x': &A<T> | 915 | 177..178 'x': &A<T> |
916 | 178..181 'x.0': *mut T | 916 | 177..180 'x.0': *mut T |
917 | 268..272 'self': &B<T> | 917 | 267..271 'self': &B<T> |
918 | 291..314 '{ ... }': &T | 918 | 290..313 '{ ... }': &T |
919 | 301..308 '&self.0': &T | 919 | 300..307 '&self.0': &T |
920 | 302..306 'self': &B<T> | 920 | 301..305 'self': &B<T> |
921 | 302..308 'self.0': T | 921 | 301..307 'self.0': T |
922 | 326..327 'a': A<i32> | 922 | 325..326 'a': A<i32> |
923 | 337..383 '{ ...))); }': () | 923 | 336..382 '{ ...))); }': () |
924 | 347..348 't': &i32 | 924 | 346..347 't': &i32 |
925 | 351..352 'A': A<i32>(*mut i32) -> A<i32> | 925 | 350..351 'A': A<i32>(*mut i32) -> A<i32> |
926 | 351..365 'A(0 as *mut _)': A<i32> | 926 | 350..364 'A(0 as *mut _)': A<i32> |
927 | 351..380 'A(0 as...B(a)))': &i32 | 927 | 350..379 'A(0 as...B(a)))': &i32 |
928 | 353..354 '0': i32 | 928 | 352..353 '0': i32 |
929 | 353..364 '0 as *mut _': *mut i32 | 929 | 352..363 '0 as *mut _': *mut i32 |
930 | 370..379 '&&B(B(a))': &&B<B<A<i32>>> | 930 | 369..378 '&&B(B(a))': &&B<B<A<i32>>> |
931 | 371..379 '&B(B(a))': &B<B<A<i32>>> | 931 | 370..378 '&B(B(a))': &B<B<A<i32>>> |
932 | 372..373 'B': B<B<A<i32>>>(B<A<i32>>) -> B<B<A<i32>>> | 932 | 371..372 'B': B<B<A<i32>>>(B<A<i32>>) -> B<B<A<i32>>> |
933 | 372..379 'B(B(a))': B<B<A<i32>>> | 933 | 371..378 'B(B(a))': B<B<A<i32>>> |
934 | 374..375 'B': B<A<i32>>(A<i32>) -> B<A<i32>> | 934 | 373..374 'B': B<A<i32>>(A<i32>) -> B<A<i32>> |
935 | 374..378 'B(a)': B<A<i32>> | 935 | 373..377 'B(a)': B<A<i32>> |
936 | 376..377 'a': A<i32> | 936 | 375..376 'a': A<i32> |
937 | "### | 937 | "### |
938 | ); | 938 | ); |
939 | } | 939 | } |
@@ -952,16 +952,16 @@ fn main(foo: Foo) { | |||
952 | } | 952 | } |
953 | "#), | 953 | "#), |
954 | @r###" | 954 | @r###" |
955 | 35..38 'foo': Foo | 955 | 34..37 'foo': Foo |
956 | 45..109 '{ ... } }': () | 956 | 44..108 '{ ... } }': () |
957 | 51..107 'if tru... }': () | 957 | 50..106 'if tru... }': () |
958 | 54..58 'true': bool | 958 | 53..57 'true': bool |
959 | 59..67 '{ }': () | 959 | 58..66 '{ }': () |
960 | 73..107 'if fal... }': i32 | 960 | 72..106 'if fal... }': i32 |
961 | 76..81 'false': bool | 961 | 75..80 'false': bool |
962 | 82..107 '{ ... }': i32 | 962 | 81..106 '{ ... }': i32 |
963 | 92..95 'foo': Foo | 963 | 91..94 'foo': Foo |
964 | 92..101 'foo.field': i32 | 964 | 91..100 'foo.field': i32 |
965 | "### | 965 | "### |
966 | ) | 966 | ) |
967 | } | 967 | } |
@@ -993,38 +993,38 @@ fn foo() { | |||
993 | }; | 993 | }; |
994 | }"#), | 994 | }"#), |
995 | @r###" | 995 | @r###" |
996 | 10..323 '{ ... }; }': () | 996 | 9..322 '{ ... }; }': () |
997 | 20..23 '_x1': i32 | 997 | 19..22 '_x1': i32 |
998 | 26..80 'if tru... }': i32 | 998 | 25..79 'if tru... }': i32 |
999 | 29..33 'true': bool | 999 | 28..32 'true': bool |
1000 | 34..51 '{ ... }': i32 | 1000 | 33..50 '{ ... }': i32 |
1001 | 44..45 '1': i32 | 1001 | 43..44 '1': i32 |
1002 | 57..80 '{ ... }': i32 | 1002 | 56..79 '{ ... }': i32 |
1003 | 67..73 'return': ! | 1003 | 66..72 'return': ! |
1004 | 90..93 '_x2': i32 | 1004 | 89..92 '_x2': i32 |
1005 | 96..149 'if tru... }': i32 | 1005 | 95..148 'if tru... }': i32 |
1006 | 99..103 'true': bool | 1006 | 98..102 'true': bool |
1007 | 104..121 '{ ... }': i32 | 1007 | 103..120 '{ ... }': i32 |
1008 | 114..115 '2': i32 | 1008 | 113..114 '2': i32 |
1009 | 127..149 '{ ... }': ! | 1009 | 126..148 '{ ... }': ! |
1010 | 137..143 'return': ! | 1010 | 136..142 'return': ! |
1011 | 159..162 '_x3': i32 | 1011 | 158..161 '_x3': i32 |
1012 | 165..247 'match ... }': i32 | 1012 | 164..246 'match ... }': i32 |
1013 | 171..175 'true': bool | 1013 | 170..174 'true': bool |
1014 | 186..190 'true': bool | 1014 | 185..189 'true': bool |
1015 | 186..190 'true': bool | 1015 | 185..189 'true': bool |
1016 | 194..195 '3': i32 | 1016 | 193..194 '3': i32 |
1017 | 205..206 '_': bool | 1017 | 204..205 '_': bool |
1018 | 210..241 '{ ... }': i32 | 1018 | 209..240 '{ ... }': i32 |
1019 | 224..230 'return': ! | 1019 | 223..229 'return': ! |
1020 | 257..260 '_x4': i32 | 1020 | 256..259 '_x4': i32 |
1021 | 263..320 'match ... }': i32 | 1021 | 262..319 'match ... }': i32 |
1022 | 269..273 'true': bool | 1022 | 268..272 'true': bool |
1023 | 284..288 'true': bool | 1023 | 283..287 'true': bool |
1024 | 284..288 'true': bool | 1024 | 283..287 'true': bool |
1025 | 292..293 '4': i32 | 1025 | 291..292 '4': i32 |
1026 | 303..304 '_': bool | 1026 | 302..303 '_': bool |
1027 | 308..314 'return': ! | 1027 | 307..313 'return': ! |
1028 | "### | 1028 | "### |
1029 | ) | 1029 | ) |
1030 | } | 1030 | } |
@@ -1052,24 +1052,24 @@ fn test(a: A) { | |||
1052 | } | 1052 | } |
1053 | "#), | 1053 | "#), |
1054 | @r###" | 1054 | @r###" |
1055 | 32..36 'self': A | 1055 | 31..35 'self': A |
1056 | 38..39 'x': u32 | 1056 | 37..38 'x': u32 |
1057 | 53..55 '{}': () | 1057 | 52..54 '{}': () |
1058 | 103..107 'self': &A | 1058 | 102..106 'self': &A |
1059 | 109..110 'x': u64 | 1059 | 108..109 'x': u64 |
1060 | 124..126 '{}': () | 1060 | 123..125 '{}': () |
1061 | 144..145 'a': A | 1061 | 143..144 'a': A |
1062 | 150..198 '{ ...(1); }': () | 1062 | 149..197 '{ ...(1); }': () |
1063 | 156..157 'a': A | 1063 | 155..156 'a': A |
1064 | 156..164 'a.foo(1)': i32 | 1064 | 155..163 'a.foo(1)': i32 |
1065 | 162..163 '1': u32 | 1065 | 161..162 '1': u32 |
1066 | 170..181 '(&a).bar(1)': i64 | 1066 | 169..180 '(&a).bar(1)': i64 |
1067 | 171..173 '&a': &A | 1067 | 170..172 '&a': &A |
1068 | 172..173 'a': A | 1068 | 171..172 'a': A |
1069 | 179..180 '1': u64 | 1069 | 178..179 '1': u64 |
1070 | 187..188 'a': A | 1070 | 186..187 'a': A |
1071 | 187..195 'a.bar(1)': i64 | 1071 | 186..194 'a.bar(1)': i64 |
1072 | 193..194 '1': u64 | 1072 | 192..193 '1': u64 |
1073 | "### | 1073 | "### |
1074 | ); | 1074 | ); |
1075 | } | 1075 | } |
@@ -1088,11 +1088,11 @@ fn test() { | |||
1088 | } | 1088 | } |
1089 | "#), | 1089 | "#), |
1090 | @r###" | 1090 | @r###" |
1091 | 40..44 'self': &str | 1091 | 39..43 'self': &str |
1092 | 53..55 '{}': () | 1092 | 52..54 '{}': () |
1093 | 69..89 '{ ...o(); }': () | 1093 | 68..88 '{ ...o(); }': () |
1094 | 75..80 '"foo"': &str | 1094 | 74..79 '"foo"': &str |
1095 | 75..86 '"foo".foo()': i32 | 1095 | 74..85 '"foo".foo()': i32 |
1096 | "### | 1096 | "### |
1097 | ); | 1097 | ); |
1098 | } | 1098 | } |
@@ -1111,33 +1111,33 @@ fn test(x: &str, y: isize) { | |||
1111 | } | 1111 | } |
1112 | "#), | 1112 | "#), |
1113 | @r###" | 1113 | @r###" |
1114 | 9..10 'x': &str | 1114 | 8..9 'x': &str |
1115 | 18..19 'y': isize | 1115 | 17..18 'y': isize |
1116 | 28..170 '{ ...d"); }': () | 1116 | 27..169 '{ ...d"); }': () |
1117 | 38..39 'a': (u32, &str) | 1117 | 37..38 'a': (u32, &str) |
1118 | 55..63 '(1, "a")': (u32, &str) | 1118 | 54..62 '(1, "a")': (u32, &str) |
1119 | 56..57 '1': u32 | 1119 | 55..56 '1': u32 |
1120 | 59..62 '"a"': &str | 1120 | 58..61 '"a"': &str |
1121 | 73..74 'b': ((u32, &str), &str) | 1121 | 72..73 'b': ((u32, &str), &str) |
1122 | 77..83 '(a, x)': ((u32, &str), &str) | 1122 | 76..82 '(a, x)': ((u32, &str), &str) |
1123 | 78..79 'a': (u32, &str) | 1123 | 77..78 'a': (u32, &str) |
1124 | 81..82 'x': &str | 1124 | 80..81 'x': &str |
1125 | 93..94 'c': (isize, &str) | 1125 | 92..93 'c': (isize, &str) |
1126 | 97..103 '(y, x)': (isize, &str) | 1126 | 96..102 '(y, x)': (isize, &str) |
1127 | 98..99 'y': isize | 1127 | 97..98 'y': isize |
1128 | 101..102 'x': &str | 1128 | 100..101 'x': &str |
1129 | 113..114 'd': ((isize, &str), &str) | 1129 | 112..113 'd': ((isize, &str), &str) |
1130 | 117..123 '(c, x)': ((isize, &str), &str) | 1130 | 116..122 '(c, x)': ((isize, &str), &str) |
1131 | 118..119 'c': (isize, &str) | 1131 | 117..118 'c': (isize, &str) |
1132 | 121..122 'x': &str | 1132 | 120..121 'x': &str |
1133 | 133..134 'e': (i32, &str) | 1133 | 132..133 'e': (i32, &str) |
1134 | 137..145 '(1, "e")': (i32, &str) | 1134 | 136..144 '(1, "e")': (i32, &str) |
1135 | 138..139 '1': i32 | 1135 | 137..138 '1': i32 |
1136 | 141..144 '"e"': &str | 1136 | 140..143 '"e"': &str |
1137 | 155..156 'f': ((i32, &str), &str) | 1137 | 154..155 'f': ((i32, &str), &str) |
1138 | 159..167 '(e, "d")': ((i32, &str), &str) | 1138 | 158..166 '(e, "d")': ((i32, &str), &str) |
1139 | 160..161 'e': (i32, &str) | 1139 | 159..160 'e': (i32, &str) |
1140 | 163..166 '"d"': &str | 1140 | 162..165 '"d"': &str |
1141 | "### | 1141 | "### |
1142 | ); | 1142 | ); |
1143 | } | 1143 | } |
@@ -1165,58 +1165,58 @@ fn test(x: &str, y: isize) { | |||
1165 | } | 1165 | } |
1166 | "#), | 1166 | "#), |
1167 | @r###" | 1167 | @r###" |
1168 | 9..10 'x': &str | 1168 | 8..9 'x': &str |
1169 | 18..19 'y': isize | 1169 | 17..18 'y': isize |
1170 | 28..293 '{ ... []; }': () | 1170 | 27..292 '{ ... []; }': () |
1171 | 38..39 'a': [&str; _] | 1171 | 37..38 'a': [&str; _] |
1172 | 42..45 '[x]': [&str; _] | 1172 | 41..44 '[x]': [&str; _] |
1173 | 43..44 'x': &str | 1173 | 42..43 'x': &str |
1174 | 55..56 'b': [[&str; _]; _] | 1174 | 54..55 'b': [[&str; _]; _] |
1175 | 59..65 '[a, a]': [[&str; _]; _] | 1175 | 58..64 '[a, a]': [[&str; _]; _] |
1176 | 60..61 'a': [&str; _] | 1176 | 59..60 'a': [&str; _] |
1177 | 63..64 'a': [&str; _] | 1177 | 62..63 'a': [&str; _] |
1178 | 75..76 'c': [[[&str; _]; _]; _] | 1178 | 74..75 'c': [[[&str; _]; _]; _] |
1179 | 79..85 '[b, b]': [[[&str; _]; _]; _] | 1179 | 78..84 '[b, b]': [[[&str; _]; _]; _] |
1180 | 80..81 'b': [[&str; _]; _] | 1180 | 79..80 'b': [[&str; _]; _] |
1181 | 83..84 'b': [[&str; _]; _] | 1181 | 82..83 'b': [[&str; _]; _] |
1182 | 96..97 'd': [isize; _] | 1182 | 95..96 'd': [isize; _] |
1183 | 100..112 '[y, 1, 2, 3]': [isize; _] | 1183 | 99..111 '[y, 1, 2, 3]': [isize; _] |
1184 | 101..102 'y': isize | 1184 | 100..101 'y': isize |
1185 | 104..105 '1': isize | 1185 | 103..104 '1': isize |
1186 | 107..108 '2': isize | 1186 | 106..107 '2': isize |
1187 | 110..111 '3': isize | 1187 | 109..110 '3': isize |
1188 | 122..123 'd': [isize; _] | 1188 | 121..122 'd': [isize; _] |
1189 | 126..138 '[1, y, 2, 3]': [isize; _] | 1189 | 125..137 '[1, y, 2, 3]': [isize; _] |
1190 | 127..128 '1': isize | 1190 | 126..127 '1': isize |
1191 | 130..131 'y': isize | 1191 | 129..130 'y': isize |
1192 | 133..134 '2': isize | 1192 | 132..133 '2': isize |
1193 | 136..137 '3': isize | 1193 | 135..136 '3': isize |
1194 | 148..149 'e': [isize; _] | 1194 | 147..148 'e': [isize; _] |
1195 | 152..155 '[y]': [isize; _] | 1195 | 151..154 '[y]': [isize; _] |
1196 | 153..154 'y': isize | 1196 | 152..153 'y': isize |
1197 | 165..166 'f': [[isize; _]; _] | 1197 | 164..165 'f': [[isize; _]; _] |
1198 | 169..175 '[d, d]': [[isize; _]; _] | 1198 | 168..174 '[d, d]': [[isize; _]; _] |
1199 | 170..171 'd': [isize; _] | 1199 | 169..170 'd': [isize; _] |
1200 | 173..174 'd': [isize; _] | 1200 | 172..173 'd': [isize; _] |
1201 | 185..186 'g': [[isize; _]; _] | 1201 | 184..185 'g': [[isize; _]; _] |
1202 | 189..195 '[e, e]': [[isize; _]; _] | 1202 | 188..194 '[e, e]': [[isize; _]; _] |
1203 | 190..191 'e': [isize; _] | 1203 | 189..190 'e': [isize; _] |
1204 | 193..194 'e': [isize; _] | 1204 | 192..193 'e': [isize; _] |
1205 | 206..207 'h': [i32; _] | 1205 | 205..206 'h': [i32; _] |
1206 | 210..216 '[1, 2]': [i32; _] | 1206 | 209..215 '[1, 2]': [i32; _] |
1207 | 211..212 '1': i32 | 1207 | 210..211 '1': i32 |
1208 | 214..215 '2': i32 | 1208 | 213..214 '2': i32 |
1209 | 226..227 'i': [&str; _] | 1209 | 225..226 'i': [&str; _] |
1210 | 230..240 '["a", "b"]': [&str; _] | 1210 | 229..239 '["a", "b"]': [&str; _] |
1211 | 231..234 '"a"': &str | 1211 | 230..233 '"a"': &str |
1212 | 236..239 '"b"': &str | 1212 | 235..238 '"b"': &str |
1213 | 251..252 'b': [[&str; _]; _] | 1213 | 250..251 'b': [[&str; _]; _] |
1214 | 255..265 '[a, ["b"]]': [[&str; _]; _] | 1214 | 254..264 '[a, ["b"]]': [[&str; _]; _] |
1215 | 256..257 'a': [&str; _] | 1215 | 255..256 'a': [&str; _] |
1216 | 259..264 '["b"]': [&str; _] | 1216 | 258..263 '["b"]': [&str; _] |
1217 | 260..263 '"b"': &str | 1217 | 259..262 '"b"': &str |
1218 | 275..276 'x': [u8; _] | 1218 | 274..275 'x': [u8; _] |
1219 | 288..290 '[]': [u8; _] | 1219 | 287..289 '[]': [u8; _] |
1220 | "### | 1220 | "### |
1221 | ); | 1221 | ); |
1222 | } | 1222 | } |
@@ -1238,21 +1238,21 @@ fn test(a1: A<u32>, i: i32) { | |||
1238 | } | 1238 | } |
1239 | "#), | 1239 | "#), |
1240 | @r###" | 1240 | @r###" |
1241 | 36..38 'a1': A<u32> | 1241 | 35..37 'a1': A<u32> |
1242 | 48..49 'i': i32 | 1242 | 47..48 'i': i32 |
1243 | 56..147 '{ ...3.x; }': () | 1243 | 55..146 '{ ...3.x; }': () |
1244 | 62..64 'a1': A<u32> | 1244 | 61..63 'a1': A<u32> |
1245 | 62..66 'a1.x': u32 | 1245 | 61..65 'a1.x': u32 |
1246 | 76..78 'a2': A<i32> | 1246 | 75..77 'a2': A<i32> |
1247 | 81..91 'A { x: i }': A<i32> | 1247 | 80..90 'A { x: i }': A<i32> |
1248 | 88..89 'i': i32 | 1248 | 87..88 'i': i32 |
1249 | 97..99 'a2': A<i32> | 1249 | 96..98 'a2': A<i32> |
1250 | 97..101 'a2.x': i32 | 1250 | 96..100 'a2.x': i32 |
1251 | 111..113 'a3': A<i128> | 1251 | 110..112 'a3': A<i128> |
1252 | 116..134 'A::<i1...x: 1 }': A<i128> | 1252 | 115..133 'A::<i1...x: 1 }': A<i128> |
1253 | 131..132 '1': i128 | 1253 | 130..131 '1': i128 |
1254 | 140..142 'a3': A<i128> | 1254 | 139..141 'a3': A<i128> |
1255 | 140..144 'a3.x': i128 | 1255 | 139..143 'a3.x': i128 |
1256 | "### | 1256 | "### |
1257 | ); | 1257 | ); |
1258 | } | 1258 | } |
@@ -1275,22 +1275,22 @@ fn test() { | |||
1275 | } | 1275 | } |
1276 | "#), | 1276 | "#), |
1277 | @r###" | 1277 | @r###" |
1278 | 76..184 '{ ...one; }': () | 1278 | 75..183 '{ ...one; }': () |
1279 | 82..83 'A': A<i32>(i32) -> A<i32> | 1279 | 81..82 'A': A<i32>(i32) -> A<i32> |
1280 | 82..87 'A(42)': A<i32> | 1280 | 81..86 'A(42)': A<i32> |
1281 | 84..86 '42': i32 | 1281 | 83..85 '42': i32 |
1282 | 93..94 'A': A<u128>(u128) -> A<u128> | 1282 | 92..93 'A': A<u128>(u128) -> A<u128> |
1283 | 93..102 'A(42u128)': A<u128> | 1283 | 92..101 'A(42u128)': A<u128> |
1284 | 95..101 '42u128': u128 | 1284 | 94..100 '42u128': u128 |
1285 | 108..112 'Some': Some<&str>(&str) -> Option<&str> | 1285 | 107..111 'Some': Some<&str>(&str) -> Option<&str> |
1286 | 108..117 'Some("x")': Option<&str> | 1286 | 107..116 'Some("x")': Option<&str> |
1287 | 113..116 '"x"': &str | 1287 | 112..115 '"x"': &str |
1288 | 123..135 'Option::Some': Some<&str>(&str) -> Option<&str> | 1288 | 122..134 'Option::Some': Some<&str>(&str) -> Option<&str> |
1289 | 123..140 'Option...e("x")': Option<&str> | 1289 | 122..139 'Option...e("x")': Option<&str> |
1290 | 136..139 '"x"': &str | 1290 | 135..138 '"x"': &str |
1291 | 146..150 'None': Option<{unknown}> | 1291 | 145..149 'None': Option<{unknown}> |
1292 | 160..161 'x': Option<i64> | 1292 | 159..160 'x': Option<i64> |
1293 | 177..181 'None': Option<i64> | 1293 | 176..180 'None': Option<i64> |
1294 | "### | 1294 | "### |
1295 | ); | 1295 | ); |
1296 | } | 1296 | } |
@@ -1308,20 +1308,20 @@ fn test() { | |||
1308 | } | 1308 | } |
1309 | "#), | 1309 | "#), |
1310 | @r###" | 1310 | @r###" |
1311 | 10..11 't': T | 1311 | 9..10 't': T |
1312 | 21..26 '{ t }': T | 1312 | 20..25 '{ t }': T |
1313 | 23..24 't': T | 1313 | 22..23 't': T |
1314 | 38..98 '{ ...(1); }': () | 1314 | 37..97 '{ ...(1); }': () |
1315 | 44..46 'id': fn id<u32>(u32) -> u32 | 1315 | 43..45 'id': fn id<u32>(u32) -> u32 |
1316 | 44..52 'id(1u32)': u32 | 1316 | 43..51 'id(1u32)': u32 |
1317 | 47..51 '1u32': u32 | 1317 | 46..50 '1u32': u32 |
1318 | 58..68 'id::<i128>': fn id<i128>(i128) -> i128 | 1318 | 57..67 'id::<i128>': fn id<i128>(i128) -> i128 |
1319 | 58..71 'id::<i128>(1)': i128 | 1319 | 57..70 'id::<i128>(1)': i128 |
1320 | 69..70 '1': i128 | 1320 | 68..69 '1': i128 |
1321 | 81..82 'x': u64 | 1321 | 80..81 'x': u64 |
1322 | 90..92 'id': fn id<u64>(u64) -> u64 | 1322 | 89..91 'id': fn id<u64>(u64) -> u64 |
1323 | 90..95 'id(1)': u64 | 1323 | 89..94 'id(1)': u64 |
1324 | 93..94 '1': u64 | 1324 | 92..93 '1': u64 |
1325 | "### | 1325 | "### |
1326 | ); | 1326 | ); |
1327 | } | 1327 | } |
@@ -1355,38 +1355,38 @@ fn test() -> i128 { | |||
1355 | } | 1355 | } |
1356 | "#), | 1356 | "#), |
1357 | @r###" | 1357 | @r###" |
1358 | 74..78 'self': A<X, Y> | 1358 | 73..77 'self': A<X, Y> |
1359 | 85..107 '{ ... }': X | 1359 | 84..106 '{ ... }': X |
1360 | 95..99 'self': A<X, Y> | 1360 | 94..98 'self': A<X, Y> |
1361 | 95..101 'self.x': X | 1361 | 94..100 'self.x': X |
1362 | 117..121 'self': A<X, Y> | 1362 | 116..120 'self': A<X, Y> |
1363 | 128..150 '{ ... }': Y | 1363 | 127..149 '{ ... }': Y |
1364 | 138..142 'self': A<X, Y> | 1364 | 137..141 'self': A<X, Y> |
1365 | 138..144 'self.y': Y | 1365 | 137..143 'self.y': Y |
1366 | 163..167 'self': A<X, Y> | 1366 | 162..166 'self': A<X, Y> |
1367 | 169..170 't': T | 1367 | 168..169 't': T |
1368 | 188..223 '{ ... }': (X, Y, T) | 1368 | 187..222 '{ ... }': (X, Y, T) |
1369 | 198..217 '(self.....y, t)': (X, Y, T) | 1369 | 197..216 '(self.....y, t)': (X, Y, T) |
1370 | 199..203 'self': A<X, Y> | 1370 | 198..202 'self': A<X, Y> |
1371 | 199..205 'self.x': X | 1371 | 198..204 'self.x': X |
1372 | 207..211 'self': A<X, Y> | 1372 | 206..210 'self': A<X, Y> |
1373 | 207..213 'self.y': Y | 1373 | 206..212 'self.y': Y |
1374 | 215..216 't': T | 1374 | 214..215 't': T |
1375 | 245..342 '{ ...(1); }': () | 1375 | 244..341 '{ ...(1); }': () |
1376 | 255..256 'a': A<u64, i64> | 1376 | 254..255 'a': A<u64, i64> |
1377 | 259..281 'A { x:...1i64 }': A<u64, i64> | 1377 | 258..280 'A { x:...1i64 }': A<u64, i64> |
1378 | 266..270 '1u64': u64 | 1378 | 265..269 '1u64': u64 |
1379 | 275..279 '1i64': i64 | 1379 | 274..278 '1i64': i64 |
1380 | 287..288 'a': A<u64, i64> | 1380 | 286..287 'a': A<u64, i64> |
1381 | 287..292 'a.x()': u64 | 1381 | 286..291 'a.x()': u64 |
1382 | 298..299 'a': A<u64, i64> | 1382 | 297..298 'a': A<u64, i64> |
1383 | 298..303 'a.y()': i64 | 1383 | 297..302 'a.y()': i64 |
1384 | 309..310 'a': A<u64, i64> | 1384 | 308..309 'a': A<u64, i64> |
1385 | 309..319 'a.z(1i128)': (u64, i64, i128) | 1385 | 308..318 'a.z(1i128)': (u64, i64, i128) |
1386 | 313..318 '1i128': i128 | 1386 | 312..317 '1i128': i128 |
1387 | 325..326 'a': A<u64, i64> | 1387 | 324..325 'a': A<u64, i64> |
1388 | 325..339 'a.z::<u128>(1)': (u64, i64, u128) | 1388 | 324..338 'a.z::<u128>(1)': (u64, i64, u128) |
1389 | 337..338 '1': u128 | 1389 | 336..337 '1': u128 |
1390 | "### | 1390 | "### |
1391 | ); | 1391 | ); |
1392 | } | 1392 | } |
@@ -1408,15 +1408,15 @@ fn test(o: Option<u32>) { | |||
1408 | } | 1408 | } |
1409 | "#), | 1409 | "#), |
1410 | @r###" | 1410 | @r###" |
1411 | 78..82 'self': &Option<T> | 1411 | 77..81 'self': &Option<T> |
1412 | 98..100 '{}': () | 1412 | 97..99 '{}': () |
1413 | 111..112 'o': Option<u32> | 1413 | 110..111 'o': Option<u32> |
1414 | 127..165 '{ ...f(); }': () | 1414 | 126..164 '{ ...f(); }': () |
1415 | 133..146 '(&o).as_ref()': Option<&u32> | 1415 | 132..145 '(&o).as_ref()': Option<&u32> |
1416 | 134..136 '&o': &Option<u32> | 1416 | 133..135 '&o': &Option<u32> |
1417 | 135..136 'o': Option<u32> | 1417 | 134..135 'o': Option<u32> |
1418 | 152..153 'o': Option<u32> | 1418 | 151..152 'o': Option<u32> |
1419 | 152..162 'o.as_ref()': Option<&u32> | 1419 | 151..161 'o.as_ref()': Option<&u32> |
1420 | "### | 1420 | "### |
1421 | ); | 1421 | ); |
1422 | } | 1422 | } |
@@ -1445,35 +1445,35 @@ fn test() -> i128 { | |||
1445 | } | 1445 | } |
1446 | "#), | 1446 | "#), |
1447 | @r###" | 1447 | @r###" |
1448 | 53..57 'self': A<T2> | 1448 | 52..56 'self': A<T2> |
1449 | 65..87 '{ ... }': T2 | 1449 | 64..86 '{ ... }': T2 |
1450 | 75..79 'self': A<T2> | 1450 | 74..78 'self': A<T2> |
1451 | 75..81 'self.x': T2 | 1451 | 74..80 'self.x': T2 |
1452 | 99..100 't': T | 1452 | 98..99 't': T |
1453 | 110..115 '{ t }': T | 1453 | 109..114 '{ t }': T |
1454 | 112..113 't': T | 1454 | 111..112 't': T |
1455 | 135..261 '{ ....x() }': i128 | 1455 | 134..260 '{ ....x() }': i128 |
1456 | 146..147 'x': i128 | 1456 | 145..146 'x': i128 |
1457 | 150..151 '1': i128 | 1457 | 149..150 '1': i128 |
1458 | 162..163 'y': i128 | 1458 | 161..162 'y': i128 |
1459 | 166..168 'id': fn id<i128>(i128) -> i128 | 1459 | 165..167 'id': fn id<i128>(i128) -> i128 |
1460 | 166..171 'id(x)': i128 | 1460 | 165..170 'id(x)': i128 |
1461 | 169..170 'x': i128 | 1461 | 168..169 'x': i128 |
1462 | 182..183 'a': A<i128> | 1462 | 181..182 'a': A<i128> |
1463 | 186..200 'A { x: id(y) }': A<i128> | 1463 | 185..199 'A { x: id(y) }': A<i128> |
1464 | 193..195 'id': fn id<i128>(i128) -> i128 | 1464 | 192..194 'id': fn id<i128>(i128) -> i128 |
1465 | 193..198 'id(y)': i128 | 1465 | 192..197 'id(y)': i128 |
1466 | 196..197 'y': i128 | 1466 | 195..196 'y': i128 |
1467 | 211..212 'z': i128 | 1467 | 210..211 'z': i128 |
1468 | 215..217 'id': fn id<i128>(i128) -> i128 | 1468 | 214..216 'id': fn id<i128>(i128) -> i128 |
1469 | 215..222 'id(a.x)': i128 | 1469 | 214..221 'id(a.x)': i128 |
1470 | 218..219 'a': A<i128> | 1470 | 217..218 'a': A<i128> |
1471 | 218..221 'a.x': i128 | 1471 | 217..220 'a.x': i128 |
1472 | 233..234 'b': A<i128> | 1472 | 232..233 'b': A<i128> |
1473 | 237..247 'A { x: z }': A<i128> | 1473 | 236..246 'A { x: z }': A<i128> |
1474 | 244..245 'z': i128 | 1474 | 243..244 'z': i128 |
1475 | 254..255 'b': A<i128> | 1475 | 253..254 'b': A<i128> |
1476 | 254..259 'b.x()': i128 | 1476 | 253..258 'b.x()': i128 |
1477 | "### | 1477 | "### |
1478 | ); | 1478 | ); |
1479 | } | 1479 | } |
@@ -1511,16 +1511,16 @@ fn test() { | |||
1511 | } | 1511 | } |
1512 | "#), | 1512 | "#), |
1513 | @r###" | 1513 | @r###" |
1514 | 52..53 '1': u32 | 1514 | 51..52 '1': u32 |
1515 | 105..106 '2': u32 | 1515 | 104..105 '2': u32 |
1516 | 213..214 '5': u32 | 1516 | 212..213 '5': u32 |
1517 | 229..307 '{ ...:ID; }': () | 1517 | 228..306 '{ ...:ID; }': () |
1518 | 239..240 'x': u32 | 1518 | 238..239 'x': u32 |
1519 | 243..254 'Struct::FOO': u32 | 1519 | 242..253 'Struct::FOO': u32 |
1520 | 264..265 'y': u32 | 1520 | 263..264 'y': u32 |
1521 | 268..277 'Enum::BAR': u32 | 1521 | 267..276 'Enum::BAR': u32 |
1522 | 287..288 'z': u32 | 1522 | 286..287 'z': u32 |
1523 | 291..304 'TraitTest::ID': u32 | 1523 | 290..303 'TraitTest::ID': u32 |
1524 | "### | 1524 | "### |
1525 | ); | 1525 | ); |
1526 | } | 1526 | } |
@@ -1543,22 +1543,22 @@ fn test(x: Foo, y: Bar<&str>, z: Baz<i8, u8>) { | |||
1543 | } | 1543 | } |
1544 | "#), | 1544 | "#), |
1545 | @r###" | 1545 | @r###" |
1546 | 116..117 'x': A<u32, i128> | 1546 | 115..116 'x': A<u32, i128> |
1547 | 124..125 'y': A<&str, u128> | 1547 | 123..124 'y': A<&str, u128> |
1548 | 138..139 'z': A<u8, i8> | 1548 | 137..138 'z': A<u8, i8> |
1549 | 154..211 '{ ...z.y; }': () | 1549 | 153..210 '{ ...z.y; }': () |
1550 | 160..161 'x': A<u32, i128> | 1550 | 159..160 'x': A<u32, i128> |
1551 | 160..163 'x.x': u32 | 1551 | 159..162 'x.x': u32 |
1552 | 169..170 'x': A<u32, i128> | 1552 | 168..169 'x': A<u32, i128> |
1553 | 169..172 'x.y': i128 | 1553 | 168..171 'x.y': i128 |
1554 | 178..179 'y': A<&str, u128> | 1554 | 177..178 'y': A<&str, u128> |
1555 | 178..181 'y.x': &str | 1555 | 177..180 'y.x': &str |
1556 | 187..188 'y': A<&str, u128> | 1556 | 186..187 'y': A<&str, u128> |
1557 | 187..190 'y.y': u128 | 1557 | 186..189 'y.y': u128 |
1558 | 196..197 'z': A<u8, i8> | 1558 | 195..196 'z': A<u8, i8> |
1559 | 196..199 'z.x': u8 | 1559 | 195..198 'z.x': u8 |
1560 | 205..206 'z': A<u8, i8> | 1560 | 204..205 'z': A<u8, i8> |
1561 | 205..208 'z.y': i8 | 1561 | 204..207 'z.y': i8 |
1562 | "### | 1562 | "### |
1563 | ) | 1563 | ) |
1564 | } | 1564 | } |
@@ -1573,8 +1573,8 @@ type Bar = A<Bar>; | |||
1573 | fn test(x: Foo) {} | 1573 | fn test(x: Foo) {} |
1574 | "#), | 1574 | "#), |
1575 | @r###" | 1575 | @r###" |
1576 | 59..60 'x': {unknown} | 1576 | 58..59 'x': {unknown} |
1577 | 67..69 '{}': () | 1577 | 66..68 '{}': () |
1578 | "### | 1578 | "### |
1579 | ) | 1579 | ) |
1580 | } | 1580 | } |
@@ -1599,26 +1599,26 @@ fn test() { | |||
1599 | } | 1599 | } |
1600 | "#), | 1600 | "#), |
1601 | @r###" | 1601 | @r###" |
1602 | 10..11 'x': T | 1602 | 9..10 'x': T |
1603 | 21..30 '{ x }': T | 1603 | 20..29 '{ x }': T |
1604 | 27..28 'x': T | 1604 | 26..27 'x': T |
1605 | 44..45 'x': &T | 1605 | 43..44 'x': &T |
1606 | 56..66 '{ *x }': T | 1606 | 55..65 '{ *x }': T |
1607 | 62..64 '*x': T | 1607 | 61..63 '*x': T |
1608 | 63..64 'x': &T | 1608 | 62..63 'x': &T |
1609 | 78..158 '{ ...(1); }': () | 1609 | 77..157 '{ ...(1); }': () |
1610 | 88..89 'y': u32 | 1610 | 87..88 'y': u32 |
1611 | 92..97 '10u32': u32 | 1611 | 91..96 '10u32': u32 |
1612 | 103..105 'id': fn id<u32>(u32) -> u32 | 1612 | 102..104 'id': fn id<u32>(u32) -> u32 |
1613 | 103..108 'id(y)': u32 | 1613 | 102..107 'id(y)': u32 |
1614 | 106..107 'y': u32 | 1614 | 105..106 'y': u32 |
1615 | 118..119 'x': bool | 1615 | 117..118 'x': bool |
1616 | 128..133 'clone': fn clone<bool>(&bool) -> bool | 1616 | 127..132 'clone': fn clone<bool>(&bool) -> bool |
1617 | 128..136 'clone(z)': bool | 1617 | 127..135 'clone(z)': bool |
1618 | 134..135 'z': &bool | 1618 | 133..134 'z': &bool |
1619 | 142..152 'id::<i128>': fn id<i128>(i128) -> i128 | 1619 | 141..151 'id::<i128>': fn id<i128>(i128) -> i128 |
1620 | 142..155 'id::<i128>(1)': i128 | 1620 | 141..154 'id::<i128>(1)': i128 |
1621 | 153..154 '1': i128 | 1621 | 152..153 '1': i128 |
1622 | "### | 1622 | "### |
1623 | ); | 1623 | ); |
1624 | } | 1624 | } |
@@ -1638,16 +1638,16 @@ fn test() { | |||
1638 | } | 1638 | } |
1639 | "#), | 1639 | "#), |
1640 | @r###" | 1640 | @r###" |
1641 | 49..50 '0': u32 | 1641 | 48..49 '0': u32 |
1642 | 80..83 '101': u32 | 1642 | 79..82 '101': u32 |
1643 | 95..213 '{ ...NST; }': () | 1643 | 94..212 '{ ...NST; }': () |
1644 | 138..139 'x': u32 | 1644 | 137..138 'x': u32 |
1645 | 142..153 'LOCAL_CONST': u32 | 1645 | 141..152 'LOCAL_CONST': u32 |
1646 | 163..164 'z': u32 | 1646 | 162..163 'z': u32 |
1647 | 167..179 'GLOBAL_CONST': u32 | 1647 | 166..178 'GLOBAL_CONST': u32 |
1648 | 189..191 'id': u32 | 1648 | 188..190 'id': u32 |
1649 | 194..210 'Foo::A..._CONST': u32 | 1649 | 193..209 'Foo::A..._CONST': u32 |
1650 | 126..128 '99': u32 | 1650 | 125..127 '99': u32 |
1651 | "### | 1651 | "### |
1652 | ); | 1652 | ); |
1653 | } | 1653 | } |
@@ -1668,19 +1668,19 @@ fn test() { | |||
1668 | } | 1668 | } |
1669 | "#), | 1669 | "#), |
1670 | @r###" | 1670 | @r###" |
1671 | 29..32 '101': u32 | 1671 | 28..31 '101': u32 |
1672 | 70..73 '101': u32 | 1672 | 69..72 '101': u32 |
1673 | 85..280 '{ ...MUT; }': () | 1673 | 84..279 '{ ...MUT; }': () |
1674 | 173..174 'x': u32 | 1674 | 172..173 'x': u32 |
1675 | 177..189 'LOCAL_STATIC': u32 | 1675 | 176..188 'LOCAL_STATIC': u32 |
1676 | 199..200 'y': u32 | 1676 | 198..199 'y': u32 |
1677 | 203..219 'LOCAL_...IC_MUT': u32 | 1677 | 202..218 'LOCAL_...IC_MUT': u32 |
1678 | 229..230 'z': u32 | 1678 | 228..229 'z': u32 |
1679 | 233..246 'GLOBAL_STATIC': u32 | 1679 | 232..245 'GLOBAL_STATIC': u32 |
1680 | 256..257 'w': u32 | 1680 | 255..256 'w': u32 |
1681 | 260..277 'GLOBAL...IC_MUT': u32 | 1681 | 259..276 'GLOBAL...IC_MUT': u32 |
1682 | 118..120 '99': u32 | 1682 | 117..119 '99': u32 |
1683 | 161..163 '99': u32 | 1683 | 160..162 '99': u32 |
1684 | "### | 1684 | "### |
1685 | ); | 1685 | ); |
1686 | } | 1686 | } |
@@ -1748,12 +1748,12 @@ fn foo() -> u32 { | |||
1748 | } | 1748 | } |
1749 | "#), | 1749 | "#), |
1750 | @r###" | 1750 | @r###" |
1751 | 17..59 '{ ...; }; }': () | 1751 | 16..58 '{ ...; }; }': () |
1752 | 27..28 'x': || -> usize | 1752 | 26..27 'x': || -> usize |
1753 | 31..56 '|| -> ...n 1; }': || -> usize | 1753 | 30..55 '|| -> ...n 1; }': || -> usize |
1754 | 43..56 '{ return 1; }': usize | 1754 | 42..55 '{ return 1; }': usize |
1755 | 45..53 'return 1': ! | 1755 | 44..52 'return 1': ! |
1756 | 52..53 '1': usize | 1756 | 51..52 '1': usize |
1757 | "### | 1757 | "### |
1758 | ); | 1758 | ); |
1759 | } | 1759 | } |
@@ -1767,11 +1767,11 @@ fn foo() -> u32 { | |||
1767 | } | 1767 | } |
1768 | "#), | 1768 | "#), |
1769 | @r###" | 1769 | @r###" |
1770 | 17..48 '{ ...; }; }': () | 1770 | 16..47 '{ ...; }; }': () |
1771 | 27..28 'x': || -> () | 1771 | 26..27 'x': || -> () |
1772 | 31..45 '|| { return; }': || -> () | 1772 | 30..44 '|| { return; }': || -> () |
1773 | 34..45 '{ return; }': () | 1773 | 33..44 '{ return; }': () |
1774 | 36..42 'return': ! | 1774 | 35..41 'return': ! |
1775 | "### | 1775 | "### |
1776 | ); | 1776 | ); |
1777 | } | 1777 | } |
@@ -1785,11 +1785,11 @@ fn foo() -> u32 { | |||
1785 | } | 1785 | } |
1786 | "#), | 1786 | "#), |
1787 | @r###" | 1787 | @r###" |
1788 | 17..47 '{ ..." }; }': () | 1788 | 16..46 '{ ..." }; }': () |
1789 | 27..28 'x': || -> &str | 1789 | 26..27 'x': || -> &str |
1790 | 31..44 '|| { "test" }': || -> &str | 1790 | 30..43 '|| { "test" }': || -> &str |
1791 | 34..44 '{ "test" }': &str | 1791 | 33..43 '{ "test" }': &str |
1792 | 36..42 '"test"': &str | 1792 | 35..41 '"test"': &str |
1793 | "### | 1793 | "### |
1794 | ); | 1794 | ); |
1795 | } | 1795 | } |
@@ -1808,14 +1808,14 @@ fn main() { | |||
1808 | } | 1808 | } |
1809 | "#), | 1809 | "#), |
1810 | @r###" | 1810 | @r###" |
1811 | 48..121 '{ ...hod; }': () | 1811 | 47..120 '{ ...hod; }': () |
1812 | 58..64 'vtable': Vtable | 1812 | 57..63 'vtable': Vtable |
1813 | 67..91 'Vtable...| {} }': Vtable | 1813 | 66..90 'Vtable...| {} }': Vtable |
1814 | 84..89 '|| {}': || -> () | 1814 | 83..88 '|| {}': || -> () |
1815 | 87..89 '{}': () | 1815 | 86..88 '{}': () |
1816 | 101..102 'm': fn() | 1816 | 100..101 'm': fn() |
1817 | 105..111 'vtable': Vtable | 1817 | 104..110 'vtable': Vtable |
1818 | 105..118 'vtable.method': fn() | 1818 | 104..117 'vtable.method': fn() |
1819 | "### | 1819 | "### |
1820 | ); | 1820 | ); |
1821 | } | 1821 | } |
@@ -1832,22 +1832,22 @@ fn main() { | |||
1832 | } | 1832 | } |
1833 | "#), | 1833 | "#), |
1834 | @r###" | 1834 | @r###" |
1835 | 11..131 '{ ...2 }; }': () | 1835 | 10..130 '{ ...2 }; }': () |
1836 | 21..22 'x': i32 | 1836 | 20..21 'x': i32 |
1837 | 32..38 '{ 92 }': i32 | 1837 | 31..37 '{ 92 }': i32 |
1838 | 34..36 '92': i32 | 1838 | 33..35 '92': i32 |
1839 | 48..49 'y': {unknown} | 1839 | 47..48 'y': {unknown} |
1840 | 58..80 '{ asyn...wait }': {unknown} | 1840 | 57..79 '{ asyn...wait }': {unknown} |
1841 | 60..78 'async ....await': {unknown} | 1841 | 59..77 'async ....await': {unknown} |
1842 | 66..72 '{ () }': () | 1842 | 65..71 '{ () }': () |
1843 | 68..70 '()': () | 1843 | 67..69 '()': () |
1844 | 90..91 'z': {unknown} | 1844 | 89..90 'z': {unknown} |
1845 | 94..104 'try { () }': {unknown} | 1845 | 93..103 'try { () }': {unknown} |
1846 | 98..104 '{ () }': () | 1846 | 97..103 '{ () }': () |
1847 | 100..102 '()': () | 1847 | 99..101 '()': () |
1848 | 114..115 't': i32 | 1848 | 113..114 't': i32 |
1849 | 122..128 '{ 92 }': i32 | 1849 | 121..127 '{ 92 }': i32 |
1850 | 124..126 '92': i32 | 1850 | 123..125 '92': i32 |
1851 | "### | 1851 | "### |
1852 | ) | 1852 | ) |
1853 | } | 1853 | } |
@@ -1867,16 +1867,16 @@ fn test() { | |||
1867 | } | 1867 | } |
1868 | "#), | 1868 | "#), |
1869 | @r###" | 1869 | @r###" |
1870 | 60..130 '{ ... } }': () | 1870 | 59..129 '{ ... } }': () |
1871 | 70..77 'mut end': Option<bool> | 1871 | 69..76 'mut end': Option<bool> |
1872 | 80..84 'None': Option<bool> | 1872 | 79..83 'None': Option<bool> |
1873 | 90..128 'loop {... }': ! | 1873 | 89..127 'loop {... }': ! |
1874 | 95..128 '{ ... }': () | 1874 | 94..127 '{ ... }': () |
1875 | 105..108 'end': Option<bool> | 1875 | 104..107 'end': Option<bool> |
1876 | 105..121 'end = ...(true)': () | 1876 | 104..120 'end = ...(true)': () |
1877 | 111..115 'Some': Some<bool>(bool) -> Option<bool> | 1877 | 110..114 'Some': Some<bool>(bool) -> Option<bool> |
1878 | 111..121 'Some(true)': Option<bool> | 1878 | 110..120 'Some(true)': Option<bool> |
1879 | 116..120 'true': bool | 1879 | 115..119 'true': bool |
1880 | "### | 1880 | "### |
1881 | ); | 1881 | ); |
1882 | } | 1882 | } |
@@ -1899,19 +1899,19 @@ fn test() { | |||
1899 | } | 1899 | } |
1900 | "#), | 1900 | "#), |
1901 | @r###" | 1901 | @r###" |
1902 | 60..169 '{ ... }; }': () | 1902 | 59..168 '{ ... }; }': () |
1903 | 70..71 'x': Option<bool> | 1903 | 69..70 'x': Option<bool> |
1904 | 74..166 'loop {... }': Option<bool> | 1904 | 73..165 'loop {... }': Option<bool> |
1905 | 79..166 '{ ... }': () | 1905 | 78..165 '{ ... }': () |
1906 | 89..133 'if fal... }': () | 1906 | 88..132 'if fal... }': () |
1907 | 92..97 'false': bool | 1907 | 91..96 'false': bool |
1908 | 98..133 '{ ... }': () | 1908 | 97..132 '{ ... }': () |
1909 | 112..122 'break None': ! | 1909 | 111..121 'break None': ! |
1910 | 118..122 'None': Option<bool> | 1910 | 117..121 'None': Option<bool> |
1911 | 143..159 'break ...(true)': ! | 1911 | 142..158 'break ...(true)': ! |
1912 | 149..153 'Some': Some<bool>(bool) -> Option<bool> | 1912 | 148..152 'Some': Some<bool>(bool) -> Option<bool> |
1913 | 149..159 'Some(true)': Option<bool> | 1913 | 148..158 'Some(true)': Option<bool> |
1914 | 154..158 'true': bool | 1914 | 153..157 'true': bool |
1915 | "### | 1915 | "### |
1916 | ); | 1916 | ); |
1917 | } | 1917 | } |
@@ -1932,14 +1932,14 @@ fn test() { | |||
1932 | } | 1932 | } |
1933 | "#), | 1933 | "#), |
1934 | @r###" | 1934 | @r###" |
1935 | 60..137 '{ ... }; }': () | 1935 | 59..136 '{ ... }; }': () |
1936 | 70..71 'x': () | 1936 | 69..70 'x': () |
1937 | 74..134 'loop {... }': () | 1937 | 73..133 'loop {... }': () |
1938 | 79..134 '{ ... }': () | 1938 | 78..133 '{ ... }': () |
1939 | 89..128 'if fal... }': () | 1939 | 88..127 'if fal... }': () |
1940 | 92..97 'false': bool | 1940 | 91..96 'false': bool |
1941 | 98..128 '{ ... }': () | 1941 | 97..127 '{ ... }': () |
1942 | 112..117 'break': ! | 1942 | 111..116 'break': ! |
1943 | "### | 1943 | "### |
1944 | ); | 1944 | ); |
1945 | } | 1945 | } |
@@ -1964,36 +1964,36 @@ fn foo() { | |||
1964 | } | 1964 | } |
1965 | "#), | 1965 | "#), |
1966 | @r###" | 1966 | @r###" |
1967 | 10..336 '{ ... }; }': () | 1967 | 9..335 '{ ... }; }': () |
1968 | 20..22 '_x': || -> bool | 1968 | 19..21 '_x': || -> bool |
1969 | 25..333 '|| 'ou... }': || -> bool | 1969 | 24..332 '|| 'ou... }': || -> bool |
1970 | 28..333 ''outer... }': bool | 1970 | 27..332 ''outer... }': bool |
1971 | 41..333 '{ ... }': () | 1971 | 40..332 '{ ... }': () |
1972 | 55..60 'inner': i8 | 1972 | 54..59 'inner': i8 |
1973 | 63..301 ''inner... }': i8 | 1973 | 62..300 ''inner... }': i8 |
1974 | 76..301 '{ ... }': () | 1974 | 75..300 '{ ... }': () |
1975 | 94..95 'i': bool | 1975 | 93..94 'i': bool |
1976 | 98..114 'Defaul...efault': {unknown} | 1976 | 97..113 'Defaul...efault': {unknown} |
1977 | 98..116 'Defaul...ault()': bool | 1977 | 97..115 'Defaul...ault()': bool |
1978 | 130..270 'if (br... }': () | 1978 | 129..269 'if (br... }': () |
1979 | 134..148 'break 'outer i': ! | 1979 | 133..147 'break 'outer i': ! |
1980 | 147..148 'i': bool | 1980 | 146..147 'i': bool |
1981 | 150..209 '{ ... }': () | 1981 | 149..208 '{ ... }': () |
1982 | 168..194 'loop {...5i8; }': ! | 1982 | 167..193 'loop {...5i8; }': ! |
1983 | 173..194 '{ brea...5i8; }': () | 1983 | 172..193 '{ brea...5i8; }': () |
1984 | 175..191 'break ...er 5i8': ! | 1984 | 174..190 'break ...er 5i8': ! |
1985 | 188..191 '5i8': i8 | 1985 | 187..190 '5i8': i8 |
1986 | 215..270 'if tru... }': () | 1986 | 214..269 'if tru... }': () |
1987 | 218..222 'true': bool | 1987 | 217..221 'true': bool |
1988 | 223..270 '{ ... }': () | 1988 | 222..269 '{ ... }': () |
1989 | 241..255 'break 'inner 6': ! | 1989 | 240..254 'break 'inner 6': ! |
1990 | 254..255 '6': i8 | 1990 | 253..254 '6': i8 |
1991 | 283..290 'break 7': ! | 1991 | 282..289 'break 7': ! |
1992 | 289..290 '7': i8 | 1992 | 288..289 '7': i8 |
1993 | 311..326 'break inner < 8': ! | 1993 | 310..325 'break inner < 8': ! |
1994 | 317..322 'inner': i8 | 1994 | 316..321 'inner': i8 |
1995 | 317..326 'inner < 8': bool | 1995 | 316..325 'inner < 8': bool |
1996 | 325..326 '8': i8 | 1996 | 324..325 '8': i8 |
1997 | "### | 1997 | "### |
1998 | ); | 1998 | ); |
1999 | } | 1999 | } |
@@ -2022,35 +2022,35 @@ fn test(t1: Thing, t2: OtherThing, t3: Thing<i32>, t4: OtherThing<i32>) { | |||
2022 | } | 2022 | } |
2023 | "#), | 2023 | "#), |
2024 | @r###" | 2024 | @r###" |
2025 | 98..100 't1': Thing<()> | 2025 | 97..99 't1': Thing<()> |
2026 | 109..111 't2': OtherThing<()> | 2026 | 108..110 't2': OtherThing<()> |
2027 | 125..127 't3': Thing<i32> | 2027 | 124..126 't3': Thing<i32> |
2028 | 141..143 't4': OtherThing<i32> | 2028 | 140..142 't4': OtherThing<i32> |
2029 | 162..385 '{ ... } }': () | 2029 | 161..384 '{ ... } }': () |
2030 | 168..170 't1': Thing<()> | 2030 | 167..169 't1': Thing<()> |
2031 | 168..172 't1.t': () | 2031 | 167..171 't1.t': () |
2032 | 178..180 't3': Thing<i32> | 2032 | 177..179 't3': Thing<i32> |
2033 | 178..182 't3.t': i32 | 2033 | 177..181 't3.t': i32 |
2034 | 188..283 'match ... }': () | 2034 | 187..282 'match ... }': () |
2035 | 194..196 't2': OtherThing<()> | 2035 | 193..195 't2': OtherThing<()> |
2036 | 207..228 'OtherT... { t }': OtherThing<()> | 2036 | 206..227 'OtherT... { t }': OtherThing<()> |
2037 | 225..226 't': () | 2037 | 224..225 't': () |
2038 | 232..238 '{ t; }': () | 2038 | 231..237 '{ t; }': () |
2039 | 234..235 't': () | 2039 | 233..234 't': () |
2040 | 248..266 'OtherT...Two(t)': OtherThing<()> | 2040 | 247..265 'OtherT...Two(t)': OtherThing<()> |
2041 | 264..265 't': () | 2041 | 263..264 't': () |
2042 | 270..276 '{ t; }': () | 2042 | 269..275 '{ t; }': () |
2043 | 272..273 't': () | 2043 | 271..272 't': () |
2044 | 288..383 'match ... }': () | 2044 | 287..382 'match ... }': () |
2045 | 294..296 't4': OtherThing<i32> | 2045 | 293..295 't4': OtherThing<i32> |
2046 | 307..328 'OtherT... { t }': OtherThing<i32> | 2046 | 306..327 'OtherT... { t }': OtherThing<i32> |
2047 | 325..326 't': i32 | 2047 | 324..325 't': i32 |
2048 | 332..338 '{ t; }': () | 2048 | 331..337 '{ t; }': () |
2049 | 334..335 't': i32 | 2049 | 333..334 't': i32 |
2050 | 348..366 'OtherT...Two(t)': OtherThing<i32> | 2050 | 347..365 'OtherT...Two(t)': OtherThing<i32> |
2051 | 364..365 't': i32 | 2051 | 363..364 't': i32 |
2052 | 370..376 '{ t; }': () | 2052 | 369..375 '{ t; }': () |
2053 | 372..373 't': i32 | 2053 | 371..372 't': i32 |
2054 | "### | 2054 | "### |
2055 | ); | 2055 | ); |
2056 | } | 2056 | } |
@@ -2078,30 +2078,30 @@ fn test() { | |||
2078 | } | 2078 | } |
2079 | "#), | 2079 | "#), |
2080 | @r###" | 2080 | @r###" |
2081 | 100..320 '{ ...32); }': () | 2081 | 99..319 '{ ...32); }': () |
2082 | 110..111 'x': Thing<!> | 2082 | 109..110 'x': Thing<!> |
2083 | 114..134 'Thing ...p {} }': Thing<!> | 2083 | 113..133 'Thing ...p {} }': Thing<!> |
2084 | 125..132 'loop {}': ! | 2084 | 124..131 'loop {}': ! |
2085 | 130..132 '{}': () | 2085 | 129..131 '{}': () |
2086 | 144..145 'y': Thing<()> | 2086 | 143..144 'y': Thing<()> |
2087 | 148..163 'Thing { t: () }': Thing<()> | 2087 | 147..162 'Thing { t: () }': Thing<()> |
2088 | 159..161 '()': () | 2088 | 158..160 '()': () |
2089 | 173..174 'z': Thing<i32> | 2089 | 172..173 'z': Thing<i32> |
2090 | 177..194 'Thing ...1i32 }': Thing<i32> | 2090 | 176..193 'Thing ...1i32 }': Thing<i32> |
2091 | 188..192 '1i32': i32 | 2091 | 187..191 '1i32': i32 |
2092 | 200..241 'if let... }': () | 2092 | 199..240 'if let... }': () |
2093 | 207..218 'Thing { t }': Thing<i32> | 2093 | 206..217 'Thing { t }': Thing<i32> |
2094 | 215..216 't': i32 | 2094 | 214..215 't': i32 |
2095 | 221..222 'z': Thing<i32> | 2095 | 220..221 'z': Thing<i32> |
2096 | 223..241 '{ ... }': () | 2096 | 222..240 '{ ... }': () |
2097 | 233..234 't': i32 | 2097 | 232..233 't': i32 |
2098 | 251..252 'a': OtherThing<i32> | 2098 | 250..251 'a': OtherThing<i32> |
2099 | 255..282 'OtherT...1i32 }': OtherThing<i32> | 2099 | 254..281 'OtherT...1i32 }': OtherThing<i32> |
2100 | 276..280 '1i32': i32 | 2100 | 275..279 '1i32': i32 |
2101 | 292..293 'b': OtherThing<i32> | 2101 | 291..292 'b': OtherThing<i32> |
2102 | 296..311 'OtherThing::Two': Two<i32>(i32) -> OtherThing<i32> | 2102 | 295..310 'OtherThing::Two': Two<i32>(i32) -> OtherThing<i32> |
2103 | 296..317 'OtherT...(1i32)': OtherThing<i32> | 2103 | 295..316 'OtherT...(1i32)': OtherThing<i32> |
2104 | 312..316 '1i32': i32 | 2104 | 311..315 '1i32': i32 |
2105 | "### | 2105 | "### |
2106 | ); | 2106 | ); |
2107 | } | 2107 | } |
diff --git a/crates/ra_hir_ty/src/tests/traits.rs b/crates/ra_hir_ty/src/tests/traits.rs index 961be4abd..646e1715c 100644 --- a/crates/ra_hir_ty/src/tests/traits.rs +++ b/crates/ra_hir_ty/src/tests/traits.rs | |||
@@ -259,16 +259,16 @@ fn test() { | |||
259 | } | 259 | } |
260 | "#), | 260 | "#), |
261 | @r###" | 261 | @r###" |
262 | 86..87 't': T | 262 | 85..86 't': T |
263 | 92..94 '{}': () | 263 | 91..93 '{}': () |
264 | 105..144 '{ ...(s); }': () | 264 | 104..143 '{ ...(s); }': () |
265 | 115..116 's': S<u32> | 265 | 114..115 's': S<u32> |
266 | 119..120 'S': S<u32>(u32) -> S<u32> | 266 | 118..119 'S': S<u32>(u32) -> S<u32> |
267 | 119..129 'S(unknown)': S<u32> | 267 | 118..128 'S(unknown)': S<u32> |
268 | 121..128 'unknown': u32 | 268 | 120..127 'unknown': u32 |
269 | 135..138 'foo': fn foo<S<u32>>(S<u32>) | 269 | 134..137 'foo': fn foo<S<u32>>(S<u32>) |
270 | 135..141 'foo(s)': () | 270 | 134..140 'foo(s)': () |
271 | 139..140 's': S<u32> | 271 | 138..139 's': S<u32> |
272 | "### | 272 | "### |
273 | ); | 273 | ); |
274 | } | 274 | } |
@@ -287,17 +287,17 @@ fn test() { | |||
287 | } | 287 | } |
288 | "#), | 288 | "#), |
289 | @r###" | 289 | @r###" |
290 | 87..88 't': T | 290 | 86..87 't': T |
291 | 98..100 '{}': () | 291 | 97..99 '{}': () |
292 | 111..163 '{ ...(s); }': () | 292 | 110..162 '{ ...(s); }': () |
293 | 121..122 's': S<u32> | 293 | 120..121 's': S<u32> |
294 | 125..126 'S': S<u32>(u32) -> S<u32> | 294 | 124..125 'S': S<u32>(u32) -> S<u32> |
295 | 125..135 'S(unknown)': S<u32> | 295 | 124..134 'S(unknown)': S<u32> |
296 | 127..134 'unknown': u32 | 296 | 126..133 'unknown': u32 |
297 | 145..146 'x': u32 | 297 | 144..145 'x': u32 |
298 | 154..157 'foo': fn foo<u32, S<u32>>(S<u32>) -> u32 | 298 | 153..156 'foo': fn foo<u32, S<u32>>(S<u32>) -> u32 |
299 | 154..160 'foo(s)': u32 | 299 | 153..159 'foo(s)': u32 |
300 | 158..159 's': S<u32> | 300 | 157..158 's': S<u32> |
301 | "### | 301 | "### |
302 | ); | 302 | ); |
303 | } | 303 | } |
@@ -315,12 +315,12 @@ trait Trait { | |||
315 | } | 315 | } |
316 | "#), | 316 | "#), |
317 | @r###" | 317 | @r###" |
318 | 27..31 'self': &Self | 318 | 26..30 'self': &Self |
319 | 53..57 'self': &Self | 319 | 52..56 'self': &Self |
320 | 62..97 '{ ... }': () | 320 | 61..96 '{ ... }': () |
321 | 76..77 'x': i64 | 321 | 75..76 'x': i64 |
322 | 80..84 'self': &Self | 322 | 79..83 'self': &Self |
323 | 80..90 'self.foo()': i64 | 323 | 79..89 'self.foo()': i64 |
324 | "### | 324 | "### |
325 | ); | 325 | ); |
326 | } | 326 | } |
@@ -339,12 +339,12 @@ trait Trait: SuperTrait { | |||
339 | } | 339 | } |
340 | "#), | 340 | "#), |
341 | @r###" | 341 | @r###" |
342 | 32..36 'self': &Self | 342 | 31..35 'self': &Self |
343 | 86..90 'self': &Self | 343 | 85..89 'self': &Self |
344 | 95..130 '{ ... }': () | 344 | 94..129 '{ ... }': () |
345 | 109..110 'x': i64 | 345 | 108..109 'x': i64 |
346 | 113..117 'self': &Self | 346 | 112..116 'self': &Self |
347 | 113..123 'self.foo()': i64 | 347 | 112..122 'self.foo()': i64 |
348 | "### | 348 | "### |
349 | ); | 349 | ); |
350 | } | 350 | } |
@@ -366,15 +366,15 @@ fn test<T: Iterable>() { | |||
366 | } | 366 | } |
367 | "#), | 367 | "#), |
368 | @r###" | 368 | @r###" |
369 | 108..261 '{ ...ter; }': () | 369 | 107..260 '{ ...ter; }': () |
370 | 118..119 'x': u32 | 370 | 117..118 'x': u32 |
371 | 145..146 '1': u32 | 371 | 144..145 '1': u32 |
372 | 156..157 'y': Iterable::Item<T> | 372 | 155..156 'y': Iterable::Item<T> |
373 | 183..192 'no_matter': Iterable::Item<T> | 373 | 182..191 'no_matter': Iterable::Item<T> |
374 | 202..203 'z': Iterable::Item<T> | 374 | 201..202 'z': Iterable::Item<T> |
375 | 215..224 'no_matter': Iterable::Item<T> | 375 | 214..223 'no_matter': Iterable::Item<T> |
376 | 234..235 'a': Iterable::Item<T> | 376 | 233..234 'a': Iterable::Item<T> |
377 | 249..258 'no_matter': Iterable::Item<T> | 377 | 248..257 'no_matter': Iterable::Item<T> |
378 | "### | 378 | "### |
379 | ); | 379 | ); |
380 | } | 380 | } |
@@ -398,25 +398,25 @@ fn test() { | |||
398 | } | 398 | } |
399 | "#), | 399 | "#), |
400 | @r###" | 400 | @r###" |
401 | 106..107 't': T | 401 | 105..106 't': T |
402 | 123..125 '{}': () | 402 | 122..124 '{}': () |
403 | 147..148 't': T | 403 | 146..147 't': T |
404 | 178..180 '{}': () | 404 | 177..179 '{}': () |
405 | 202..203 't': T | 405 | 201..202 't': T |
406 | 221..223 '{}': () | 406 | 220..222 '{}': () |
407 | 234..300 '{ ...(S); }': () | 407 | 233..299 '{ ...(S); }': () |
408 | 244..245 'x': u32 | 408 | 243..244 'x': u32 |
409 | 248..252 'foo1': fn foo1<S>(S) -> <S as Iterable>::Item | 409 | 247..251 'foo1': fn foo1<S>(S) -> <S as Iterable>::Item |
410 | 248..255 'foo1(S)': u32 | 410 | 247..254 'foo1(S)': u32 |
411 | 253..254 'S': S | 411 | 252..253 'S': S |
412 | 265..266 'y': u32 | 412 | 264..265 'y': u32 |
413 | 269..273 'foo2': fn foo2<S>(S) -> <S as Iterable>::Item | 413 | 268..272 'foo2': fn foo2<S>(S) -> <S as Iterable>::Item |
414 | 269..276 'foo2(S)': u32 | 414 | 268..275 'foo2(S)': u32 |
415 | 274..275 'S': S | 415 | 273..274 'S': S |
416 | 286..287 'z': u32 | 416 | 285..286 'z': u32 |
417 | 290..294 'foo3': fn foo3<S>(S) -> <S as Iterable>::Item | 417 | 289..293 'foo3': fn foo3<S>(S) -> <S as Iterable>::Item |
418 | 290..297 'foo3(S)': u32 | 418 | 289..296 'foo3(S)': u32 |
419 | 295..296 'S': S | 419 | 294..295 'S': S |
420 | "### | 420 | "### |
421 | ); | 421 | ); |
422 | } | 422 | } |
@@ -433,9 +433,9 @@ fn test<T: Iterable<Item=u32>>() { | |||
433 | } | 433 | } |
434 | "#), | 434 | "#), |
435 | @r###" | 435 | @r###" |
436 | 67..100 '{ ...own; }': () | 436 | 66..99 '{ ...own; }': () |
437 | 77..78 'y': u32 | 437 | 76..77 'y': u32 |
438 | 90..97 'unknown': u32 | 438 | 89..96 'unknown': u32 |
439 | "### | 439 | "### |
440 | ); | 440 | ); |
441 | } | 441 | } |
@@ -448,13 +448,13 @@ const A: u32 = 1 + 1; | |||
448 | static B: u64 = { let x = 1; x }; | 448 | static B: u64 = { let x = 1; x }; |
449 | "#), | 449 | "#), |
450 | @r###" | 450 | @r###" |
451 | 16..17 '1': u32 | 451 | 15..16 '1': u32 |
452 | 16..21 '1 + 1': u32 | 452 | 15..20 '1 + 1': u32 |
453 | 20..21 '1': u32 | 453 | 19..20 '1': u32 |
454 | 39..55 '{ let ...1; x }': u64 | 454 | 38..54 '{ let ...1; x }': u64 |
455 | 45..46 'x': u64 | 455 | 44..45 'x': u64 |
456 | 49..50 '1': u64 | 456 | 48..49 '1': u64 |
457 | 52..53 'x': u64 | 457 | 51..52 'x': u64 |
458 | "### | 458 | "### |
459 | ); | 459 | ); |
460 | } | 460 | } |
@@ -471,17 +471,17 @@ fn test() -> u64 { | |||
471 | } | 471 | } |
472 | "#), | 472 | "#), |
473 | @r###" | 473 | @r###" |
474 | 38..87 '{ ... a.1 }': u64 | 474 | 37..86 '{ ... a.1 }': u64 |
475 | 48..49 'a': S | 475 | 47..48 'a': S |
476 | 52..53 'S': S(i32, u64) -> S | 476 | 51..52 'S': S(i32, u64) -> S |
477 | 52..59 'S(4, 6)': S | 477 | 51..58 'S(4, 6)': S |
478 | 54..55 '4': i32 | 478 | 53..54 '4': i32 |
479 | 57..58 '6': u64 | 479 | 56..57 '6': u64 |
480 | 69..70 'b': i32 | 480 | 68..69 'b': i32 |
481 | 73..74 'a': S | 481 | 72..73 'a': S |
482 | 73..76 'a.0': i32 | 482 | 72..75 'a.0': i32 |
483 | 82..83 'a': S | 483 | 81..82 'a': S |
484 | 82..85 'a.1': u64 | 484 | 81..84 'a.1': u64 |
485 | "### | 485 | "### |
486 | ); | 486 | ); |
487 | } | 487 | } |
@@ -498,24 +498,24 @@ fn test() -> u64 { | |||
498 | } | 498 | } |
499 | "#), | 499 | "#), |
500 | @r###" | 500 | @r###" |
501 | 44..102 '{ ...0(2) }': u64 | 501 | 43..101 '{ ...0(2) }': u64 |
502 | 54..55 'a': S | 502 | 53..54 'a': S |
503 | 58..59 'S': S(fn(u32) -> u64) -> S | 503 | 57..58 'S': S(fn(u32) -> u64) -> S |
504 | 58..68 'S(|i| 2*i)': S | 504 | 57..67 'S(|i| 2*i)': S |
505 | 60..67 '|i| 2*i': |u32| -> u64 | 505 | 59..66 '|i| 2*i': |u32| -> u64 |
506 | 61..62 'i': u32 | 506 | 60..61 'i': u32 |
507 | 64..65 '2': u32 | 507 | 63..64 '2': u32 |
508 | 64..67 '2*i': u32 | 508 | 63..66 '2*i': u32 |
509 | 66..67 'i': u32 | 509 | 65..66 'i': u32 |
510 | 78..79 'b': u64 | 510 | 77..78 'b': u64 |
511 | 82..83 'a': S | 511 | 81..82 'a': S |
512 | 82..85 'a.0': fn(u32) -> u64 | 512 | 81..84 'a.0': fn(u32) -> u64 |
513 | 82..88 'a.0(4)': u64 | 513 | 81..87 'a.0(4)': u64 |
514 | 86..87 '4': u32 | 514 | 85..86 '4': u32 |
515 | 94..95 'a': S | 515 | 93..94 'a': S |
516 | 94..97 'a.0': fn(u32) -> u64 | 516 | 93..96 'a.0': fn(u32) -> u64 |
517 | 94..100 'a.0(2)': u64 | 517 | 93..99 'a.0(2)': u64 |
518 | 98..99 '2': u32 | 518 | 97..98 '2': u32 |
519 | "### | 519 | "### |
520 | ); | 520 | ); |
521 | } | 521 | } |
@@ -946,34 +946,34 @@ fn test(x: impl Trait<u64>, y: &impl Trait<u32>) { | |||
946 | } | 946 | } |
947 | "#, true), | 947 | "#, true), |
948 | @r###" | 948 | @r###" |
949 | 30..34 'self': &Self | 949 | 29..33 'self': &Self |
950 | 55..59 'self': &Self | 950 | 54..58 'self': &Self |
951 | 78..79 'x': impl Trait<u16> | 951 | 77..78 'x': impl Trait<u16> |
952 | 98..100 '{}': () | 952 | 97..99 '{}': () |
953 | 155..156 'x': impl Trait<u64> | 953 | 154..155 'x': impl Trait<u64> |
954 | 175..176 'y': &impl Trait<u32> | 954 | 174..175 'y': &impl Trait<u32> |
955 | 196..324 '{ ...2(); }': () | 955 | 195..323 '{ ...2(); }': () |
956 | 202..203 'x': impl Trait<u64> | 956 | 201..202 'x': impl Trait<u64> |
957 | 209..210 'y': &impl Trait<u32> | 957 | 208..209 'y': &impl Trait<u32> |
958 | 220..221 'z': S<u16> | 958 | 219..220 'z': S<u16> |
959 | 224..225 'S': S<u16>(u16) -> S<u16> | 959 | 223..224 'S': S<u16>(u16) -> S<u16> |
960 | 224..228 'S(1)': S<u16> | 960 | 223..227 'S(1)': S<u16> |
961 | 226..227 '1': u16 | 961 | 225..226 '1': u16 |
962 | 234..237 'bar': fn bar(S<u16>) | 962 | 233..236 'bar': fn bar(S<u16>) |
963 | 234..240 'bar(z)': () | 963 | 233..239 'bar(z)': () |
964 | 238..239 'z': S<u16> | 964 | 237..238 'z': S<u16> |
965 | 246..247 'x': impl Trait<u64> | 965 | 245..246 'x': impl Trait<u64> |
966 | 246..253 'x.foo()': u64 | 966 | 245..252 'x.foo()': u64 |
967 | 259..260 'y': &impl Trait<u32> | 967 | 258..259 'y': &impl Trait<u32> |
968 | 259..266 'y.foo()': u32 | 968 | 258..265 'y.foo()': u32 |
969 | 272..273 'z': S<u16> | 969 | 271..272 'z': S<u16> |
970 | 272..279 'z.foo()': u16 | 970 | 271..278 'z.foo()': u16 |
971 | 285..286 'x': impl Trait<u64> | 971 | 284..285 'x': impl Trait<u64> |
972 | 285..293 'x.foo2()': i64 | 972 | 284..292 'x.foo2()': i64 |
973 | 299..300 'y': &impl Trait<u32> | 973 | 298..299 'y': &impl Trait<u32> |
974 | 299..307 'y.foo2()': i64 | 974 | 298..306 'y.foo2()': i64 |
975 | 313..314 'z': S<u16> | 975 | 312..313 'z': S<u16> |
976 | 313..321 'z.foo2()': i64 | 976 | 312..320 'z.foo2()': i64 |
977 | "### | 977 | "### |
978 | ); | 978 | ); |
979 | } | 979 | } |
@@ -1007,39 +1007,39 @@ fn test() { | |||
1007 | } | 1007 | } |
1008 | "#, true), | 1008 | "#, true), |
1009 | @r###" | 1009 | @r###" |
1010 | 156..157 'x': impl Trait | 1010 | 155..156 'x': impl Trait |
1011 | 176..187 '{ loop {} }': T | 1011 | 175..186 '{ loop {} }': T |
1012 | 178..185 'loop {}': ! | 1012 | 177..184 'loop {}': ! |
1013 | 183..185 '{}': () | 1013 | 182..184 '{}': () |
1014 | 200..201 'x': impl Trait | 1014 | 199..200 'x': impl Trait |
1015 | 220..231 '{ loop {} }': T | 1015 | 219..230 '{ loop {} }': T |
1016 | 222..229 'loop {}': ! | 1016 | 221..228 'loop {}': ! |
1017 | 227..229 '{}': () | 1017 | 226..228 '{}': () |
1018 | 301..510 '{ ... i32 }': () | 1018 | 300..509 '{ ... i32 }': () |
1019 | 307..315 'Foo::bar': fn bar<{unknown}, {unknown}>(S) -> {unknown} | 1019 | 306..314 'Foo::bar': fn bar<{unknown}, {unknown}>(S) -> {unknown} |
1020 | 307..318 'Foo::bar(S)': {unknown} | 1020 | 306..317 'Foo::bar(S)': {unknown} |
1021 | 316..317 'S': S | 1021 | 315..316 'S': S |
1022 | 324..339 '<F as Foo>::bar': fn bar<F, {unknown}>(S) -> {unknown} | 1022 | 323..338 '<F as Foo>::bar': fn bar<F, {unknown}>(S) -> {unknown} |
1023 | 324..342 '<F as ...bar(S)': {unknown} | 1023 | 323..341 '<F as ...bar(S)': {unknown} |
1024 | 340..341 'S': S | 1024 | 339..340 'S': S |
1025 | 348..354 'F::bar': fn bar<F, {unknown}>(S) -> {unknown} | 1025 | 347..353 'F::bar': fn bar<F, {unknown}>(S) -> {unknown} |
1026 | 348..357 'F::bar(S)': {unknown} | 1026 | 347..356 'F::bar(S)': {unknown} |
1027 | 355..356 'S': S | 1027 | 354..355 'S': S |
1028 | 363..378 'Foo::bar::<u32>': fn bar<{unknown}, u32>(S) -> u32 | 1028 | 362..377 'Foo::bar::<u32>': fn bar<{unknown}, u32>(S) -> u32 |
1029 | 363..381 'Foo::b...32>(S)': u32 | 1029 | 362..380 'Foo::b...32>(S)': u32 |
1030 | 379..380 'S': S | 1030 | 378..379 'S': S |
1031 | 387..409 '<F as ...:<u32>': fn bar<F, u32>(S) -> u32 | 1031 | 386..408 '<F as ...:<u32>': fn bar<F, u32>(S) -> u32 |
1032 | 387..412 '<F as ...32>(S)': u32 | 1032 | 386..411 '<F as ...32>(S)': u32 |
1033 | 410..411 'S': S | 1033 | 409..410 'S': S |
1034 | 419..422 'foo': fn foo<{unknown}>(S) -> {unknown} | 1034 | 418..421 'foo': fn foo<{unknown}>(S) -> {unknown} |
1035 | 419..425 'foo(S)': {unknown} | 1035 | 418..424 'foo(S)': {unknown} |
1036 | 423..424 'S': S | 1036 | 422..423 'S': S |
1037 | 431..441 'foo::<u32>': fn foo<u32>(S) -> u32 | 1037 | 430..440 'foo::<u32>': fn foo<u32>(S) -> u32 |
1038 | 431..444 'foo::<u32>(S)': u32 | 1038 | 430..443 'foo::<u32>(S)': u32 |
1039 | 442..443 'S': S | 1039 | 441..442 'S': S |
1040 | 450..465 'foo::<u32, i32>': fn foo<u32>(S) -> u32 | 1040 | 449..464 'foo::<u32, i32>': fn foo<u32>(S) -> u32 |
1041 | 450..468 'foo::<...32>(S)': u32 | 1041 | 449..467 'foo::<...32>(S)': u32 |
1042 | 466..467 'S': S | 1042 | 465..466 'S': S |
1043 | "### | 1043 | "### |
1044 | ); | 1044 | ); |
1045 | } | 1045 | } |
@@ -1064,24 +1064,24 @@ fn test() { | |||
1064 | } | 1064 | } |
1065 | "#, true), | 1065 | "#, true), |
1066 | @r###" | 1066 | @r###" |
1067 | 88..92 'self': F<T> | 1067 | 87..91 'self': F<T> |
1068 | 94..95 'x': impl Trait | 1068 | 93..94 'x': impl Trait |
1069 | 119..130 '{ loop {} }': (T, U) | 1069 | 118..129 '{ loop {} }': (T, U) |
1070 | 121..128 'loop {}': ! | 1070 | 120..127 'loop {}': ! |
1071 | 126..128 '{}': () | 1071 | 125..127 '{}': () |
1072 | 144..284 '{ ...ored }': () | 1072 | 143..283 '{ ...ored }': () |
1073 | 150..151 'F': F<{unknown}> | 1073 | 149..150 'F': F<{unknown}> |
1074 | 150..158 'F.foo(S)': ({unknown}, {unknown}) | 1074 | 149..157 'F.foo(S)': ({unknown}, {unknown}) |
1075 | 156..157 'S': S | 1075 | 155..156 'S': S |
1076 | 164..172 'F::<u32>': F<u32> | 1076 | 163..171 'F::<u32>': F<u32> |
1077 | 164..179 'F::<u32>.foo(S)': (u32, {unknown}) | 1077 | 163..178 'F::<u32>.foo(S)': (u32, {unknown}) |
1078 | 177..178 'S': S | 1078 | 176..177 'S': S |
1079 | 185..193 'F::<u32>': F<u32> | 1079 | 184..192 'F::<u32>': F<u32> |
1080 | 185..207 'F::<u3...32>(S)': (u32, i32) | 1080 | 184..206 'F::<u3...32>(S)': (u32, i32) |
1081 | 205..206 'S': S | 1081 | 204..205 'S': S |
1082 | 213..221 'F::<u32>': F<u32> | 1082 | 212..220 'F::<u32>': F<u32> |
1083 | 213..240 'F::<u3...32>(S)': (u32, i32) | 1083 | 212..239 'F::<u3...32>(S)': (u32, i32) |
1084 | 238..239 'S': S | 1084 | 237..238 'S': S |
1085 | "### | 1085 | "### |
1086 | ); | 1086 | ); |
1087 | } | 1087 | } |
@@ -1100,13 +1100,13 @@ fn test() { | |||
1100 | } | 1100 | } |
1101 | "#, true), | 1101 | "#, true), |
1102 | @r###" | 1102 | @r###" |
1103 | 23..24 'x': impl Trait | 1103 | 22..23 'x': impl Trait |
1104 | 38..49 '{ loop {} }': () | 1104 | 37..48 '{ loop {} }': () |
1105 | 40..47 'loop {}': ! | 1105 | 39..46 'loop {}': ! |
1106 | 45..47 '{}': () | 1106 | 44..46 '{}': () |
1107 | 91..124 '{ ...foo; }': () | 1107 | 90..123 '{ ...foo; }': () |
1108 | 101..102 'f': fn(S) | 1108 | 100..101 'f': fn(S) |
1109 | 118..121 'foo': fn foo(S) | 1109 | 117..120 'foo': fn foo(S) |
1110 | "### | 1110 | "### |
1111 | ); | 1111 | ); |
1112 | } | 1112 | } |
@@ -1134,29 +1134,29 @@ fn test(x: impl Trait<u64>, y: &impl Trait<u64>) { | |||
1134 | } | 1134 | } |
1135 | "#), | 1135 | "#), |
1136 | @r###" | 1136 | @r###" |
1137 | 30..34 'self': &Self | 1137 | 29..33 'self': &Self |
1138 | 55..59 'self': &Self | 1138 | 54..58 'self': &Self |
1139 | 99..101 '{}': () | 1139 | 98..100 '{}': () |
1140 | 111..112 'x': impl Trait<u64> | 1140 | 110..111 'x': impl Trait<u64> |
1141 | 131..132 'y': &impl Trait<u64> | 1141 | 130..131 'y': &impl Trait<u64> |
1142 | 152..269 '{ ...2(); }': () | 1142 | 151..268 '{ ...2(); }': () |
1143 | 158..159 'x': impl Trait<u64> | 1143 | 157..158 'x': impl Trait<u64> |
1144 | 165..166 'y': &impl Trait<u64> | 1144 | 164..165 'y': &impl Trait<u64> |
1145 | 176..177 'z': impl Trait<u64> | 1145 | 175..176 'z': impl Trait<u64> |
1146 | 180..183 'bar': fn bar() -> impl Trait<u64> | 1146 | 179..182 'bar': fn bar() -> impl Trait<u64> |
1147 | 180..185 'bar()': impl Trait<u64> | 1147 | 179..184 'bar()': impl Trait<u64> |
1148 | 191..192 'x': impl Trait<u64> | 1148 | 190..191 'x': impl Trait<u64> |
1149 | 191..198 'x.foo()': u64 | 1149 | 190..197 'x.foo()': u64 |
1150 | 204..205 'y': &impl Trait<u64> | 1150 | 203..204 'y': &impl Trait<u64> |
1151 | 204..211 'y.foo()': u64 | 1151 | 203..210 'y.foo()': u64 |
1152 | 217..218 'z': impl Trait<u64> | 1152 | 216..217 'z': impl Trait<u64> |
1153 | 217..224 'z.foo()': u64 | 1153 | 216..223 'z.foo()': u64 |
1154 | 230..231 'x': impl Trait<u64> | 1154 | 229..230 'x': impl Trait<u64> |
1155 | 230..238 'x.foo2()': i64 | 1155 | 229..237 'x.foo2()': i64 |
1156 | 244..245 'y': &impl Trait<u64> | 1156 | 243..244 'y': &impl Trait<u64> |
1157 | 244..252 'y.foo2()': i64 | 1157 | 243..251 'y.foo2()': i64 |
1158 | 258..259 'z': impl Trait<u64> | 1158 | 257..258 'z': impl Trait<u64> |
1159 | 258..266 'z.foo2()': i64 | 1159 | 257..265 'z.foo2()': i64 |
1160 | "### | 1160 | "### |
1161 | ); | 1161 | ); |
1162 | } | 1162 | } |
@@ -1177,16 +1177,16 @@ fn test() { | |||
1177 | } | 1177 | } |
1178 | "#), | 1178 | "#), |
1179 | @r###" | 1179 | @r###" |
1180 | 30..34 'self': &Self | 1180 | 29..33 'self': &Self |
1181 | 72..83 '{ loop {} }': ! | 1181 | 71..82 '{ loop {} }': ! |
1182 | 74..81 'loop {}': ! | 1182 | 73..80 'loop {}': ! |
1183 | 79..81 '{}': () | 1183 | 78..80 '{}': () |
1184 | 95..130 '{ ...o(); }': () | 1184 | 94..129 '{ ...o(); }': () |
1185 | 105..106 'a': impl Trait<u64> | 1185 | 104..105 'a': impl Trait<u64> |
1186 | 109..112 'bar': fn bar() -> impl Trait<u64> | 1186 | 108..111 'bar': fn bar() -> impl Trait<u64> |
1187 | 109..114 'bar()': impl Trait<u64> | 1187 | 108..113 'bar()': impl Trait<u64> |
1188 | 120..121 'a': impl Trait<u64> | 1188 | 119..120 'a': impl Trait<u64> |
1189 | 120..127 'a.foo()': u64 | 1189 | 119..126 'a.foo()': u64 |
1190 | "### | 1190 | "### |
1191 | ); | 1191 | ); |
1192 | } | 1192 | } |
@@ -1215,37 +1215,37 @@ fn test() { | |||
1215 | } | 1215 | } |
1216 | "#), | 1216 | "#), |
1217 | @r###" | 1217 | @r###" |
1218 | 50..54 'self': &mut Self | 1218 | 49..53 'self': &mut Self |
1219 | 102..106 'self': &Self | 1219 | 101..105 'self': &Self |
1220 | 185..196 '{ loop {} }': ({unknown}, {unknown}) | 1220 | 184..195 '{ loop {} }': ({unknown}, {unknown}) |
1221 | 187..194 'loop {}': ! | 1221 | 186..193 'loop {}': ! |
1222 | 192..194 '{}': () | 1222 | 191..193 '{}': () |
1223 | 207..208 't': T | 1223 | 206..207 't': T |
1224 | 269..280 '{ loop {} }': ({unknown}, {unknown}) | 1224 | 268..279 '{ loop {} }': ({unknown}, {unknown}) |
1225 | 271..278 'loop {}': ! | 1225 | 270..277 'loop {}': ! |
1226 | 276..278 '{}': () | 1226 | 275..277 '{}': () |
1227 | 292..414 '{ ...o(); }': () | 1227 | 291..413 '{ ...o(); }': () |
1228 | 302..308 '(a, b)': (impl Iterator<Item = impl Trait<u32>>, impl Trait<u64>) | 1228 | 301..307 '(a, b)': (impl Iterator<Item = impl Trait<u32>>, impl Trait<u64>) |
1229 | 303..304 'a': impl Iterator<Item = impl Trait<u32>> | 1229 | 302..303 'a': impl Iterator<Item = impl Trait<u32>> |
1230 | 306..307 'b': impl Trait<u64> | 1230 | 305..306 'b': impl Trait<u64> |
1231 | 311..314 'bar': fn bar() -> (impl Iterator<Item = impl Trait<u32>>, impl Trait<u64>) | 1231 | 310..313 'bar': fn bar() -> (impl Iterator<Item = impl Trait<u32>>, impl Trait<u64>) |
1232 | 311..316 'bar()': (impl Iterator<Item = impl Trait<u32>>, impl Trait<u64>) | 1232 | 310..315 'bar()': (impl Iterator<Item = impl Trait<u32>>, impl Trait<u64>) |
1233 | 322..323 'a': impl Iterator<Item = impl Trait<u32>> | 1233 | 321..322 'a': impl Iterator<Item = impl Trait<u32>> |
1234 | 322..330 'a.next()': impl Trait<u32> | 1234 | 321..329 'a.next()': impl Trait<u32> |
1235 | 322..336 'a.next().foo()': u32 | 1235 | 321..335 'a.next().foo()': u32 |
1236 | 342..343 'b': impl Trait<u64> | 1236 | 341..342 'b': impl Trait<u64> |
1237 | 342..349 'b.foo()': u64 | 1237 | 341..348 'b.foo()': u64 |
1238 | 359..365 '(c, d)': (impl Iterator<Item = impl Trait<u128>>, impl Trait<u128>) | 1238 | 358..364 '(c, d)': (impl Iterator<Item = impl Trait<u128>>, impl Trait<u128>) |
1239 | 360..361 'c': impl Iterator<Item = impl Trait<u128>> | 1239 | 359..360 'c': impl Iterator<Item = impl Trait<u128>> |
1240 | 363..364 'd': impl Trait<u128> | 1240 | 362..363 'd': impl Trait<u128> |
1241 | 368..371 'baz': fn baz<u128>(u128) -> (impl Iterator<Item = impl Trait<u128>>, impl Trait<u128>) | 1241 | 367..370 'baz': fn baz<u128>(u128) -> (impl Iterator<Item = impl Trait<u128>>, impl Trait<u128>) |
1242 | 368..378 'baz(1u128)': (impl Iterator<Item = impl Trait<u128>>, impl Trait<u128>) | 1242 | 367..377 'baz(1u128)': (impl Iterator<Item = impl Trait<u128>>, impl Trait<u128>) |
1243 | 372..377 '1u128': u128 | 1243 | 371..376 '1u128': u128 |
1244 | 384..385 'c': impl Iterator<Item = impl Trait<u128>> | 1244 | 383..384 'c': impl Iterator<Item = impl Trait<u128>> |
1245 | 384..392 'c.next()': impl Trait<u128> | 1245 | 383..391 'c.next()': impl Trait<u128> |
1246 | 384..398 'c.next().foo()': u128 | 1246 | 383..397 'c.next().foo()': u128 |
1247 | 404..405 'd': impl Trait<u128> | 1247 | 403..404 'd': impl Trait<u128> |
1248 | 404..411 'd.foo()': u128 | 1248 | 403..410 'd.foo()': u128 |
1249 | "### | 1249 | "### |
1250 | ); | 1250 | ); |
1251 | } | 1251 | } |
@@ -1273,29 +1273,29 @@ fn test(x: dyn Trait<u64>, y: &dyn Trait<u64>) { | |||
1273 | } | 1273 | } |
1274 | "#), | 1274 | "#), |
1275 | @r###" | 1275 | @r###" |
1276 | 30..34 'self': &Self | 1276 | 29..33 'self': &Self |
1277 | 55..59 'self': &Self | 1277 | 54..58 'self': &Self |
1278 | 98..100 '{}': () | 1278 | 97..99 '{}': () |
1279 | 110..111 'x': dyn Trait<u64> | 1279 | 109..110 'x': dyn Trait<u64> |
1280 | 129..130 'y': &dyn Trait<u64> | 1280 | 128..129 'y': &dyn Trait<u64> |
1281 | 149..266 '{ ...2(); }': () | 1281 | 148..265 '{ ...2(); }': () |
1282 | 155..156 'x': dyn Trait<u64> | 1282 | 154..155 'x': dyn Trait<u64> |
1283 | 162..163 'y': &dyn Trait<u64> | 1283 | 161..162 'y': &dyn Trait<u64> |
1284 | 173..174 'z': dyn Trait<u64> | 1284 | 172..173 'z': dyn Trait<u64> |
1285 | 177..180 'bar': fn bar() -> dyn Trait<u64> | 1285 | 176..179 'bar': fn bar() -> dyn Trait<u64> |
1286 | 177..182 'bar()': dyn Trait<u64> | 1286 | 176..181 'bar()': dyn Trait<u64> |
1287 | 188..189 'x': dyn Trait<u64> | 1287 | 187..188 'x': dyn Trait<u64> |
1288 | 188..195 'x.foo()': u64 | 1288 | 187..194 'x.foo()': u64 |
1289 | 201..202 'y': &dyn Trait<u64> | 1289 | 200..201 'y': &dyn Trait<u64> |
1290 | 201..208 'y.foo()': u64 | 1290 | 200..207 'y.foo()': u64 |
1291 | 214..215 'z': dyn Trait<u64> | 1291 | 213..214 'z': dyn Trait<u64> |
1292 | 214..221 'z.foo()': u64 | 1292 | 213..220 'z.foo()': u64 |
1293 | 227..228 'x': dyn Trait<u64> | 1293 | 226..227 'x': dyn Trait<u64> |
1294 | 227..235 'x.foo2()': i64 | 1294 | 226..234 'x.foo2()': i64 |
1295 | 241..242 'y': &dyn Trait<u64> | 1295 | 240..241 'y': &dyn Trait<u64> |
1296 | 241..249 'y.foo2()': i64 | 1296 | 240..248 'y.foo2()': i64 |
1297 | 255..256 'z': dyn Trait<u64> | 1297 | 254..255 'z': dyn Trait<u64> |
1298 | 255..263 'z.foo2()': i64 | 1298 | 254..262 'z.foo2()': i64 |
1299 | "### | 1299 | "### |
1300 | ); | 1300 | ); |
1301 | } | 1301 | } |
@@ -1321,17 +1321,17 @@ fn test(s: S<u32, i32>) { | |||
1321 | } | 1321 | } |
1322 | "#), | 1322 | "#), |
1323 | @r###" | 1323 | @r###" |
1324 | 33..37 'self': &Self | 1324 | 32..36 'self': &Self |
1325 | 103..107 'self': &S<T, U> | 1325 | 102..106 'self': &S<T, U> |
1326 | 129..140 '{ loop {} }': &dyn Trait<T, U> | 1326 | 128..139 '{ loop {} }': &dyn Trait<T, U> |
1327 | 131..138 'loop {}': ! | 1327 | 130..137 'loop {}': ! |
1328 | 136..138 '{}': () | 1328 | 135..137 '{}': () |
1329 | 176..180 'self': &Self | 1329 | 175..179 'self': &Self |
1330 | 252..253 's': S<u32, i32> | 1330 | 251..252 's': S<u32, i32> |
1331 | 268..290 '{ ...z(); }': () | 1331 | 267..289 '{ ...z(); }': () |
1332 | 274..275 's': S<u32, i32> | 1332 | 273..274 's': S<u32, i32> |
1333 | 274..281 's.bar()': &dyn Trait<u32, i32> | 1333 | 273..280 's.bar()': &dyn Trait<u32, i32> |
1334 | 274..287 's.bar().baz()': (u32, i32) | 1334 | 273..286 's.bar().baz()': (u32, i32) |
1335 | "### | 1335 | "### |
1336 | ); | 1336 | ); |
1337 | } | 1337 | } |
@@ -1355,22 +1355,22 @@ fn test(x: Trait, y: &Trait) -> u64 { | |||
1355 | } | 1355 | } |
1356 | "#), | 1356 | "#), |
1357 | @r###" | 1357 | @r###" |
1358 | 27..31 'self': &Self | 1358 | 26..30 'self': &Self |
1359 | 61..63 '{}': () | 1359 | 60..62 '{}': () |
1360 | 73..74 'x': dyn Trait | 1360 | 72..73 'x': dyn Trait |
1361 | 83..84 'y': &dyn Trait | 1361 | 82..83 'y': &dyn Trait |
1362 | 101..176 '{ ...o(); }': () | 1362 | 100..175 '{ ...o(); }': () |
1363 | 107..108 'x': dyn Trait | 1363 | 106..107 'x': dyn Trait |
1364 | 114..115 'y': &dyn Trait | 1364 | 113..114 'y': &dyn Trait |
1365 | 125..126 'z': dyn Trait | 1365 | 124..125 'z': dyn Trait |
1366 | 129..132 'bar': fn bar() -> dyn Trait | 1366 | 128..131 'bar': fn bar() -> dyn Trait |
1367 | 129..134 'bar()': dyn Trait | 1367 | 128..133 'bar()': dyn Trait |
1368 | 140..141 'x': dyn Trait | 1368 | 139..140 'x': dyn Trait |
1369 | 140..147 'x.foo()': u64 | 1369 | 139..146 'x.foo()': u64 |
1370 | 153..154 'y': &dyn Trait | 1370 | 152..153 'y': &dyn Trait |
1371 | 153..160 'y.foo()': u64 | 1371 | 152..159 'y.foo()': u64 |
1372 | 166..167 'z': dyn Trait | 1372 | 165..166 'z': dyn Trait |
1373 | 166..173 'z.foo()': u64 | 1373 | 165..172 'z.foo()': u64 |
1374 | "### | 1374 | "### |
1375 | ); | 1375 | ); |
1376 | } | 1376 | } |
@@ -1384,13 +1384,13 @@ fn test(a: impl Trait + 'lifetime, b: impl 'lifetime, c: impl (Trait), d: impl ( | |||
1384 | } | 1384 | } |
1385 | "#), | 1385 | "#), |
1386 | @r###" | 1386 | @r###" |
1387 | 24..25 'a': impl Trait + {error} | 1387 | 23..24 'a': impl Trait + {error} |
1388 | 51..52 'b': impl {error} | 1388 | 50..51 'b': impl {error} |
1389 | 70..71 'c': impl Trait | 1389 | 69..70 'c': impl Trait |
1390 | 87..88 'd': impl {error} | 1390 | 86..87 'd': impl {error} |
1391 | 108..109 'e': impl {error} | 1391 | 107..108 'e': impl {error} |
1392 | 124..125 'f': impl Trait + {error} | 1392 | 123..124 'f': impl Trait + {error} |
1393 | 148..151 '{ }': () | 1393 | 147..150 '{ }': () |
1394 | "### | 1394 | "### |
1395 | ); | 1395 | ); |
1396 | } | 1396 | } |
@@ -1439,41 +1439,41 @@ fn test<T: Trait<Type = u32>>(x: T, y: impl Trait<Type = i64>) { | |||
1439 | } | 1439 | } |
1440 | "#), | 1440 | "#), |
1441 | @r###" | 1441 | @r###" |
1442 | 50..51 't': T | 1442 | 49..50 't': T |
1443 | 78..80 '{}': () | 1443 | 77..79 '{}': () |
1444 | 112..113 't': T | 1444 | 111..112 't': T |
1445 | 123..125 '{}': () | 1445 | 122..124 '{}': () |
1446 | 155..156 't': T | 1446 | 154..155 't': T |
1447 | 166..169 '{t}': T | 1447 | 165..168 '{t}': T |
1448 | 167..168 't': T | 1448 | 166..167 't': T |
1449 | 257..258 'x': T | 1449 | 256..257 'x': T |
1450 | 263..264 'y': impl Trait<Type = i64> | 1450 | 262..263 'y': impl Trait<Type = i64> |
1451 | 290..398 '{ ...r>); }': () | 1451 | 289..397 '{ ...r>); }': () |
1452 | 296..299 'get': fn get<T>(T) -> <T as Trait>::Type | 1452 | 295..298 'get': fn get<T>(T) -> <T as Trait>::Type |
1453 | 296..302 'get(x)': u32 | 1453 | 295..301 'get(x)': u32 |
1454 | 300..301 'x': T | 1454 | 299..300 'x': T |
1455 | 308..312 'get2': fn get2<u32, T>(T) -> u32 | 1455 | 307..311 'get2': fn get2<u32, T>(T) -> u32 |
1456 | 308..315 'get2(x)': u32 | 1456 | 307..314 'get2(x)': u32 |
1457 | 313..314 'x': T | 1457 | 312..313 'x': T |
1458 | 321..324 'get': fn get<impl Trait<Type = i64>>(impl Trait<Type = i64>) -> <impl Trait<Type = i64> as Trait>::Type | 1458 | 320..323 'get': fn get<impl Trait<Type = i64>>(impl Trait<Type = i64>) -> <impl Trait<Type = i64> as Trait>::Type |
1459 | 321..327 'get(y)': i64 | 1459 | 320..326 'get(y)': i64 |
1460 | 325..326 'y': impl Trait<Type = i64> | 1460 | 324..325 'y': impl Trait<Type = i64> |
1461 | 333..337 'get2': fn get2<i64, impl Trait<Type = i64>>(impl Trait<Type = i64>) -> i64 | 1461 | 332..336 'get2': fn get2<i64, impl Trait<Type = i64>>(impl Trait<Type = i64>) -> i64 |
1462 | 333..340 'get2(y)': i64 | 1462 | 332..339 'get2(y)': i64 |
1463 | 338..339 'y': impl Trait<Type = i64> | 1463 | 337..338 'y': impl Trait<Type = i64> |
1464 | 346..349 'get': fn get<S<u64>>(S<u64>) -> <S<u64> as Trait>::Type | 1464 | 345..348 'get': fn get<S<u64>>(S<u64>) -> <S<u64> as Trait>::Type |
1465 | 346..357 'get(set(S))': u64 | 1465 | 345..356 'get(set(S))': u64 |
1466 | 350..353 'set': fn set<S<u64>>(S<u64>) -> S<u64> | 1466 | 349..352 'set': fn set<S<u64>>(S<u64>) -> S<u64> |
1467 | 350..356 'set(S)': S<u64> | 1467 | 349..355 'set(S)': S<u64> |
1468 | 354..355 'S': S<u64> | 1468 | 353..354 'S': S<u64> |
1469 | 363..367 'get2': fn get2<u64, S<u64>>(S<u64>) -> u64 | 1469 | 362..366 'get2': fn get2<u64, S<u64>>(S<u64>) -> u64 |
1470 | 363..375 'get2(set(S))': u64 | 1470 | 362..374 'get2(set(S))': u64 |
1471 | 368..371 'set': fn set<S<u64>>(S<u64>) -> S<u64> | 1471 | 367..370 'set': fn set<S<u64>>(S<u64>) -> S<u64> |
1472 | 368..374 'set(S)': S<u64> | 1472 | 367..373 'set(S)': S<u64> |
1473 | 372..373 'S': S<u64> | 1473 | 371..372 'S': S<u64> |
1474 | 381..385 'get2': fn get2<str, S<str>>(S<str>) -> str | 1474 | 380..384 'get2': fn get2<str, S<str>>(S<str>) -> str |
1475 | 381..395 'get2(S::<str>)': str | 1475 | 380..394 'get2(S::<str>)': str |
1476 | 386..394 'S::<str>': S<str> | 1476 | 385..393 'S::<str>': S<str> |
1477 | "### | 1477 | "### |
1478 | ); | 1478 | ); |
1479 | } | 1479 | } |
@@ -1538,11 +1538,11 @@ fn test<T: Trait1<Type = u32>>(x: T) { | |||
1538 | } | 1538 | } |
1539 | "#), | 1539 | "#), |
1540 | @r###" | 1540 | @r###" |
1541 | 62..66 'self': Self | 1541 | 61..65 'self': Self |
1542 | 164..165 'x': T | 1542 | 163..164 'x': T |
1543 | 170..186 '{ ...o(); }': () | 1543 | 169..185 '{ ...o(); }': () |
1544 | 176..177 'x': T | 1544 | 175..176 'x': T |
1545 | 176..183 'x.foo()': u32 | 1545 | 175..182 'x.foo()': u32 |
1546 | "### | 1546 | "### |
1547 | ); | 1547 | ); |
1548 | } | 1548 | } |
@@ -1584,15 +1584,15 @@ fn test<T: Trait1, U: Trait2>(x: T, y: U) { | |||
1584 | } | 1584 | } |
1585 | "#), | 1585 | "#), |
1586 | @r###" | 1586 | @r###" |
1587 | 50..54 'self': &Self | 1587 | 49..53 'self': &Self |
1588 | 63..65 '{}': () | 1588 | 62..64 '{}': () |
1589 | 182..183 'x': T | 1589 | 181..182 'x': T |
1590 | 188..189 'y': U | 1590 | 187..188 'y': U |
1591 | 194..223 '{ ...o(); }': () | 1591 | 193..222 '{ ...o(); }': () |
1592 | 200..201 'x': T | 1592 | 199..200 'x': T |
1593 | 200..207 'x.foo()': u32 | 1593 | 199..206 'x.foo()': u32 |
1594 | 213..214 'y': U | 1594 | 212..213 'y': U |
1595 | 213..220 'y.foo()': u32 | 1595 | 212..219 'y.foo()': u32 |
1596 | "### | 1596 | "### |
1597 | ); | 1597 | ); |
1598 | } | 1598 | } |
@@ -1613,12 +1613,12 @@ fn test(x: &impl Trait1) { | |||
1613 | } | 1613 | } |
1614 | "#), | 1614 | "#), |
1615 | @r###" | 1615 | @r###" |
1616 | 50..54 'self': &Self | 1616 | 49..53 'self': &Self |
1617 | 63..65 '{}': () | 1617 | 62..64 '{}': () |
1618 | 116..117 'x': &impl Trait1 | 1618 | 115..116 'x': &impl Trait1 |
1619 | 133..149 '{ ...o(); }': () | 1619 | 132..148 '{ ...o(); }': () |
1620 | 139..140 'x': &impl Trait1 | 1620 | 138..139 'x': &impl Trait1 |
1621 | 139..146 'x.foo()': u32 | 1621 | 138..145 'x.foo()': u32 |
1622 | "### | 1622 | "### |
1623 | ); | 1623 | ); |
1624 | } | 1624 | } |
@@ -1636,10 +1636,10 @@ fn test<T: A>(x: T) { | |||
1636 | } | 1636 | } |
1637 | "#), | 1637 | "#), |
1638 | @r###" | 1638 | @r###" |
1639 | 44..45 'x': T | 1639 | 43..44 'x': T |
1640 | 50..66 '{ ...o(); }': () | 1640 | 49..65 '{ ...o(); }': () |
1641 | 56..57 'x': T | 1641 | 55..56 'x': T |
1642 | 56..63 'x.foo()': {unknown} | 1642 | 55..62 'x.foo()': {unknown} |
1643 | "### | 1643 | "### |
1644 | ); | 1644 | ); |
1645 | } | 1645 | } |
@@ -1663,17 +1663,17 @@ fn test() { | |||
1663 | } | 1663 | } |
1664 | "#), | 1664 | "#), |
1665 | @r###" | 1665 | @r###" |
1666 | 103..104 't': T | 1666 | 102..103 't': T |
1667 | 114..116 '{}': () | 1667 | 113..115 '{}': () |
1668 | 146..147 't': T | 1668 | 145..146 't': T |
1669 | 157..160 '{t}': T | 1669 | 156..159 '{t}': T |
1670 | 158..159 't': T | 1670 | 157..158 't': T |
1671 | 259..280 '{ ...S)); }': () | 1671 | 258..279 '{ ...S)); }': () |
1672 | 265..269 'get2': fn get2<u64, S<u64>>(S<u64>) -> u64 | 1672 | 264..268 'get2': fn get2<u64, S<u64>>(S<u64>) -> u64 |
1673 | 265..277 'get2(set(S))': u64 | 1673 | 264..276 'get2(set(S))': u64 |
1674 | 270..273 'set': fn set<S<u64>>(S<u64>) -> S<u64> | 1674 | 269..272 'set': fn set<S<u64>>(S<u64>) -> S<u64> |
1675 | 270..276 'set(S)': S<u64> | 1675 | 269..275 'set(S)': S<u64> |
1676 | 274..275 'S': S<u64> | 1676 | 273..274 'S': S<u64> |
1677 | "### | 1677 | "### |
1678 | ); | 1678 | ); |
1679 | } | 1679 | } |
@@ -1693,15 +1693,15 @@ fn test<F: FnOnce(u32, u64) -> u128>(f: F) { | |||
1693 | } | 1693 | } |
1694 | "#), | 1694 | "#), |
1695 | @r###" | 1695 | @r###" |
1696 | 57..61 'self': Self | 1696 | 56..60 'self': Self |
1697 | 63..67 'args': Args | 1697 | 62..66 'args': Args |
1698 | 150..151 'f': F | 1698 | 149..150 'f': F |
1699 | 156..184 '{ ...2)); }': () | 1699 | 155..183 '{ ...2)); }': () |
1700 | 162..163 'f': F | 1700 | 161..162 'f': F |
1701 | 162..181 'f.call...1, 2))': u128 | 1701 | 161..180 'f.call...1, 2))': u128 |
1702 | 174..180 '(1, 2)': (u32, u64) | 1702 | 173..179 '(1, 2)': (u32, u64) |
1703 | 175..176 '1': u32 | 1703 | 174..175 '1': u32 |
1704 | 178..179 '2': u64 | 1704 | 177..178 '2': u64 |
1705 | "### | 1705 | "### |
1706 | ); | 1706 | ); |
1707 | } | 1707 | } |
@@ -1742,24 +1742,24 @@ fn test() { | |||
1742 | } | 1742 | } |
1743 | "#), | 1743 | "#), |
1744 | @r###" | 1744 | @r###" |
1745 | 75..79 'self': Self | 1745 | 74..78 'self': Self |
1746 | 81..85 'args': Args | 1746 | 80..84 'args': Args |
1747 | 140..144 'self': &Self | 1747 | 139..143 'self': &Self |
1748 | 244..248 'self': &Bar<F> | 1748 | 243..247 'self': &Bar<F> |
1749 | 261..263 '{}': () | 1749 | 260..262 '{}': () |
1750 | 347..351 'self': Opt<T> | 1750 | 346..350 'self': Opt<T> |
1751 | 353..354 'f': F | 1751 | 352..353 'f': F |
1752 | 369..371 '{}': () | 1752 | 368..370 '{}': () |
1753 | 385..501 '{ ...(f); }': () | 1753 | 384..500 '{ ...(f); }': () |
1754 | 395..398 'bar': Bar<fn(u8) -> u32> | 1754 | 394..397 'bar': Bar<fn(u8) -> u32> |
1755 | 424..427 'bar': Bar<fn(u8) -> u32> | 1755 | 423..426 'bar': Bar<fn(u8) -> u32> |
1756 | 424..433 'bar.foo()': {unknown} | 1756 | 423..432 'bar.foo()': {unknown} |
1757 | 444..447 'opt': Opt<u8> | 1757 | 443..446 'opt': Opt<u8> |
1758 | 466..467 'f': fn(u8) -> u32 | 1758 | 465..466 'f': fn(u8) -> u32 |
1759 | 488..491 'opt': Opt<u8> | 1759 | 487..490 'opt': Opt<u8> |
1760 | 488..498 'opt.map(f)': Opt<FnOnce::Output<fn(u8) -> u32, (u8,)>> | 1760 | 487..497 'opt.map(f)': Opt<FnOnce::Output<fn(u8) -> u32, (u8,)>> |
1761 | 496..497 'f': fn(u8) -> u32 | 1761 | 495..496 'f': fn(u8) -> u32 |
1762 | "### | 1762 | "### |
1763 | ); | 1763 | ); |
1764 | } | 1764 | } |
1765 | 1765 | ||
@@ -1808,32 +1808,32 @@ fn test() { | |||
1808 | } | 1808 | } |
1809 | "#), | 1809 | "#), |
1810 | @r###" | 1810 | @r###" |
1811 | 65..69 'self': &Self | 1811 | 64..68 'self': &Self |
1812 | 166..170 'self': Self | 1812 | 165..169 'self': Self |
1813 | 172..176 'args': Args | 1813 | 171..175 'args': Args |
1814 | 240..244 'self': &Foo | 1814 | 239..243 'self': &Foo |
1815 | 255..257 '{}': () | 1815 | 254..256 '{}': () |
1816 | 335..336 'f': F | 1816 | 334..335 'f': F |
1817 | 355..357 '{}': () | 1817 | 354..356 '{}': () |
1818 | 444..690 '{ ...o(); }': () | 1818 | 443..689 '{ ...o(); }': () |
1819 | 454..459 'lazy1': Lazy<Foo, || -> Foo> | 1819 | 453..458 'lazy1': Lazy<Foo, || -> Foo> |
1820 | 476..485 'Lazy::new': fn new<Foo, || -> Foo>(|| -> Foo) -> Lazy<Foo, || -> Foo> | 1820 | 475..484 'Lazy::new': fn new<Foo, || -> Foo>(|| -> Foo) -> Lazy<Foo, || -> Foo> |
1821 | 476..493 'Lazy::...| Foo)': Lazy<Foo, || -> Foo> | 1821 | 475..492 'Lazy::...| Foo)': Lazy<Foo, || -> Foo> |
1822 | 486..492 '|| Foo': || -> Foo | 1822 | 485..491 '|| Foo': || -> Foo |
1823 | 489..492 'Foo': Foo | 1823 | 488..491 'Foo': Foo |
1824 | 503..505 'r1': usize | 1824 | 502..504 'r1': usize |
1825 | 508..513 'lazy1': Lazy<Foo, || -> Foo> | 1825 | 507..512 'lazy1': Lazy<Foo, || -> Foo> |
1826 | 508..519 'lazy1.foo()': usize | 1826 | 507..518 'lazy1.foo()': usize |
1827 | 561..576 'make_foo_fn_ptr': fn() -> Foo | 1827 | 560..575 'make_foo_fn_ptr': fn() -> Foo |
1828 | 592..603 'make_foo_fn': fn make_foo_fn() -> Foo | 1828 | 591..602 'make_foo_fn': fn make_foo_fn() -> Foo |
1829 | 613..618 'lazy2': Lazy<Foo, fn() -> Foo> | 1829 | 612..617 'lazy2': Lazy<Foo, fn() -> Foo> |
1830 | 635..644 'Lazy::new': fn new<Foo, fn() -> Foo>(fn() -> Foo) -> Lazy<Foo, fn() -> Foo> | 1830 | 634..643 'Lazy::new': fn new<Foo, fn() -> Foo>(fn() -> Foo) -> Lazy<Foo, fn() -> Foo> |
1831 | 635..661 'Lazy::...n_ptr)': Lazy<Foo, fn() -> Foo> | 1831 | 634..660 'Lazy::...n_ptr)': Lazy<Foo, fn() -> Foo> |
1832 | 645..660 'make_foo_fn_ptr': fn() -> Foo | 1832 | 644..659 'make_foo_fn_ptr': fn() -> Foo |
1833 | 671..673 'r2': {unknown} | 1833 | 670..672 'r2': {unknown} |
1834 | 676..681 'lazy2': Lazy<Foo, fn() -> Foo> | 1834 | 675..680 'lazy2': Lazy<Foo, fn() -> Foo> |
1835 | 676..687 'lazy2.foo()': {unknown} | 1835 | 675..686 'lazy2.foo()': {unknown} |
1836 | 550..552 '{}': () | 1836 | 549..551 '{}': () |
1837 | "### | 1837 | "### |
1838 | ); | 1838 | ); |
1839 | } | 1839 | } |
@@ -1860,32 +1860,32 @@ fn test() { | |||
1860 | } | 1860 | } |
1861 | "#), | 1861 | "#), |
1862 | @r###" | 1862 | @r###" |
1863 | 148..152 'self': Option<T> | 1863 | 147..151 'self': Option<T> |
1864 | 154..155 'f': F | 1864 | 153..154 'f': F |
1865 | 173..175 '{}': () | 1865 | 172..174 '{}': () |
1866 | 189..308 '{ ... 1); }': () | 1866 | 188..307 '{ ... 1); }': () |
1867 | 199..200 'x': Option<u32> | 1867 | 198..199 'x': Option<u32> |
1868 | 203..215 'Option::Some': Some<u32>(u32) -> Option<u32> | 1868 | 202..214 'Option::Some': Some<u32>(u32) -> Option<u32> |
1869 | 203..221 'Option...(1u32)': Option<u32> | 1869 | 202..220 'Option...(1u32)': Option<u32> |
1870 | 216..220 '1u32': u32 | 1870 | 215..219 '1u32': u32 |
1871 | 227..228 'x': Option<u32> | 1871 | 226..227 'x': Option<u32> |
1872 | 227..243 'x.map(...v + 1)': Option<u32> | 1872 | 226..242 'x.map(...v + 1)': Option<u32> |
1873 | 233..242 '|v| v + 1': |u32| -> u32 | 1873 | 232..241 '|v| v + 1': |u32| -> u32 |
1874 | 234..235 'v': u32 | 1874 | 233..234 'v': u32 |
1875 | 237..238 'v': u32 | 1875 | 236..237 'v': u32 |
1876 | 237..242 'v + 1': u32 | 1876 | 236..241 'v + 1': u32 |
1877 | 241..242 '1': u32 | 1877 | 240..241 '1': u32 |
1878 | 249..250 'x': Option<u32> | 1878 | 248..249 'x': Option<u32> |
1879 | 249..265 'x.map(... 1u64)': Option<u64> | 1879 | 248..264 'x.map(... 1u64)': Option<u64> |
1880 | 255..264 '|_v| 1u64': |u32| -> u64 | 1880 | 254..263 '|_v| 1u64': |u32| -> u64 |
1881 | 256..258 '_v': u32 | 1881 | 255..257 '_v': u32 |
1882 | 260..264 '1u64': u64 | 1882 | 259..263 '1u64': u64 |
1883 | 275..276 'y': Option<i64> | 1883 | 274..275 'y': Option<i64> |
1884 | 292..293 'x': Option<u32> | 1884 | 291..292 'x': Option<u32> |
1885 | 292..305 'x.map(|_v| 1)': Option<i64> | 1885 | 291..304 'x.map(|_v| 1)': Option<i64> |
1886 | 298..304 '|_v| 1': |u32| -> i64 | 1886 | 297..303 '|_v| 1': |u32| -> i64 |
1887 | 299..301 '_v': u32 | 1887 | 298..300 '_v': u32 |
1888 | 303..304 '1': i64 | 1888 | 302..303 '1': i64 |
1889 | "### | 1889 | "### |
1890 | ); | 1890 | ); |
1891 | } | 1891 | } |
@@ -1906,26 +1906,26 @@ fn test<F: FnOnce(u32) -> u64>(f: F) { | |||
1906 | } | 1906 | } |
1907 | "#), | 1907 | "#), |
1908 | @r###" | 1908 | @r###" |
1909 | 73..74 'f': F | 1909 | 72..73 'f': F |
1910 | 79..155 '{ ...+ v; }': () | 1910 | 78..154 '{ ...+ v; }': () |
1911 | 85..86 'f': F | 1911 | 84..85 'f': F |
1912 | 85..89 'f(1)': {unknown} | 1912 | 84..88 'f(1)': {unknown} |
1913 | 87..88 '1': i32 | 1913 | 86..87 '1': i32 |
1914 | 99..100 'g': |u64| -> i32 | 1914 | 98..99 'g': |u64| -> i32 |
1915 | 103..112 '|v| v + 1': |u64| -> i32 | 1915 | 102..111 '|v| v + 1': |u64| -> i32 |
1916 | 104..105 'v': u64 | 1916 | 103..104 'v': u64 |
1917 | 107..108 'v': u64 | 1917 | 106..107 'v': u64 |
1918 | 107..112 'v + 1': i32 | 1918 | 106..111 'v + 1': i32 |
1919 | 111..112 '1': i32 | 1919 | 110..111 '1': i32 |
1920 | 118..119 'g': |u64| -> i32 | 1920 | 117..118 'g': |u64| -> i32 |
1921 | 118..125 'g(1u64)': i32 | 1921 | 117..124 'g(1u64)': i32 |
1922 | 120..124 '1u64': u64 | 1922 | 119..123 '1u64': u64 |
1923 | 135..136 'h': |u128| -> u128 | 1923 | 134..135 'h': |u128| -> u128 |
1924 | 139..152 '|v| 1u128 + v': |u128| -> u128 | 1924 | 138..151 '|v| 1u128 + v': |u128| -> u128 |
1925 | 140..141 'v': u128 | 1925 | 139..140 'v': u128 |
1926 | 143..148 '1u128': u128 | 1926 | 142..147 '1u128': u128 |
1927 | 143..152 '1u128 + v': u128 | 1927 | 142..151 '1u128 + v': u128 |
1928 | 151..152 'v': u128 | 1928 | 150..151 'v': u128 |
1929 | "### | 1929 | "### |
1930 | ); | 1930 | ); |
1931 | } | 1931 | } |
@@ -1958,54 +1958,54 @@ fn test() { | |||
1958 | } | 1958 | } |
1959 | "#), | 1959 | "#), |
1960 | @r###" | 1960 | @r###" |
1961 | 95..96 'x': T | 1961 | 94..95 'x': T |
1962 | 101..102 'f': F | 1962 | 100..101 'f': F |
1963 | 112..114 '{}': () | 1963 | 111..113 '{}': () |
1964 | 148..149 'f': F | 1964 | 147..148 'f': F |
1965 | 154..155 'x': T | 1965 | 153..154 'x': T |
1966 | 165..167 '{}': () | 1966 | 164..166 '{}': () |
1967 | 202..206 'self': S | 1967 | 201..205 'self': S |
1968 | 254..258 'self': S | 1968 | 253..257 'self': S |
1969 | 260..261 'x': T | 1969 | 259..260 'x': T |
1970 | 266..267 'f': F | 1970 | 265..266 'f': F |
1971 | 277..279 '{}': () | 1971 | 276..278 '{}': () |
1972 | 317..321 'self': S | 1972 | 316..320 'self': S |
1973 | 323..324 'f': F | 1973 | 322..323 'f': F |
1974 | 329..330 'x': T | 1974 | 328..329 'x': T |
1975 | 340..342 '{}': () | 1975 | 339..341 '{}': () |
1976 | 356..515 '{ ... S); }': () | 1976 | 355..514 '{ ... S); }': () |
1977 | 366..368 'x1': u64 | 1977 | 365..367 'x1': u64 |
1978 | 371..375 'foo1': fn foo1<S, u64, |S| -> u64>(S, |S| -> u64) -> u64 | 1978 | 370..374 'foo1': fn foo1<S, u64, |S| -> u64>(S, |S| -> u64) -> u64 |
1979 | 371..394 'foo1(S...hod())': u64 | 1979 | 370..393 'foo1(S...hod())': u64 |
1980 | 376..377 'S': S | 1980 | 375..376 'S': S |
1981 | 379..393 '|s| s.method()': |S| -> u64 | 1981 | 378..392 '|s| s.method()': |S| -> u64 |
1982 | 380..381 's': S | 1982 | 379..380 's': S |
1983 | 383..384 's': S | 1983 | 382..383 's': S |
1984 | 383..393 's.method()': u64 | 1984 | 382..392 's.method()': u64 |
1985 | 404..406 'x2': u64 | 1985 | 403..405 'x2': u64 |
1986 | 409..413 'foo2': fn foo2<S, u64, |S| -> u64>(|S| -> u64, S) -> u64 | 1986 | 408..412 'foo2': fn foo2<S, u64, |S| -> u64>(|S| -> u64, S) -> u64 |
1987 | 409..432 'foo2(|...(), S)': u64 | 1987 | 408..431 'foo2(|...(), S)': u64 |
1988 | 414..428 '|s| s.method()': |S| -> u64 | 1988 | 413..427 '|s| s.method()': |S| -> u64 |
1989 | 415..416 's': S | 1989 | 414..415 's': S |
1990 | 418..419 's': S | 1990 | 417..418 's': S |
1991 | 418..428 's.method()': u64 | 1991 | 417..427 's.method()': u64 |
1992 | 430..431 'S': S | 1992 | 429..430 'S': S |
1993 | 442..444 'x3': u64 | 1993 | 441..443 'x3': u64 |
1994 | 447..448 'S': S | 1994 | 446..447 'S': S |
1995 | 447..472 'S.foo1...hod())': u64 | 1995 | 446..471 'S.foo1...hod())': u64 |
1996 | 454..455 'S': S | 1996 | 453..454 'S': S |
1997 | 457..471 '|s| s.method()': |S| -> u64 | 1997 | 456..470 '|s| s.method()': |S| -> u64 |
1998 | 458..459 's': S | 1998 | 457..458 's': S |
1999 | 461..462 's': S | 1999 | 460..461 's': S |
2000 | 461..471 's.method()': u64 | 2000 | 460..470 's.method()': u64 |
2001 | 482..484 'x4': u64 | 2001 | 481..483 'x4': u64 |
2002 | 487..488 'S': S | 2002 | 486..487 'S': S |
2003 | 487..512 'S.foo2...(), S)': u64 | 2003 | 486..511 'S.foo2...(), S)': u64 |
2004 | 494..508 '|s| s.method()': |S| -> u64 | 2004 | 493..507 '|s| s.method()': |S| -> u64 |
2005 | 495..496 's': S | 2005 | 494..495 's': S |
2006 | 498..499 's': S | 2006 | 497..498 's': S |
2007 | 498..508 's.method()': u64 | 2007 | 497..507 's.method()': u64 |
2008 | 510..511 'S': S | 2008 | 509..510 'S': S |
2009 | "### | 2009 | "### |
2010 | ); | 2010 | ); |
2011 | } | 2011 | } |
@@ -2080,18 +2080,18 @@ impl Trait for S2 { | |||
2080 | } | 2080 | } |
2081 | "#, | 2081 | "#, |
2082 | ), @r###" | 2082 | ), @r###" |
2083 | 54..58 'self': &Self | 2083 | 40..44 'self': &Self |
2084 | 60..61 'x': Trait::Item<Self> | 2084 | 46..47 'x': Trait::Item<Self> |
2085 | 140..144 'self': &S | 2085 | 126..130 'self': &S |
2086 | 146..147 'x': u32 | 2086 | 132..133 'x': u32 |
2087 | 161..175 '{ let y = x; }': () | 2087 | 147..161 '{ let y = x; }': () |
2088 | 167..168 'y': u32 | 2088 | 153..154 'y': u32 |
2089 | 171..172 'x': u32 | 2089 | 157..158 'x': u32 |
2090 | 242..246 'self': &S2 | 2090 | 228..232 'self': &S2 |
2091 | 248..249 'x': i32 | 2091 | 234..235 'x': i32 |
2092 | 265..279 '{ let y = x; }': () | 2092 | 251..265 '{ let y = x; }': () |
2093 | 271..272 'y': i32 | 2093 | 257..258 'y': i32 |
2094 | 275..276 'x': i32 | 2094 | 261..262 'x': i32 |
2095 | "###); | 2095 | "###); |
2096 | } | 2096 | } |
2097 | 2097 | ||
@@ -2331,15 +2331,15 @@ impl TokenStream for Rustc { | |||
2331 | } | 2331 | } |
2332 | "#), | 2332 | "#), |
2333 | @r###" | 2333 | @r###" |
2334 | 1062..1073 '{ loop {} }': T | 2334 | 1061..1072 '{ loop {} }': T |
2335 | 1064..1071 'loop {}': ! | 2335 | 1063..1070 'loop {}': ! |
2336 | 1069..1071 '{}': () | 2336 | 1068..1070 '{}': () |
2337 | 1137..1200 '{ ... }': T | 2337 | 1136..1199 '{ ... }': T |
2338 | 1151..1156 'group': G | 2338 | 1150..1155 'group': G |
2339 | 1172..1176 'make': fn make<G>() -> G | 2339 | 1171..1175 'make': fn make<G>() -> G |
2340 | 1172..1178 'make()': G | 2340 | 1171..1177 'make()': G |
2341 | 1188..1192 'make': fn make<T>() -> T | 2341 | 1187..1191 'make': fn make<T>() -> T |
2342 | 1188..1194 'make()': T | 2342 | 1187..1193 'make()': T |
2343 | "### | 2343 | "### |
2344 | ); | 2344 | ); |
2345 | } | 2345 | } |
@@ -2366,37 +2366,37 @@ fn test() -> impl Trait<i32> { | |||
2366 | } | 2366 | } |
2367 | "#, true), | 2367 | "#, true), |
2368 | @r###" | 2368 | @r###" |
2369 | 27..28 'x': impl Trait<u32> | 2369 | 26..27 'x': impl Trait<u32> |
2370 | 47..58 '{ loop {} }': () | 2370 | 46..57 '{ loop {} }': () |
2371 | 49..56 'loop {}': ! | 2371 | 48..55 'loop {}': ! |
2372 | 54..56 '{}': () | 2372 | 53..55 '{}': () |
2373 | 69..70 'x': impl Trait<T> | 2373 | 68..69 'x': impl Trait<T> |
2374 | 92..103 '{ loop {} }': T | 2374 | 91..102 '{ loop {} }': T |
2375 | 94..101 'loop {}': ! | 2375 | 93..100 'loop {}': ! |
2376 | 99..101 '{}': () | 2376 | 98..100 '{}': () |
2377 | 172..183 '{ loop {} }': T | 2377 | 171..182 '{ loop {} }': T |
2378 | 174..181 'loop {}': ! | 2378 | 173..180 'loop {}': ! |
2379 | 179..181 '{}': () | 2379 | 178..180 '{}': () |
2380 | 214..310 '{ ...t()) }': S<{unknown}> | 2380 | 213..309 '{ ...t()) }': S<{unknown}> |
2381 | 224..226 's1': S<u32> | 2381 | 223..225 's1': S<u32> |
2382 | 229..230 'S': S<u32>(u32) -> S<u32> | 2382 | 228..229 'S': S<u32>(u32) -> S<u32> |
2383 | 229..241 'S(default())': S<u32> | 2383 | 228..240 'S(default())': S<u32> |
2384 | 231..238 'default': fn default<u32>() -> u32 | 2384 | 230..237 'default': fn default<u32>() -> u32 |
2385 | 231..240 'default()': u32 | 2385 | 230..239 'default()': u32 |
2386 | 247..250 'foo': fn foo(S<u32>) | 2386 | 246..249 'foo': fn foo(S<u32>) |
2387 | 247..254 'foo(s1)': () | 2387 | 246..253 'foo(s1)': () |
2388 | 251..253 's1': S<u32> | 2388 | 250..252 's1': S<u32> |
2389 | 264..265 'x': i32 | 2389 | 263..264 'x': i32 |
2390 | 273..276 'bar': fn bar<i32>(S<i32>) -> i32 | 2390 | 272..275 'bar': fn bar<i32>(S<i32>) -> i32 |
2391 | 273..290 'bar(S(...lt()))': i32 | 2391 | 272..289 'bar(S(...lt()))': i32 |
2392 | 277..278 'S': S<i32>(i32) -> S<i32> | 2392 | 276..277 'S': S<i32>(i32) -> S<i32> |
2393 | 277..289 'S(default())': S<i32> | 2393 | 276..288 'S(default())': S<i32> |
2394 | 279..286 'default': fn default<i32>() -> i32 | 2394 | 278..285 'default': fn default<i32>() -> i32 |
2395 | 279..288 'default()': i32 | 2395 | 278..287 'default()': i32 |
2396 | 296..297 'S': S<{unknown}>({unknown}) -> S<{unknown}> | 2396 | 295..296 'S': S<{unknown}>({unknown}) -> S<{unknown}> |
2397 | 296..308 'S(default())': S<{unknown}> | 2397 | 295..307 'S(default())': S<{unknown}> |
2398 | 298..305 'default': fn default<{unknown}>() -> {unknown} | 2398 | 297..304 'default': fn default<{unknown}>() -> {unknown} |
2399 | 298..307 'default()': {unknown} | 2399 | 297..306 'default()': {unknown} |
2400 | "### | 2400 | "### |
2401 | ); | 2401 | ); |
2402 | } | 2402 | } |
@@ -2430,15 +2430,15 @@ fn main() { | |||
2430 | } | 2430 | } |
2431 | "#), | 2431 | "#), |
2432 | @r###" | 2432 | @r###" |
2433 | 147..149 '_v': F | 2433 | 133..135 '_v': F |
2434 | 192..195 '{ }': () | 2434 | 178..181 '{ }': () |
2435 | 207..238 '{ ... }); }': () | 2435 | 193..224 '{ ... }); }': () |
2436 | 213..223 'f::<(), _>': fn f<(), |&()| -> ()>(|&()| -> ()) | 2436 | 199..209 'f::<(), _>': fn f<(), |&()| -> ()>(|&()| -> ()) |
2437 | 213..235 'f::<()... z; })': () | 2437 | 199..221 'f::<()... z; })': () |
2438 | 224..234 '|z| { z; }': |&()| -> () | 2438 | 210..220 '|z| { z; }': |&()| -> () |
2439 | 225..226 'z': &() | 2439 | 211..212 'z': &() |
2440 | 228..234 '{ z; }': () | 2440 | 214..220 '{ z; }': () |
2441 | 230..231 'z': &() | 2441 | 216..217 'z': &() |
2442 | "### | 2442 | "### |
2443 | ); | 2443 | ); |
2444 | } | 2444 | } |
@@ -2591,46 +2591,46 @@ fn main() { | |||
2591 | } | 2591 | } |
2592 | "#), | 2592 | "#), |
2593 | @r###" | 2593 | @r###" |
2594 | 240..244 'self': Self | 2594 | 226..230 'self': Self |
2595 | 246..247 'f': F | 2595 | 232..233 'f': F |
2596 | 331..342 '{ loop {} }': FilterMap<Self, F> | 2596 | 317..328 '{ loop {} }': FilterMap<Self, F> |
2597 | 333..340 'loop {}': ! | 2597 | 319..326 'loop {}': ! |
2598 | 338..340 '{}': () | 2598 | 324..326 '{}': () |
2599 | 363..367 'self': Self | 2599 | 349..353 'self': Self |
2600 | 369..370 'f': F | 2600 | 355..356 'f': F |
2601 | 419..430 '{ loop {} }': () | 2601 | 405..416 '{ loop {} }': () |
2602 | 421..428 'loop {}': ! | 2602 | 407..414 'loop {}': ! |
2603 | 426..428 '{}': () | 2603 | 412..414 '{}': () |
2604 | 539..543 'self': Self | 2604 | 525..529 'self': Self |
2605 | 868..872 'self': I | 2605 | 854..858 'self': I |
2606 | 879..899 '{ ... }': I | 2606 | 865..885 '{ ... }': I |
2607 | 889..893 'self': I | 2607 | 875..879 'self': I |
2608 | 958..969 '{ loop {} }': Vec<T> | 2608 | 944..955 '{ loop {} }': Vec<T> |
2609 | 960..967 'loop {}': ! | 2609 | 946..953 'loop {}': ! |
2610 | 965..967 '{}': () | 2610 | 951..953 '{}': () |
2611 | 1156..1287 '{ ... }); }': () | 2611 | 1142..1273 '{ ... }); }': () |
2612 | 1162..1177 'Vec::<i32>::new': fn new<i32>() -> Vec<i32> | 2612 | 1148..1163 'Vec::<i32>::new': fn new<i32>() -> Vec<i32> |
2613 | 1162..1179 'Vec::<...:new()': Vec<i32> | 2613 | 1148..1165 'Vec::<...:new()': Vec<i32> |
2614 | 1162..1191 'Vec::<...iter()': IntoIter<i32> | 2614 | 1148..1177 'Vec::<...iter()': IntoIter<i32> |
2615 | 1162..1256 'Vec::<...one })': FilterMap<IntoIter<i32>, |i32| -> Option<u32>> | 2615 | 1148..1242 'Vec::<...one })': FilterMap<IntoIter<i32>, |i32| -> Option<u32>> |
2616 | 1162..1284 'Vec::<... y; })': () | 2616 | 1148..1270 'Vec::<... y; })': () |
2617 | 1210..1255 '|x| if...None }': |i32| -> Option<u32> | 2617 | 1196..1241 '|x| if...None }': |i32| -> Option<u32> |
2618 | 1211..1212 'x': i32 | 2618 | 1197..1198 'x': i32 |
2619 | 1214..1255 'if x >...None }': Option<u32> | 2619 | 1200..1241 'if x >...None }': Option<u32> |
2620 | 1217..1218 'x': i32 | 2620 | 1203..1204 'x': i32 |
2621 | 1217..1222 'x > 0': bool | 2621 | 1203..1208 'x > 0': bool |
2622 | 1221..1222 '0': i32 | 2622 | 1207..1208 '0': i32 |
2623 | 1223..1241 '{ Some...u32) }': Option<u32> | 2623 | 1209..1227 '{ Some...u32) }': Option<u32> |
2624 | 1225..1229 'Some': Some<u32>(u32) -> Option<u32> | 2624 | 1211..1215 'Some': Some<u32>(u32) -> Option<u32> |
2625 | 1225..1239 'Some(x as u32)': Option<u32> | 2625 | 1211..1225 'Some(x as u32)': Option<u32> |
2626 | 1230..1231 'x': i32 | 2626 | 1216..1217 'x': i32 |
2627 | 1230..1238 'x as u32': u32 | 2627 | 1216..1224 'x as u32': u32 |
2628 | 1247..1255 '{ None }': Option<u32> | 2628 | 1233..1241 '{ None }': Option<u32> |
2629 | 1249..1253 'None': Option<u32> | 2629 | 1235..1239 'None': Option<u32> |
2630 | 1273..1283 '|y| { y; }': |u32| -> () | 2630 | 1259..1269 '|y| { y; }': |u32| -> () |
2631 | 1274..1275 'y': u32 | 2631 | 1260..1261 'y': u32 |
2632 | 1277..1283 '{ y; }': () | 2632 | 1263..1269 '{ y; }': () |
2633 | 1279..1280 'y': u32 | 2633 | 1265..1266 'y': u32 |
2634 | "### | 2634 | "### |
2635 | ); | 2635 | ); |
2636 | } | 2636 | } |
@@ -2682,13 +2682,13 @@ fn test(x: &dyn Foo) { | |||
2682 | } | 2682 | } |
2683 | "#, true), | 2683 | "#, true), |
2684 | @r###" | 2684 | @r###" |
2685 | 22..23 'x': &dyn Foo | 2685 | 21..22 'x': &dyn Foo |
2686 | 35..37 '{}': () | 2686 | 34..36 '{}': () |
2687 | 47..48 'x': &dyn Foo | 2687 | 46..47 'x': &dyn Foo |
2688 | 60..75 '{ foo(x); }': () | 2688 | 59..74 '{ foo(x); }': () |
2689 | 66..69 'foo': fn foo(&dyn Foo) | 2689 | 65..68 'foo': fn foo(&dyn Foo) |
2690 | 66..72 'foo(x)': () | 2690 | 65..71 'foo(x)': () |
2691 | 70..71 'x': &dyn Foo | 2691 | 69..70 'x': &dyn Foo |
2692 | "### | 2692 | "### |
2693 | ); | 2693 | ); |
2694 | } | 2694 | } |
@@ -2715,20 +2715,20 @@ fn test() { | |||
2715 | } | 2715 | } |
2716 | "#, true), | 2716 | "#, true), |
2717 | @r###" | 2717 | @r###" |
2718 | 111..115 'self': &Self | 2718 | 110..114 'self': &Self |
2719 | 167..268 '{ ...t(); }': () | 2719 | 166..267 '{ ...t(); }': () |
2720 | 173..179 'IsCopy': IsCopy | 2720 | 172..178 'IsCopy': IsCopy |
2721 | 173..186 'IsCopy.test()': bool | 2721 | 172..185 'IsCopy.test()': bool |
2722 | 192..199 'NotCopy': NotCopy | 2722 | 191..198 'NotCopy': NotCopy |
2723 | 192..206 'NotCopy.test()': {unknown} | 2723 | 191..205 'NotCopy.test()': {unknown} |
2724 | 212..228 '(IsCop...sCopy)': (IsCopy, IsCopy) | 2724 | 211..227 '(IsCop...sCopy)': (IsCopy, IsCopy) |
2725 | 212..235 '(IsCop...test()': bool | 2725 | 211..234 '(IsCop...test()': bool |
2726 | 213..219 'IsCopy': IsCopy | 2726 | 212..218 'IsCopy': IsCopy |
2727 | 221..227 'IsCopy': IsCopy | 2727 | 220..226 'IsCopy': IsCopy |
2728 | 241..258 '(IsCop...tCopy)': (IsCopy, NotCopy) | 2728 | 240..257 '(IsCop...tCopy)': (IsCopy, NotCopy) |
2729 | 241..265 '(IsCop...test()': {unknown} | 2729 | 240..264 '(IsCop...test()': {unknown} |
2730 | 242..248 'IsCopy': IsCopy | 2730 | 241..247 'IsCopy': IsCopy |
2731 | 250..257 'NotCopy': NotCopy | 2731 | 249..256 'NotCopy': NotCopy |
2732 | "### | 2732 | "### |
2733 | ); | 2733 | ); |
2734 | } | 2734 | } |
@@ -2756,20 +2756,20 @@ fn test() { | |||
2756 | } | 2756 | } |
2757 | "#, true), | 2757 | "#, true), |
2758 | @r###" | 2758 | @r###" |
2759 | 42..44 '{}': () | 2759 | 41..43 '{}': () |
2760 | 61..62 'T': {unknown} | 2760 | 60..61 'T': {unknown} |
2761 | 69..71 '{}': () | 2761 | 68..70 '{}': () |
2762 | 69..71: expected T, got () | 2762 | 68..70: expected T, got () |
2763 | 146..150 'self': &Self | 2763 | 145..149 'self': &Self |
2764 | 202..282 '{ ...t(); }': () | 2764 | 201..281 '{ ...t(); }': () |
2765 | 208..211 'foo': fn foo() | 2765 | 207..210 'foo': fn foo() |
2766 | 208..218 'foo.test()': bool | 2766 | 207..217 'foo.test()': bool |
2767 | 224..227 'bar': fn bar<{unknown}>({unknown}) -> {unknown} | 2767 | 223..226 'bar': fn bar<{unknown}>({unknown}) -> {unknown} |
2768 | 224..234 'bar.test()': bool | 2768 | 223..233 'bar.test()': bool |
2769 | 240..246 'Struct': Struct(usize) -> Struct | 2769 | 239..245 'Struct': Struct(usize) -> Struct |
2770 | 240..253 'Struct.test()': bool | 2770 | 239..252 'Struct.test()': bool |
2771 | 259..272 'Enum::Variant': Variant(usize) -> Enum | 2771 | 258..271 'Enum::Variant': Variant(usize) -> Enum |
2772 | 259..279 'Enum::...test()': bool | 2772 | 258..278 'Enum::...test()': bool |
2773 | "### | 2773 | "### |
2774 | ); | 2774 | ); |
2775 | } | 2775 | } |
@@ -2791,17 +2791,17 @@ fn test(f1: fn(), f2: fn(usize) -> u8, f3: fn(u8, u8) -> &u8) { | |||
2791 | } | 2791 | } |
2792 | "#, true), | 2792 | "#, true), |
2793 | @r###" | 2793 | @r###" |
2794 | 55..59 'self': &Self | 2794 | 54..58 'self': &Self |
2795 | 109..111 'f1': fn() | 2795 | 108..110 'f1': fn() |
2796 | 119..121 'f2': fn(usize) -> u8 | 2796 | 118..120 'f2': fn(usize) -> u8 |
2797 | 140..142 'f3': fn(u8, u8) -> &u8 | 2797 | 139..141 'f3': fn(u8, u8) -> &u8 |
2798 | 163..211 '{ ...t(); }': () | 2798 | 162..210 '{ ...t(); }': () |
2799 | 169..171 'f1': fn() | 2799 | 168..170 'f1': fn() |
2800 | 169..178 'f1.test()': bool | 2800 | 168..177 'f1.test()': bool |
2801 | 184..186 'f2': fn(usize) -> u8 | 2801 | 183..185 'f2': fn(usize) -> u8 |
2802 | 184..193 'f2.test()': bool | 2802 | 183..192 'f2.test()': bool |
2803 | 199..201 'f3': fn(u8, u8) -> &u8 | 2803 | 198..200 'f3': fn(u8, u8) -> &u8 |
2804 | 199..208 'f3.test()': bool | 2804 | 198..207 'f3.test()': bool |
2805 | "### | 2805 | "### |
2806 | ); | 2806 | ); |
2807 | } | 2807 | } |
@@ -2824,22 +2824,22 @@ fn test() { | |||
2824 | } | 2824 | } |
2825 | "#, true), | 2825 | "#, true), |
2826 | @r###" | 2826 | @r###" |
2827 | 57..61 'self': &Self | 2827 | 56..60 'self': &Self |
2828 | 114..229 '{ ...ized }': () | 2828 | 113..228 '{ ...ized }': () |
2829 | 120..123 '1u8': u8 | 2829 | 119..122 '1u8': u8 |
2830 | 120..130 '1u8.test()': bool | 2830 | 119..129 '1u8.test()': bool |
2831 | 136..151 '(*"foo").test()': {unknown} | 2831 | 135..150 '(*"foo").test()': {unknown} |
2832 | 137..143 '*"foo"': str | 2832 | 136..142 '*"foo"': str |
2833 | 138..143 '"foo"': &str | 2833 | 137..142 '"foo"': &str |
2834 | 170..180 '(1u8, 1u8)': (u8, u8) | 2834 | 169..179 '(1u8, 1u8)': (u8, u8) |
2835 | 170..187 '(1u8, ...test()': bool | 2835 | 169..186 '(1u8, ...test()': bool |
2836 | 171..174 '1u8': u8 | 2836 | 170..173 '1u8': u8 |
2837 | 176..179 '1u8': u8 | 2837 | 175..178 '1u8': u8 |
2838 | 193..206 '(1u8, *"foo")': (u8, str) | 2838 | 192..205 '(1u8, *"foo")': (u8, str) |
2839 | 193..213 '(1u8, ...test()': {unknown} | 2839 | 192..212 '(1u8, ...test()': {unknown} |
2840 | 194..197 '1u8': u8 | 2840 | 193..196 '1u8': u8 |
2841 | 199..205 '*"foo"': str | 2841 | 198..204 '*"foo"': str |
2842 | 200..205 '"foo"': &str | 2842 | 199..204 '"foo"': &str |
2843 | "### | 2843 | "### |
2844 | ); | 2844 | ); |
2845 | } | 2845 | } |
@@ -2909,17 +2909,17 @@ fn infer_closure_arg() { | |||
2909 | "# | 2909 | "# |
2910 | ), | 2910 | ), |
2911 | @r###" | 2911 | @r###" |
2912 | 137..259 '{ ... }': () | 2912 | 52..126 '{ ...)(s) }': () |
2913 | 159..160 's': Option<i32> | 2913 | 62..63 's': Option<i32> |
2914 | 163..175 'Option::None': Option<i32> | 2914 | 66..78 'Option::None': Option<i32> |
2915 | 197..198 'f': |Option<i32>| -> () | 2915 | 88..89 'f': |Option<i32>| -> () |
2916 | 201..220 '|x: Op...2>| {}': |Option<i32>| -> () | 2916 | 92..111 '|x: Op...2>| {}': |Option<i32>| -> () |
2917 | 202..203 'x': Option<i32> | 2917 | 93..94 'x': Option<i32> |
2918 | 218..220 '{}': () | 2918 | 109..111 '{}': () |
2919 | 238..245 '(&f)(s)': () | 2919 | 117..124 '(&f)(s)': () |
2920 | 239..241 '&f': &|Option<i32>| -> () | 2920 | 118..120 '&f': &|Option<i32>| -> () |
2921 | 240..241 'f': |Option<i32>| -> () | 2921 | 119..120 'f': |Option<i32>| -> () |
2922 | 243..244 's': Option<i32> | 2922 | 122..123 's': Option<i32> |
2923 | "### | 2923 | "### |
2924 | ); | 2924 | ); |
2925 | } | 2925 | } |
@@ -2958,17 +2958,17 @@ fn infer_fn_trait_arg() { | |||
2958 | "# | 2958 | "# |
2959 | ), | 2959 | ), |
2960 | @r###" | 2960 | @r###" |
2961 | 183..187 'self': &Self | 2961 | 101..105 'self': &Self |
2962 | 189..193 'args': Args | 2962 | 107..111 'args': Args |
2963 | 350..354 'self': &Self | 2963 | 220..224 'self': &Self |
2964 | 356..360 'args': Args | 2964 | 226..230 'args': Args |
2965 | 515..516 'f': F | 2965 | 313..314 'f': F |
2966 | 597..663 '{ ... }': T | 2966 | 359..389 '{ ...f(s) }': T |
2967 | 619..620 's': Option<i32> | 2967 | 369..370 's': Option<i32> |
2968 | 623..627 'None': Option<i32> | 2968 | 373..377 'None': Option<i32> |
2969 | 645..646 'f': F | 2969 | 383..384 'f': F |
2970 | 645..649 'f(s)': T | 2970 | 383..387 'f(s)': T |
2971 | 647..648 's': Option<i32> | 2971 | 385..386 's': Option<i32> |
2972 | "### | 2972 | "### |
2973 | ); | 2973 | ); |
2974 | } | 2974 | } |
@@ -3020,26 +3020,26 @@ fn infer_box_fn_arg() { | |||
3020 | "# | 3020 | "# |
3021 | ), | 3021 | ), |
3022 | @r###" | 3022 | @r###" |
3023 | 182..186 'self': Self | 3023 | 100..104 'self': Self |
3024 | 188..192 'args': Args | 3024 | 106..110 'args': Args |
3025 | 356..360 'self': &Self | 3025 | 214..218 'self': &Self |
3026 | 622..626 'self': &Box<T> | 3026 | 384..388 'self': &Box<T> |
3027 | 634..685 '{ ... }': &T | 3027 | 396..423 '{ ... }': &T |
3028 | 656..667 '&self.inner': &*mut T | 3028 | 406..417 '&self.inner': &*mut T |
3029 | 657..661 'self': &Box<T> | 3029 | 407..411 'self': &Box<T> |
3030 | 657..667 'self.inner': *mut T | 3030 | 407..417 'self.inner': *mut T |
3031 | 812..957 '{ ... }': FnOnce::Output<dyn FnOnce<(&Option<i32>,)>, (&Option<i32>,)> | 3031 | 478..575 '{ ...(&s) }': FnOnce::Output<dyn FnOnce<(&Option<i32>,)>, (&Option<i32>,)> |
3032 | 834..835 's': Option<i32> | 3032 | 488..489 's': Option<i32> |
3033 | 838..850 'Option::None': Option<i32> | 3033 | 492..504 'Option::None': Option<i32> |
3034 | 872..873 'f': Box<dyn FnOnce<(&Option<i32>,)>> | 3034 | 514..515 'f': Box<dyn FnOnce<(&Option<i32>,)>> |
3035 | 907..920 'box (|ps| {})': Box<|{unknown}| -> ()> | 3035 | 549..562 'box (|ps| {})': Box<|{unknown}| -> ()> |
3036 | 912..919 '|ps| {}': |{unknown}| -> () | 3036 | 554..561 '|ps| {}': |{unknown}| -> () |
3037 | 913..915 'ps': {unknown} | 3037 | 555..557 'ps': {unknown} |
3038 | 917..919 '{}': () | 3038 | 559..561 '{}': () |
3039 | 938..939 'f': Box<dyn FnOnce<(&Option<i32>,)>> | 3039 | 568..569 'f': Box<dyn FnOnce<(&Option<i32>,)>> |
3040 | 938..943 'f(&s)': FnOnce::Output<dyn FnOnce<(&Option<i32>,)>, (&Option<i32>,)> | 3040 | 568..573 'f(&s)': FnOnce::Output<dyn FnOnce<(&Option<i32>,)>, (&Option<i32>,)> |
3041 | 940..942 '&s': &Option<i32> | 3041 | 570..572 '&s': &Option<i32> |
3042 | 941..942 's': Option<i32> | 3042 | 571..572 's': Option<i32> |
3043 | "### | 3043 | "### |
3044 | ); | 3044 | ); |
3045 | } | 3045 | } |
@@ -3090,24 +3090,24 @@ fn infer_dyn_fn_output() { | |||
3090 | "# | 3090 | "# |
3091 | ), | 3091 | ), |
3092 | @r###" | 3092 | @r###" |
3093 | 182..186 'self': Self | 3093 | 100..104 'self': Self |
3094 | 188..192 'args': Args | 3094 | 106..110 'args': Args |
3095 | 349..353 'self': &Self | 3095 | 219..223 'self': &Self |
3096 | 355..359 'args': Args | 3096 | 225..229 'args': Args |
3097 | 523..527 'self': &Self | 3097 | 333..337 'self': &Self |
3098 | 789..793 'self': &Box<T> | 3098 | 503..507 'self': &Box<T> |
3099 | 801..852 '{ ... }': &T | 3099 | 515..542 '{ ... }': &T |
3100 | 823..834 '&self.inner': &*mut T | 3100 | 525..536 '&self.inner': &*mut T |
3101 | 824..828 'self': &Box<T> | 3101 | 526..530 'self': &Box<T> |
3102 | 824..834 'self.inner': *mut T | 3102 | 526..536 'self.inner': *mut T |
3103 | 889..990 '{ ... }': () | 3103 | 555..620 '{ ...f(); }': () |
3104 | 911..912 'f': Box<dyn Fn<(), Output = i32>> | 3104 | 565..566 'f': Box<dyn Fn<(), Output = i32>> |
3105 | 937..946 'box(|| 5)': Box<|| -> i32> | 3105 | 591..600 'box(|| 5)': Box<|| -> i32> |
3106 | 941..945 '|| 5': || -> i32 | 3106 | 595..599 '|| 5': || -> i32 |
3107 | 944..945 '5': i32 | 3107 | 598..599 '5': i32 |
3108 | 968..969 'x': FnOnce::Output<dyn Fn<(), Output = i32>, ()> | 3108 | 610..611 'x': FnOnce::Output<dyn Fn<(), Output = i32>, ()> |
3109 | 972..973 'f': Box<dyn Fn<(), Output = i32>> | 3109 | 614..615 'f': Box<dyn Fn<(), Output = i32>> |
3110 | 972..975 'f()': FnOnce::Output<dyn Fn<(), Output = i32>, ()> | 3110 | 614..617 'f()': FnOnce::Output<dyn Fn<(), Output = i32>, ()> |
3111 | "### | 3111 | "### |
3112 | ); | 3112 | ); |
3113 | } | 3113 | } |
diff --git a/crates/ra_ide/src/call_hierarchy.rs b/crates/ra_ide/src/call_hierarchy.rs index defd8176f..1e3a31602 100644 --- a/crates/ra_ide/src/call_hierarchy.rs +++ b/crates/ra_ide/src/call_hierarchy.rs | |||
@@ -145,12 +145,12 @@ mod tests { | |||
145 | use crate::mock_analysis::analysis_and_position; | 145 | use crate::mock_analysis::analysis_and_position; |
146 | 146 | ||
147 | fn check_hierarchy( | 147 | fn check_hierarchy( |
148 | fixture: &str, | 148 | ra_fixture: &str, |
149 | expected: &str, | 149 | expected: &str, |
150 | expected_incoming: &[&str], | 150 | expected_incoming: &[&str], |
151 | expected_outgoing: &[&str], | 151 | expected_outgoing: &[&str], |
152 | ) { | 152 | ) { |
153 | let (analysis, pos) = analysis_and_position(fixture); | 153 | let (analysis, pos) = analysis_and_position(ra_fixture); |
154 | 154 | ||
155 | let mut navs = analysis.call_hierarchy(pos).unwrap().unwrap().info; | 155 | let mut navs = analysis.call_hierarchy(pos).unwrap().unwrap().info; |
156 | assert_eq!(navs.len(), 1); | 156 | assert_eq!(navs.len(), 1); |
@@ -177,12 +177,12 @@ mod tests { | |||
177 | fn test_call_hierarchy_on_ref() { | 177 | fn test_call_hierarchy_on_ref() { |
178 | check_hierarchy( | 178 | check_hierarchy( |
179 | r#" | 179 | r#" |
180 | //- /lib.rs | 180 | //- /lib.rs |
181 | fn callee() {} | 181 | fn callee() {} |
182 | fn caller() { | 182 | fn caller() { |
183 | call<|>ee(); | 183 | call<|>ee(); |
184 | } | 184 | } |
185 | "#, | 185 | "#, |
186 | "callee FN_DEF FileId(1) 0..14 3..9", | 186 | "callee FN_DEF FileId(1) 0..14 3..9", |
187 | &["caller FN_DEF FileId(1) 15..44 18..24 : [33..39]"], | 187 | &["caller FN_DEF FileId(1) 15..44 18..24 : [33..39]"], |
188 | &[], | 188 | &[], |
@@ -193,12 +193,12 @@ mod tests { | |||
193 | fn test_call_hierarchy_on_def() { | 193 | fn test_call_hierarchy_on_def() { |
194 | check_hierarchy( | 194 | check_hierarchy( |
195 | r#" | 195 | r#" |
196 | //- /lib.rs | 196 | //- /lib.rs |
197 | fn call<|>ee() {} | 197 | fn call<|>ee() {} |
198 | fn caller() { | 198 | fn caller() { |
199 | callee(); | 199 | callee(); |
200 | } | 200 | } |
201 | "#, | 201 | "#, |
202 | "callee FN_DEF FileId(1) 0..14 3..9", | 202 | "callee FN_DEF FileId(1) 0..14 3..9", |
203 | &["caller FN_DEF FileId(1) 15..44 18..24 : [33..39]"], | 203 | &["caller FN_DEF FileId(1) 15..44 18..24 : [33..39]"], |
204 | &[], | 204 | &[], |
@@ -209,13 +209,13 @@ mod tests { | |||
209 | fn test_call_hierarchy_in_same_fn() { | 209 | fn test_call_hierarchy_in_same_fn() { |
210 | check_hierarchy( | 210 | check_hierarchy( |
211 | r#" | 211 | r#" |
212 | //- /lib.rs | 212 | //- /lib.rs |
213 | fn callee() {} | 213 | fn callee() {} |
214 | fn caller() { | 214 | fn caller() { |
215 | call<|>ee(); | 215 | call<|>ee(); |
216 | callee(); | 216 | callee(); |
217 | } | 217 | } |
218 | "#, | 218 | "#, |
219 | "callee FN_DEF FileId(1) 0..14 3..9", | 219 | "callee FN_DEF FileId(1) 0..14 3..9", |
220 | &["caller FN_DEF FileId(1) 15..58 18..24 : [33..39, 47..53]"], | 220 | &["caller FN_DEF FileId(1) 15..58 18..24 : [33..39, 47..53]"], |
221 | &[], | 221 | &[], |
@@ -226,20 +226,20 @@ mod tests { | |||
226 | fn test_call_hierarchy_in_different_fn() { | 226 | fn test_call_hierarchy_in_different_fn() { |
227 | check_hierarchy( | 227 | check_hierarchy( |
228 | r#" | 228 | r#" |
229 | //- /lib.rs | 229 | //- /lib.rs |
230 | fn callee() {} | 230 | fn callee() {} |
231 | fn caller1() { | 231 | fn caller1() { |
232 | call<|>ee(); | 232 | call<|>ee(); |
233 | } | 233 | } |
234 | 234 | ||
235 | fn caller2() { | 235 | fn caller2() { |
236 | callee(); | 236 | callee(); |
237 | } | 237 | } |
238 | "#, | 238 | "#, |
239 | "callee FN_DEF FileId(1) 0..14 3..9", | 239 | "callee FN_DEF FileId(1) 0..14 3..9", |
240 | &[ | 240 | &[ |
241 | "caller1 FN_DEF FileId(1) 15..45 18..25 : [34..40]", | 241 | "caller1 FN_DEF FileId(1) 15..45 18..25 : [34..40]", |
242 | "caller2 FN_DEF FileId(1) 46..76 49..56 : [65..71]", | 242 | "caller2 FN_DEF FileId(1) 47..77 50..57 : [66..72]", |
243 | ], | 243 | ], |
244 | &[], | 244 | &[], |
245 | ); | 245 | ); |
@@ -249,26 +249,26 @@ mod tests { | |||
249 | fn test_call_hierarchy_in_tests_mod() { | 249 | fn test_call_hierarchy_in_tests_mod() { |
250 | check_hierarchy( | 250 | check_hierarchy( |
251 | r#" | 251 | r#" |
252 | //- /lib.rs cfg:test | 252 | //- /lib.rs cfg:test |
253 | fn callee() {} | 253 | fn callee() {} |
254 | fn caller1() { | 254 | fn caller1() { |
255 | call<|>ee(); | 255 | call<|>ee(); |
256 | } | 256 | } |
257 | 257 | ||
258 | #[cfg(test)] | 258 | #[cfg(test)] |
259 | mod tests { | 259 | mod tests { |
260 | use super::*; | 260 | use super::*; |
261 | 261 | ||
262 | #[test] | 262 | #[test] |
263 | fn test_caller() { | 263 | fn test_caller() { |
264 | callee(); | 264 | callee(); |
265 | } | 265 | } |
266 | } | 266 | } |
267 | "#, | 267 | "#, |
268 | "callee FN_DEF FileId(1) 0..14 3..9", | 268 | "callee FN_DEF FileId(1) 0..14 3..9", |
269 | &[ | 269 | &[ |
270 | "caller1 FN_DEF FileId(1) 15..45 18..25 : [34..40]", | 270 | "caller1 FN_DEF FileId(1) 15..45 18..25 : [34..40]", |
271 | "test_caller FN_DEF FileId(1) 93..147 108..119 : [132..138]", | 271 | "test_caller FN_DEF FileId(1) 95..149 110..121 : [134..140]", |
272 | ], | 272 | ], |
273 | &[], | 273 | &[], |
274 | ); | 274 | ); |
@@ -278,19 +278,19 @@ mod tests { | |||
278 | fn test_call_hierarchy_in_different_files() { | 278 | fn test_call_hierarchy_in_different_files() { |
279 | check_hierarchy( | 279 | check_hierarchy( |
280 | r#" | 280 | r#" |
281 | //- /lib.rs | 281 | //- /lib.rs |
282 | mod foo; | 282 | mod foo; |
283 | use foo::callee; | 283 | use foo::callee; |
284 | 284 | ||
285 | fn caller() { | 285 | fn caller() { |
286 | call<|>ee(); | 286 | call<|>ee(); |
287 | } | 287 | } |
288 | 288 | ||
289 | //- /foo/mod.rs | 289 | //- /foo/mod.rs |
290 | pub fn callee() {} | 290 | pub fn callee() {} |
291 | "#, | 291 | "#, |
292 | "callee FN_DEF FileId(2) 0..18 7..13", | 292 | "callee FN_DEF FileId(2) 0..18 7..13", |
293 | &["caller FN_DEF FileId(1) 26..55 29..35 : [44..50]"], | 293 | &["caller FN_DEF FileId(1) 27..56 30..36 : [45..51]"], |
294 | &[], | 294 | &[], |
295 | ); | 295 | ); |
296 | } | 296 | } |
@@ -299,13 +299,13 @@ mod tests { | |||
299 | fn test_call_hierarchy_outgoing() { | 299 | fn test_call_hierarchy_outgoing() { |
300 | check_hierarchy( | 300 | check_hierarchy( |
301 | r#" | 301 | r#" |
302 | //- /lib.rs | 302 | //- /lib.rs |
303 | fn callee() {} | 303 | fn callee() {} |
304 | fn call<|>er() { | 304 | fn call<|>er() { |
305 | callee(); | 305 | callee(); |
306 | callee(); | 306 | callee(); |
307 | } | 307 | } |
308 | "#, | 308 | "#, |
309 | "caller FN_DEF FileId(1) 15..58 18..24", | 309 | "caller FN_DEF FileId(1) 15..58 18..24", |
310 | &[], | 310 | &[], |
311 | &["callee FN_DEF FileId(1) 0..14 3..9 : [33..39, 47..53]"], | 311 | &["callee FN_DEF FileId(1) 0..14 3..9 : [33..39, 47..53]"], |
@@ -316,20 +316,20 @@ mod tests { | |||
316 | fn test_call_hierarchy_outgoing_in_different_files() { | 316 | fn test_call_hierarchy_outgoing_in_different_files() { |
317 | check_hierarchy( | 317 | check_hierarchy( |
318 | r#" | 318 | r#" |
319 | //- /lib.rs | 319 | //- /lib.rs |
320 | mod foo; | 320 | mod foo; |
321 | use foo::callee; | 321 | use foo::callee; |
322 | 322 | ||
323 | fn call<|>er() { | 323 | fn call<|>er() { |
324 | callee(); | 324 | callee(); |
325 | } | 325 | } |
326 | 326 | ||
327 | //- /foo/mod.rs | 327 | //- /foo/mod.rs |
328 | pub fn callee() {} | 328 | pub fn callee() {} |
329 | "#, | 329 | "#, |
330 | "caller FN_DEF FileId(1) 26..55 29..35", | 330 | "caller FN_DEF FileId(1) 27..56 30..36", |
331 | &[], | 331 | &[], |
332 | &["callee FN_DEF FileId(2) 0..18 7..13 : [44..50]"], | 332 | &["callee FN_DEF FileId(2) 0..18 7..13 : [45..51]"], |
333 | ); | 333 | ); |
334 | } | 334 | } |
335 | 335 | ||
@@ -337,22 +337,22 @@ mod tests { | |||
337 | fn test_call_hierarchy_incoming_outgoing() { | 337 | fn test_call_hierarchy_incoming_outgoing() { |
338 | check_hierarchy( | 338 | check_hierarchy( |
339 | r#" | 339 | r#" |
340 | //- /lib.rs | 340 | //- /lib.rs |
341 | fn caller1() { | 341 | fn caller1() { |
342 | call<|>er2(); | 342 | call<|>er2(); |
343 | } | 343 | } |
344 | 344 | ||
345 | fn caller2() { | 345 | fn caller2() { |
346 | caller3(); | 346 | caller3(); |
347 | } | 347 | } |
348 | 348 | ||
349 | fn caller3() { | 349 | fn caller3() { |
350 | 350 | ||
351 | } | 351 | } |
352 | "#, | 352 | "#, |
353 | "caller2 FN_DEF FileId(1) 32..63 35..42", | 353 | "caller2 FN_DEF FileId(1) 33..64 36..43", |
354 | &["caller1 FN_DEF FileId(1) 0..31 3..10 : [19..26]"], | 354 | &["caller1 FN_DEF FileId(1) 0..31 3..10 : [19..26]"], |
355 | &["caller3 FN_DEF FileId(1) 64..80 67..74 : [51..58]"], | 355 | &["caller3 FN_DEF FileId(1) 66..83 69..76 : [52..59]"], |
356 | ); | 356 | ); |
357 | } | 357 | } |
358 | } | 358 | } |
diff --git a/crates/ra_ide/src/completion/complete_macro_in_item_position.rs b/crates/ra_ide/src/completion/complete_macro_in_item_position.rs index d9bb5fd25..4c33f41d4 100644 --- a/crates/ra_ide/src/completion/complete_macro_in_item_position.rs +++ b/crates/ra_ide/src/completion/complete_macro_in_item_position.rs | |||
@@ -42,8 +42,8 @@ mod tests { | |||
42 | [ | 42 | [ |
43 | CompletionItem { | 43 | CompletionItem { |
44 | label: "foo!(…)", | 44 | label: "foo!(…)", |
45 | source_range: 46..46, | 45 | source_range: 48..48, |
46 | delete: 46..46, | 46 | delete: 48..48, |
47 | insert: "foo!($0)", | 47 | insert: "foo!($0)", |
48 | kind: Macro, | 48 | kind: Macro, |
49 | detail: "macro_rules! foo", | 49 | detail: "macro_rules! foo", |
@@ -82,8 +82,8 @@ mod tests { | |||
82 | [ | 82 | [ |
83 | CompletionItem { | 83 | CompletionItem { |
84 | label: "vec![…]", | 84 | label: "vec![…]", |
85 | source_range: 280..280, | 85 | source_range: 282..282, |
86 | delete: 280..280, | 86 | delete: 282..282, |
87 | insert: "vec![$0]", | 87 | insert: "vec![$0]", |
88 | kind: Macro, | 88 | kind: Macro, |
89 | detail: "macro_rules! vec", | 89 | detail: "macro_rules! vec", |
@@ -119,8 +119,8 @@ mod tests { | |||
119 | [ | 119 | [ |
120 | CompletionItem { | 120 | CompletionItem { |
121 | label: "foo! {…}", | 121 | label: "foo! {…}", |
122 | source_range: 163..163, | 122 | source_range: 164..164, |
123 | delete: 163..163, | 123 | delete: 164..164, |
124 | insert: "foo! {$0}", | 124 | insert: "foo! {$0}", |
125 | kind: Macro, | 125 | kind: Macro, |
126 | detail: "macro_rules! foo", | 126 | detail: "macro_rules! foo", |
@@ -130,8 +130,8 @@ mod tests { | |||
130 | }, | 130 | }, |
131 | CompletionItem { | 131 | CompletionItem { |
132 | label: "main()", | 132 | label: "main()", |
133 | source_range: 163..163, | 133 | source_range: 164..164, |
134 | delete: 163..163, | 134 | delete: 164..164, |
135 | insert: "main()$0", | 135 | insert: "main()$0", |
136 | kind: Function, | 136 | kind: Function, |
137 | lookup: "main", | 137 | lookup: "main", |
diff --git a/crates/ra_ide/src/completion/complete_qualified_path.rs b/crates/ra_ide/src/completion/complete_qualified_path.rs index 02ac0166b..d3a1cbc1d 100644 --- a/crates/ra_ide/src/completion/complete_qualified_path.rs +++ b/crates/ra_ide/src/completion/complete_qualified_path.rs | |||
@@ -541,8 +541,8 @@ mod tests { | |||
541 | [ | 541 | [ |
542 | CompletionItem { | 542 | CompletionItem { |
543 | label: "m()", | 543 | label: "m()", |
544 | source_range: 100..100, | 544 | source_range: 102..102, |
545 | delete: 100..100, | 545 | delete: 102..102, |
546 | insert: "m()$0", | 546 | insert: "m()$0", |
547 | kind: Function, | 547 | kind: Function, |
548 | lookup: "m", | 548 | lookup: "m", |
@@ -577,8 +577,8 @@ mod tests { | |||
577 | [ | 577 | [ |
578 | CompletionItem { | 578 | CompletionItem { |
579 | label: "m()", | 579 | label: "m()", |
580 | source_range: 105..105, | 580 | source_range: 107..107, |
581 | delete: 105..105, | 581 | delete: 107..107, |
582 | insert: "m()$0", | 582 | insert: "m()$0", |
583 | kind: Method, | 583 | kind: Method, |
584 | lookup: "m", | 584 | lookup: "m", |
@@ -613,8 +613,8 @@ mod tests { | |||
613 | [ | 613 | [ |
614 | CompletionItem { | 614 | CompletionItem { |
615 | label: "C", | 615 | label: "C", |
616 | source_range: 107..107, | 616 | source_range: 109..109, |
617 | delete: 107..107, | 617 | delete: 109..109, |
618 | insert: "C", | 618 | insert: "C", |
619 | kind: Const, | 619 | kind: Const, |
620 | detail: "const C: i32 = 42;", | 620 | detail: "const C: i32 = 42;", |
@@ -648,8 +648,8 @@ mod tests { | |||
648 | [ | 648 | [ |
649 | CompletionItem { | 649 | CompletionItem { |
650 | label: "T", | 650 | label: "T", |
651 | source_range: 101..101, | 651 | source_range: 103..103, |
652 | delete: 101..101, | 652 | delete: 103..103, |
653 | insert: "T", | 653 | insert: "T", |
654 | kind: TypeAlias, | 654 | kind: TypeAlias, |
655 | detail: "type T = i32;", | 655 | detail: "type T = i32;", |
@@ -688,24 +688,24 @@ mod tests { | |||
688 | [ | 688 | [ |
689 | CompletionItem { | 689 | CompletionItem { |
690 | label: "PUBLIC_CONST", | 690 | label: "PUBLIC_CONST", |
691 | source_range: 302..302, | 691 | source_range: 304..304, |
692 | delete: 302..302, | 692 | delete: 304..304, |
693 | insert: "PUBLIC_CONST", | 693 | insert: "PUBLIC_CONST", |
694 | kind: Const, | 694 | kind: Const, |
695 | detail: "pub(super) const PUBLIC_CONST: u32 = 1;", | 695 | detail: "pub(super) const PUBLIC_CONST: u32 = 1;", |
696 | }, | 696 | }, |
697 | CompletionItem { | 697 | CompletionItem { |
698 | label: "PublicType", | 698 | label: "PublicType", |
699 | source_range: 302..302, | 699 | source_range: 304..304, |
700 | delete: 302..302, | 700 | delete: 304..304, |
701 | insert: "PublicType", | 701 | insert: "PublicType", |
702 | kind: TypeAlias, | 702 | kind: TypeAlias, |
703 | detail: "pub(super) type PublicType = u32;", | 703 | detail: "pub(super) type PublicType = u32;", |
704 | }, | 704 | }, |
705 | CompletionItem { | 705 | CompletionItem { |
706 | label: "public_method()", | 706 | label: "public_method()", |
707 | source_range: 302..302, | 707 | source_range: 304..304, |
708 | delete: 302..302, | 708 | delete: 304..304, |
709 | insert: "public_method()$0", | 709 | insert: "public_method()$0", |
710 | kind: Function, | 710 | kind: Function, |
711 | lookup: "public_method", | 711 | lookup: "public_method", |
@@ -737,8 +737,8 @@ mod tests { | |||
737 | [ | 737 | [ |
738 | CompletionItem { | 738 | CompletionItem { |
739 | label: "m()", | 739 | label: "m()", |
740 | source_range: 100..100, | 740 | source_range: 102..102, |
741 | delete: 100..100, | 741 | delete: 102..102, |
742 | insert: "m()$0", | 742 | insert: "m()$0", |
743 | kind: Function, | 743 | kind: Function, |
744 | lookup: "m", | 744 | lookup: "m", |
@@ -773,8 +773,8 @@ mod tests { | |||
773 | [ | 773 | [ |
774 | CompletionItem { | 774 | CompletionItem { |
775 | label: "m()", | 775 | label: "m()", |
776 | source_range: 101..101, | 776 | source_range: 103..103, |
777 | delete: 101..101, | 777 | delete: 103..103, |
778 | insert: "m()$0", | 778 | insert: "m()$0", |
779 | kind: Function, | 779 | kind: Function, |
780 | lookup: "m", | 780 | lookup: "m", |
@@ -834,8 +834,8 @@ mod tests { | |||
834 | [ | 834 | [ |
835 | CompletionItem { | 835 | CompletionItem { |
836 | label: "m()", | 836 | label: "m()", |
837 | source_range: 73..73, | 837 | source_range: 74..74, |
838 | delete: 73..73, | 838 | delete: 74..74, |
839 | insert: "m()$0", | 839 | insert: "m()$0", |
840 | kind: Function, | 840 | kind: Function, |
841 | lookup: "m", | 841 | lookup: "m", |
@@ -870,8 +870,8 @@ mod tests { | |||
870 | [ | 870 | [ |
871 | CompletionItem { | 871 | CompletionItem { |
872 | label: "m()", | 872 | label: "m()", |
873 | source_range: 99..99, | 873 | source_range: 101..101, |
874 | delete: 99..99, | 874 | delete: 101..101, |
875 | insert: "m()$0", | 875 | insert: "m()$0", |
876 | kind: Function, | 876 | kind: Function, |
877 | lookup: "m", | 877 | lookup: "m", |
@@ -906,8 +906,8 @@ mod tests { | |||
906 | [ | 906 | [ |
907 | CompletionItem { | 907 | CompletionItem { |
908 | label: "m()", | 908 | label: "m()", |
909 | source_range: 110..110, | 909 | source_range: 112..112, |
910 | delete: 110..110, | 910 | delete: 112..112, |
911 | insert: "m()$0", | 911 | insert: "m()$0", |
912 | kind: Function, | 912 | kind: Function, |
913 | lookup: "m", | 913 | lookup: "m", |
@@ -950,40 +950,40 @@ mod tests { | |||
950 | [ | 950 | [ |
951 | CompletionItem { | 951 | CompletionItem { |
952 | label: "C2", | 952 | label: "C2", |
953 | source_range: 219..219, | 953 | source_range: 221..221, |
954 | delete: 219..219, | 954 | delete: 221..221, |
955 | insert: "C2", | 955 | insert: "C2", |
956 | kind: Const, | 956 | kind: Const, |
957 | detail: "const C2: ();", | 957 | detail: "const C2: ();", |
958 | }, | 958 | }, |
959 | CompletionItem { | 959 | CompletionItem { |
960 | label: "CONST", | 960 | label: "CONST", |
961 | source_range: 219..219, | 961 | source_range: 221..221, |
962 | delete: 219..219, | 962 | delete: 221..221, |
963 | insert: "CONST", | 963 | insert: "CONST", |
964 | kind: Const, | 964 | kind: Const, |
965 | detail: "const CONST: u8;", | 965 | detail: "const CONST: u8;", |
966 | }, | 966 | }, |
967 | CompletionItem { | 967 | CompletionItem { |
968 | label: "SubTy", | 968 | label: "SubTy", |
969 | source_range: 219..219, | 969 | source_range: 221..221, |
970 | delete: 219..219, | 970 | delete: 221..221, |
971 | insert: "SubTy", | 971 | insert: "SubTy", |
972 | kind: TypeAlias, | 972 | kind: TypeAlias, |
973 | detail: "type SubTy;", | 973 | detail: "type SubTy;", |
974 | }, | 974 | }, |
975 | CompletionItem { | 975 | CompletionItem { |
976 | label: "Ty", | 976 | label: "Ty", |
977 | source_range: 219..219, | 977 | source_range: 221..221, |
978 | delete: 219..219, | 978 | delete: 221..221, |
979 | insert: "Ty", | 979 | insert: "Ty", |
980 | kind: TypeAlias, | 980 | kind: TypeAlias, |
981 | detail: "type Ty;", | 981 | detail: "type Ty;", |
982 | }, | 982 | }, |
983 | CompletionItem { | 983 | CompletionItem { |
984 | label: "func()", | 984 | label: "func()", |
985 | source_range: 219..219, | 985 | source_range: 221..221, |
986 | delete: 219..219, | 986 | delete: 221..221, |
987 | insert: "func()$0", | 987 | insert: "func()$0", |
988 | kind: Function, | 988 | kind: Function, |
989 | lookup: "func", | 989 | lookup: "func", |
@@ -991,8 +991,8 @@ mod tests { | |||
991 | }, | 991 | }, |
992 | CompletionItem { | 992 | CompletionItem { |
993 | label: "method()", | 993 | label: "method()", |
994 | source_range: 219..219, | 994 | source_range: 221..221, |
995 | delete: 219..219, | 995 | delete: 221..221, |
996 | insert: "method()$0", | 996 | insert: "method()$0", |
997 | kind: Method, | 997 | kind: Method, |
998 | lookup: "method", | 998 | lookup: "method", |
@@ -1000,8 +1000,8 @@ mod tests { | |||
1000 | }, | 1000 | }, |
1001 | CompletionItem { | 1001 | CompletionItem { |
1002 | label: "subfunc()", | 1002 | label: "subfunc()", |
1003 | source_range: 219..219, | 1003 | source_range: 221..221, |
1004 | delete: 219..219, | 1004 | delete: 221..221, |
1005 | insert: "subfunc()$0", | 1005 | insert: "subfunc()$0", |
1006 | kind: Function, | 1006 | kind: Function, |
1007 | lookup: "subfunc", | 1007 | lookup: "subfunc", |
@@ -1009,8 +1009,8 @@ mod tests { | |||
1009 | }, | 1009 | }, |
1010 | CompletionItem { | 1010 | CompletionItem { |
1011 | label: "submethod()", | 1011 | label: "submethod()", |
1012 | source_range: 219..219, | 1012 | source_range: 221..221, |
1013 | delete: 219..219, | 1013 | delete: 221..221, |
1014 | insert: "submethod()$0", | 1014 | insert: "submethod()$0", |
1015 | kind: Method, | 1015 | kind: Method, |
1016 | lookup: "submethod", | 1016 | lookup: "submethod", |
@@ -1055,40 +1055,40 @@ mod tests { | |||
1055 | [ | 1055 | [ |
1056 | CompletionItem { | 1056 | CompletionItem { |
1057 | label: "C2", | 1057 | label: "C2", |
1058 | source_range: 365..365, | 1058 | source_range: 367..367, |
1059 | delete: 365..365, | 1059 | delete: 367..367, |
1060 | insert: "C2", | 1060 | insert: "C2", |
1061 | kind: Const, | 1061 | kind: Const, |
1062 | detail: "const C2: () = ();", | 1062 | detail: "const C2: () = ();", |
1063 | }, | 1063 | }, |
1064 | CompletionItem { | 1064 | CompletionItem { |
1065 | label: "CONST", | 1065 | label: "CONST", |
1066 | source_range: 365..365, | 1066 | source_range: 367..367, |
1067 | delete: 365..365, | 1067 | delete: 367..367, |
1068 | insert: "CONST", | 1068 | insert: "CONST", |
1069 | kind: Const, | 1069 | kind: Const, |
1070 | detail: "const CONST: u8 = 0;", | 1070 | detail: "const CONST: u8 = 0;", |
1071 | }, | 1071 | }, |
1072 | CompletionItem { | 1072 | CompletionItem { |
1073 | label: "SubTy", | 1073 | label: "SubTy", |
1074 | source_range: 365..365, | 1074 | source_range: 367..367, |
1075 | delete: 365..365, | 1075 | delete: 367..367, |
1076 | insert: "SubTy", | 1076 | insert: "SubTy", |
1077 | kind: TypeAlias, | 1077 | kind: TypeAlias, |
1078 | detail: "type SubTy;", | 1078 | detail: "type SubTy;", |
1079 | }, | 1079 | }, |
1080 | CompletionItem { | 1080 | CompletionItem { |
1081 | label: "Ty", | 1081 | label: "Ty", |
1082 | source_range: 365..365, | 1082 | source_range: 367..367, |
1083 | delete: 365..365, | 1083 | delete: 367..367, |
1084 | insert: "Ty", | 1084 | insert: "Ty", |
1085 | kind: TypeAlias, | 1085 | kind: TypeAlias, |
1086 | detail: "type Ty;", | 1086 | detail: "type Ty;", |
1087 | }, | 1087 | }, |
1088 | CompletionItem { | 1088 | CompletionItem { |
1089 | label: "func()", | 1089 | label: "func()", |
1090 | source_range: 365..365, | 1090 | source_range: 367..367, |
1091 | delete: 365..365, | 1091 | delete: 367..367, |
1092 | insert: "func()$0", | 1092 | insert: "func()$0", |
1093 | kind: Function, | 1093 | kind: Function, |
1094 | lookup: "func", | 1094 | lookup: "func", |
@@ -1096,8 +1096,8 @@ mod tests { | |||
1096 | }, | 1096 | }, |
1097 | CompletionItem { | 1097 | CompletionItem { |
1098 | label: "method()", | 1098 | label: "method()", |
1099 | source_range: 365..365, | 1099 | source_range: 367..367, |
1100 | delete: 365..365, | 1100 | delete: 367..367, |
1101 | insert: "method()$0", | 1101 | insert: "method()$0", |
1102 | kind: Method, | 1102 | kind: Method, |
1103 | lookup: "method", | 1103 | lookup: "method", |
@@ -1105,8 +1105,8 @@ mod tests { | |||
1105 | }, | 1105 | }, |
1106 | CompletionItem { | 1106 | CompletionItem { |
1107 | label: "subfunc()", | 1107 | label: "subfunc()", |
1108 | source_range: 365..365, | 1108 | source_range: 367..367, |
1109 | delete: 365..365, | 1109 | delete: 367..367, |
1110 | insert: "subfunc()$0", | 1110 | insert: "subfunc()$0", |
1111 | kind: Function, | 1111 | kind: Function, |
1112 | lookup: "subfunc", | 1112 | lookup: "subfunc", |
@@ -1114,8 +1114,8 @@ mod tests { | |||
1114 | }, | 1114 | }, |
1115 | CompletionItem { | 1115 | CompletionItem { |
1116 | label: "submethod()", | 1116 | label: "submethod()", |
1117 | source_range: 365..365, | 1117 | source_range: 367..367, |
1118 | delete: 365..365, | 1118 | delete: 367..367, |
1119 | insert: "submethod()$0", | 1119 | insert: "submethod()$0", |
1120 | kind: Method, | 1120 | kind: Method, |
1121 | lookup: "submethod", | 1121 | lookup: "submethod", |
diff --git a/crates/ra_ide/src/completion/complete_unqualified_path.rs b/crates/ra_ide/src/completion/complete_unqualified_path.rs index 68032c37e..aa2b07a2f 100644 --- a/crates/ra_ide/src/completion/complete_unqualified_path.rs +++ b/crates/ra_ide/src/completion/complete_unqualified_path.rs | |||
@@ -781,46 +781,46 @@ mod tests { | |||
781 | [ | 781 | [ |
782 | CompletionItem { | 782 | CompletionItem { |
783 | label: "bar!(…)", | 783 | label: "bar!(…)", |
784 | source_range: 252..252, | 784 | source_range: 256..256, |
785 | delete: 252..252, | 785 | delete: 256..256, |
786 | insert: "bar!($0)", | 786 | insert: "bar!($0)", |
787 | kind: Macro, | 787 | kind: Macro, |
788 | detail: "macro_rules! bar", | 788 | detail: "macro_rules! bar", |
789 | }, | 789 | }, |
790 | CompletionItem { | 790 | CompletionItem { |
791 | label: "baz!(…)", | 791 | label: "baz!(…)", |
792 | source_range: 252..252, | 792 | source_range: 256..256, |
793 | delete: 252..252, | 793 | delete: 256..256, |
794 | insert: "baz!($0)", | 794 | insert: "baz!($0)", |
795 | kind: Macro, | 795 | kind: Macro, |
796 | detail: "#[macro_export]\nmacro_rules! baz", | 796 | detail: "#[macro_export]\nmacro_rules! baz", |
797 | }, | 797 | }, |
798 | CompletionItem { | 798 | CompletionItem { |
799 | label: "foo!(…)", | 799 | label: "foo!(…)", |
800 | source_range: 252..252, | 800 | source_range: 256..256, |
801 | delete: 252..252, | 801 | delete: 256..256, |
802 | insert: "foo!($0)", | 802 | insert: "foo!($0)", |
803 | kind: Macro, | 803 | kind: Macro, |
804 | detail: "macro_rules! foo", | 804 | detail: "macro_rules! foo", |
805 | }, | 805 | }, |
806 | CompletionItem { | 806 | CompletionItem { |
807 | label: "m1", | 807 | label: "m1", |
808 | source_range: 252..252, | 808 | source_range: 256..256, |
809 | delete: 252..252, | 809 | delete: 256..256, |
810 | insert: "m1", | 810 | insert: "m1", |
811 | kind: Module, | 811 | kind: Module, |
812 | }, | 812 | }, |
813 | CompletionItem { | 813 | CompletionItem { |
814 | label: "m2", | 814 | label: "m2", |
815 | source_range: 252..252, | 815 | source_range: 256..256, |
816 | delete: 252..252, | 816 | delete: 256..256, |
817 | insert: "m2", | 817 | insert: "m2", |
818 | kind: Module, | 818 | kind: Module, |
819 | }, | 819 | }, |
820 | CompletionItem { | 820 | CompletionItem { |
821 | label: "main()", | 821 | label: "main()", |
822 | source_range: 252..252, | 822 | source_range: 256..256, |
823 | delete: 252..252, | 823 | delete: 256..256, |
824 | insert: "main()$0", | 824 | insert: "main()$0", |
825 | kind: Function, | 825 | kind: Function, |
826 | lookup: "main", | 826 | lookup: "main", |
@@ -850,16 +850,16 @@ mod tests { | |||
850 | [ | 850 | [ |
851 | CompletionItem { | 851 | CompletionItem { |
852 | label: "foo!(…)", | 852 | label: "foo!(…)", |
853 | source_range: 49..49, | 853 | source_range: 50..50, |
854 | delete: 49..49, | 854 | delete: 50..50, |
855 | insert: "foo!($0)", | 855 | insert: "foo!($0)", |
856 | kind: Macro, | 856 | kind: Macro, |
857 | detail: "macro_rules! foo", | 857 | detail: "macro_rules! foo", |
858 | }, | 858 | }, |
859 | CompletionItem { | 859 | CompletionItem { |
860 | label: "foo()", | 860 | label: "foo()", |
861 | source_range: 49..49, | 861 | source_range: 50..50, |
862 | delete: 49..49, | 862 | delete: 50..50, |
863 | insert: "foo()$0", | 863 | insert: "foo()$0", |
864 | kind: Function, | 864 | kind: Function, |
865 | lookup: "foo", | 865 | lookup: "foo", |
@@ -889,16 +889,16 @@ mod tests { | |||
889 | [ | 889 | [ |
890 | CompletionItem { | 890 | CompletionItem { |
891 | label: "foo!(…)", | 891 | label: "foo!(…)", |
892 | source_range: 57..57, | 892 | source_range: 58..58, |
893 | delete: 57..57, | 893 | delete: 58..58, |
894 | insert: "foo!($0)", | 894 | insert: "foo!($0)", |
895 | kind: Macro, | 895 | kind: Macro, |
896 | detail: "macro_rules! foo", | 896 | detail: "macro_rules! foo", |
897 | }, | 897 | }, |
898 | CompletionItem { | 898 | CompletionItem { |
899 | label: "main()", | 899 | label: "main()", |
900 | source_range: 57..57, | 900 | source_range: 58..58, |
901 | delete: 57..57, | 901 | delete: 58..58, |
902 | insert: "main()$0", | 902 | insert: "main()$0", |
903 | kind: Function, | 903 | kind: Function, |
904 | lookup: "main", | 904 | lookup: "main", |
@@ -928,16 +928,16 @@ mod tests { | |||
928 | [ | 928 | [ |
929 | CompletionItem { | 929 | CompletionItem { |
930 | label: "foo!(…)", | 930 | label: "foo!(…)", |
931 | source_range: 50..50, | 931 | source_range: 51..51, |
932 | delete: 50..50, | 932 | delete: 51..51, |
933 | insert: "foo!($0)", | 933 | insert: "foo!($0)", |
934 | kind: Macro, | 934 | kind: Macro, |
935 | detail: "macro_rules! foo", | 935 | detail: "macro_rules! foo", |
936 | }, | 936 | }, |
937 | CompletionItem { | 937 | CompletionItem { |
938 | label: "main()", | 938 | label: "main()", |
939 | source_range: 50..50, | 939 | source_range: 51..51, |
940 | delete: 50..50, | 940 | delete: 51..51, |
941 | insert: "main()$0", | 941 | insert: "main()$0", |
942 | kind: Function, | 942 | kind: Function, |
943 | lookup: "main", | 943 | lookup: "main", |
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index 9bde1db8e..8cb0700b9 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs | |||
@@ -283,7 +283,7 @@ fn check_struct_shorthand_initialization( | |||
283 | mod tests { | 283 | mod tests { |
284 | use insta::assert_debug_snapshot; | 284 | use insta::assert_debug_snapshot; |
285 | use ra_syntax::SourceFile; | 285 | use ra_syntax::SourceFile; |
286 | use stdx::SepBy; | 286 | use stdx::trim_indent; |
287 | use test_utils::assert_eq_text; | 287 | use test_utils::assert_eq_text; |
288 | 288 | ||
289 | use crate::mock_analysis::{analysis_and_position, single_file}; | 289 | use crate::mock_analysis::{analysis_and_position, single_file}; |
@@ -325,6 +325,8 @@ mod tests { | |||
325 | /// * this diagnostic touches the input cursor position | 325 | /// * this diagnostic touches the input cursor position |
326 | /// * that the contents of the file containing the cursor match `after` after the diagnostic fix is applied | 326 | /// * that the contents of the file containing the cursor match `after` after the diagnostic fix is applied |
327 | fn check_apply_diagnostic_fix_from_position(fixture: &str, after: &str) { | 327 | fn check_apply_diagnostic_fix_from_position(fixture: &str, after: &str) { |
328 | let after = trim_indent(after); | ||
329 | |||
328 | let (analysis, file_position) = analysis_and_position(fixture); | 330 | let (analysis, file_position) = analysis_and_position(fixture); |
329 | let diagnostic = analysis.diagnostics(file_position.file_id).unwrap().pop().unwrap(); | 331 | let diagnostic = analysis.diagnostics(file_position.file_id).unwrap().pop().unwrap(); |
330 | let mut fix = diagnostic.fix.unwrap(); | 332 | let mut fix = diagnostic.fix.unwrap(); |
@@ -336,21 +338,6 @@ mod tests { | |||
336 | actual | 338 | actual |
337 | }; | 339 | }; |
338 | 340 | ||
339 | // Strip indent and empty lines from `after`, to match the behaviour of | ||
340 | // `parse_fixture` called from `analysis_and_position`. | ||
341 | let margin = fixture | ||
342 | .lines() | ||
343 | .filter(|it| it.trim_start().starts_with("//-")) | ||
344 | .map(|it| it.len() - it.trim_start().len()) | ||
345 | .next() | ||
346 | .expect("empty fixture"); | ||
347 | let after = after | ||
348 | .lines() | ||
349 | .filter_map(|line| if line.len() > margin { Some(&line[margin..]) } else { None }) | ||
350 | .sep_by("\n") | ||
351 | .suffix("\n") | ||
352 | .to_string(); | ||
353 | |||
354 | assert_eq_text!(&after, &actual); | 341 | assert_eq_text!(&after, &actual); |
355 | assert!( | 342 | assert!( |
356 | diagnostic.range.start() <= file_position.offset | 343 | diagnostic.range.start() <= file_position.offset |
@@ -400,7 +387,6 @@ mod tests { | |||
400 | } | 387 | } |
401 | x / y<|> | 388 | x / y<|> |
402 | } | 389 | } |
403 | |||
404 | //- /core/lib.rs | 390 | //- /core/lib.rs |
405 | pub mod result { | 391 | pub mod result { |
406 | pub enum Result<T, E> { Ok(T), Err(E) } | 392 | pub enum Result<T, E> { Ok(T), Err(E) } |
@@ -431,7 +417,6 @@ mod tests { | |||
431 | } | 417 | } |
432 | <|>x | 418 | <|>x |
433 | } | 419 | } |
434 | |||
435 | //- /core/lib.rs | 420 | //- /core/lib.rs |
436 | pub mod result { | 421 | pub mod result { |
437 | pub enum Result<T, E> { Ok(T), Err(E) } | 422 | pub enum Result<T, E> { Ok(T), Err(E) } |
@@ -464,7 +449,6 @@ mod tests { | |||
464 | } | 449 | } |
465 | x <|>/ y | 450 | x <|>/ y |
466 | } | 451 | } |
467 | |||
468 | //- /core/lib.rs | 452 | //- /core/lib.rs |
469 | pub mod result { | 453 | pub mod result { |
470 | pub enum Result<T, E> { Ok(T), Err(E) } | 454 | pub enum Result<T, E> { Ok(T), Err(E) } |
@@ -474,6 +458,7 @@ mod tests { | |||
474 | use core::result::Result::{self, Ok, Err}; | 458 | use core::result::Result::{self, Ok, Err}; |
475 | 459 | ||
476 | type MyResult<T> = Result<T, ()>; | 460 | type MyResult<T> = Result<T, ()>; |
461 | |||
477 | fn div(x: i32, y: i32) -> MyResult<i32> { | 462 | fn div(x: i32, y: i32) -> MyResult<i32> { |
478 | if y == 0 { | 463 | if y == 0 { |
479 | return Err(()); | 464 | return Err(()); |
diff --git a/crates/ra_ide/src/display/function_signature.rs b/crates/ra_ide/src/display/function_signature.rs index ca8a6a650..a98264fb3 100644 --- a/crates/ra_ide/src/display/function_signature.rs +++ b/crates/ra_ide/src/display/function_signature.rs | |||
@@ -10,7 +10,7 @@ use std::{ | |||
10 | use hir::{Docs, Documentation, HasSource, HirDisplay}; | 10 | use hir::{Docs, Documentation, HasSource, HirDisplay}; |
11 | use ra_ide_db::RootDatabase; | 11 | use ra_ide_db::RootDatabase; |
12 | use ra_syntax::ast::{self, AstNode, NameOwner, VisibilityOwner}; | 12 | use ra_syntax::ast::{self, AstNode, NameOwner, VisibilityOwner}; |
13 | use stdx::{split1, SepBy}; | 13 | use stdx::{split_delim, SepBy}; |
14 | 14 | ||
15 | use crate::display::{generic_parameters, where_predicates}; | 15 | use crate::display::{generic_parameters, where_predicates}; |
16 | 16 | ||
@@ -210,7 +210,7 @@ impl From<&'_ ast::FnDef> for FunctionSignature { | |||
210 | // macro-generated functions are missing whitespace | 210 | // macro-generated functions are missing whitespace |
211 | fn fmt_param(param: ast::Param) -> String { | 211 | fn fmt_param(param: ast::Param) -> String { |
212 | let text = param.syntax().text().to_string(); | 212 | let text = param.syntax().text().to_string(); |
213 | match split1(&text, ':') { | 213 | match split_delim(&text, ':') { |
214 | Some((left, right)) => format!("{}: {}", left.trim(), right.trim()), | 214 | Some((left, right)) => format!("{}: {}", left.trim(), right.trim()), |
215 | _ => text, | 215 | _ => text, |
216 | } | 216 | } |
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs index 450ce0ba7..bea7fbfa7 100644 --- a/crates/ra_ide/src/goto_definition.rs +++ b/crates/ra_ide/src/goto_definition.rs | |||
@@ -192,27 +192,27 @@ mod tests { | |||
192 | #[test] | 192 | #[test] |
193 | fn goto_def_for_module_declaration() { | 193 | fn goto_def_for_module_declaration() { |
194 | check_goto( | 194 | check_goto( |
195 | " | 195 | r#" |
196 | //- /lib.rs | 196 | //- /lib.rs |
197 | mod <|>foo; | 197 | mod <|>foo; |
198 | 198 | ||
199 | //- /foo.rs | 199 | //- /foo.rs |
200 | // empty | 200 | // empty |
201 | ", | 201 | "#, |
202 | "foo SOURCE_FILE FileId(2) 0..10", | 202 | "foo SOURCE_FILE FileId(2) 0..9", |
203 | "// empty\n\n", | 203 | "// empty\n", |
204 | ); | 204 | ); |
205 | 205 | ||
206 | check_goto( | 206 | check_goto( |
207 | " | 207 | r#" |
208 | //- /lib.rs | 208 | //- /lib.rs |
209 | mod <|>foo; | 209 | mod <|>foo; |
210 | 210 | ||
211 | //- /foo/mod.rs | 211 | //- /foo/mod.rs |
212 | // empty | 212 | // empty |
213 | ", | 213 | "#, |
214 | "foo SOURCE_FILE FileId(2) 0..10", | 214 | "foo SOURCE_FILE FileId(2) 0..9", |
215 | "// empty\n\n", | 215 | "// empty\n", |
216 | ); | 216 | ); |
217 | } | 217 | } |
218 | 218 | ||
@@ -254,14 +254,14 @@ mod tests { | |||
254 | #[test] | 254 | #[test] |
255 | fn goto_def_for_use_alias() { | 255 | fn goto_def_for_use_alias() { |
256 | check_goto( | 256 | check_goto( |
257 | " | 257 | r#" |
258 | //- /lib.rs | 258 | //- /lib.rs |
259 | use foo as bar<|>; | 259 | use foo as bar<|>; |
260 | |||
261 | 260 | ||
262 | //- /foo/lib.rs | 261 | //- /foo/lib.rs |
263 | #[macro_export] | 262 | #[macro_export] |
264 | macro_rules! foo { () => { () } }", | 263 | macro_rules! foo { () => { () } } |
264 | "#, | ||
265 | "SOURCE_FILE FileId(2) 0..50", | 265 | "SOURCE_FILE FileId(2) 0..50", |
266 | "#[macro_export]\nmacro_rules! foo { () => { () } }\n", | 266 | "#[macro_export]\nmacro_rules! foo { () => { () } }\n", |
267 | ); | 267 | ); |
@@ -302,19 +302,19 @@ mod tests { | |||
302 | #[test] | 302 | #[test] |
303 | fn goto_def_for_macro_defined_fn_with_arg() { | 303 | fn goto_def_for_macro_defined_fn_with_arg() { |
304 | check_goto( | 304 | check_goto( |
305 | " | 305 | r#" |
306 | //- /lib.rs | 306 | //- /lib.rs |
307 | macro_rules! define_fn { | 307 | macro_rules! define_fn { |
308 | ($name:ident) => (fn $name() {}) | 308 | ($name:ident) => (fn $name() {}) |
309 | } | 309 | } |
310 | 310 | ||
311 | define_fn!(foo); | 311 | define_fn!(foo); |
312 | 312 | ||
313 | fn bar() { | 313 | fn bar() { |
314 | <|>foo(); | 314 | <|>foo(); |
315 | } | 315 | } |
316 | ", | 316 | "#, |
317 | "foo FN_DEF FileId(1) 64..80 75..78", | 317 | "foo FN_DEF FileId(1) 65..81 76..79", |
318 | "define_fn!(foo);|foo", | 318 | "define_fn!(foo);|foo", |
319 | ); | 319 | ); |
320 | } | 320 | } |
@@ -322,19 +322,19 @@ mod tests { | |||
322 | #[test] | 322 | #[test] |
323 | fn goto_def_for_macro_defined_fn_no_arg() { | 323 | fn goto_def_for_macro_defined_fn_no_arg() { |
324 | check_goto( | 324 | check_goto( |
325 | " | 325 | r#" |
326 | //- /lib.rs | 326 | //- /lib.rs |
327 | macro_rules! define_fn { | 327 | macro_rules! define_fn { |
328 | () => (fn foo() {}) | 328 | () => (fn foo() {}) |
329 | } | 329 | } |
330 | 330 | ||
331 | define_fn!(); | 331 | define_fn!(); |
332 | 332 | ||
333 | fn bar() { | 333 | fn bar() { |
334 | <|>foo(); | 334 | <|>foo(); |
335 | } | 335 | } |
336 | ", | 336 | "#, |
337 | "foo FN_DEF FileId(1) 51..64 51..64", | 337 | "foo FN_DEF FileId(1) 52..65 52..65", |
338 | "define_fn!();|define_fn!();", | 338 | "define_fn!();|define_fn!();", |
339 | ); | 339 | ); |
340 | } | 340 | } |
@@ -804,40 +804,40 @@ mod tests { | |||
804 | #[test] | 804 | #[test] |
805 | fn goto_within_macro() { | 805 | fn goto_within_macro() { |
806 | check_goto( | 806 | check_goto( |
807 | " | 807 | r#" |
808 | //- /lib.rs | 808 | //- /lib.rs |
809 | macro_rules! id { | 809 | macro_rules! id { |
810 | ($($tt:tt)*) => ($($tt)*) | 810 | ($($tt:tt)*) => ($($tt)*) |
811 | } | 811 | } |
812 | 812 | ||
813 | fn foo() { | 813 | fn foo() { |
814 | let x = 1; | 814 | let x = 1; |
815 | id!({ | 815 | id!({ |
816 | let y = <|>x; | 816 | let y = <|>x; |
817 | let z = y; | 817 | let z = y; |
818 | }); | 818 | }); |
819 | } | 819 | } |
820 | ", | 820 | "#, |
821 | "x BIND_PAT FileId(1) 69..70", | 821 | "x BIND_PAT FileId(1) 70..71", |
822 | "x", | 822 | "x", |
823 | ); | 823 | ); |
824 | 824 | ||
825 | check_goto( | 825 | check_goto( |
826 | " | 826 | r#" |
827 | //- /lib.rs | 827 | //- /lib.rs |
828 | macro_rules! id { | 828 | macro_rules! id { |
829 | ($($tt:tt)*) => ($($tt)*) | 829 | ($($tt:tt)*) => ($($tt)*) |
830 | } | 830 | } |
831 | 831 | ||
832 | fn foo() { | 832 | fn foo() { |
833 | let x = 1; | 833 | let x = 1; |
834 | id!({ | 834 | id!({ |
835 | let y = x; | 835 | let y = x; |
836 | let z = <|>y; | 836 | let z = <|>y; |
837 | }); | 837 | }); |
838 | } | 838 | } |
839 | ", | 839 | "#, |
840 | "y BIND_PAT FileId(1) 98..99", | 840 | "y BIND_PAT FileId(1) 99..100", |
841 | "y", | 841 | "y", |
842 | ); | 842 | ); |
843 | } | 843 | } |
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index d870e4cbc..a898f2e4a 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs | |||
@@ -2106,51 +2106,51 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
2106 | ); | 2106 | ); |
2107 | assert_debug_snapshot!(actions, | 2107 | assert_debug_snapshot!(actions, |
2108 | @r###" | 2108 | @r###" |
2109 | [ | 2109 | [ |
2110 | GoToType( | 2110 | GoToType( |
2111 | [ | 2111 | [ |
2112 | HoverGotoTypeData { | 2112 | HoverGotoTypeData { |
2113 | mod_path: "B", | 2113 | mod_path: "B", |
2114 | nav: NavigationTarget { | 2114 | nav: NavigationTarget { |
2115 | file_id: FileId( | 2115 | file_id: FileId( |
2116 | 1, | 2116 | 1, |
2117 | ), | 2117 | ), |
2118 | full_range: 41..54, | 2118 | full_range: 42..55, |
2119 | name: "B", | 2119 | name: "B", |
2120 | kind: STRUCT_DEF, | 2120 | kind: STRUCT_DEF, |
2121 | focus_range: Some( | 2121 | focus_range: Some( |
2122 | 48..49, | 2122 | 49..50, |
2123 | ), | 2123 | ), |
2124 | container_name: None, | 2124 | container_name: None, |
2125 | description: Some( | 2125 | description: Some( |
2126 | "struct B", | 2126 | "struct B", |
2127 | ), | 2127 | ), |
2128 | docs: None, | 2128 | docs: None, |
2129 | }, | ||
2130 | }, | 2129 | }, |
2131 | HoverGotoTypeData { | 2130 | }, |
2132 | mod_path: "Foo", | 2131 | HoverGotoTypeData { |
2133 | nav: NavigationTarget { | 2132 | mod_path: "Foo", |
2134 | file_id: FileId( | 2133 | nav: NavigationTarget { |
2135 | 1, | 2134 | file_id: FileId( |
2136 | ), | 2135 | 1, |
2137 | full_range: 0..12, | 2136 | ), |
2138 | name: "Foo", | 2137 | full_range: 0..12, |
2139 | kind: TRAIT_DEF, | 2138 | name: "Foo", |
2140 | focus_range: Some( | 2139 | kind: TRAIT_DEF, |
2141 | 6..9, | 2140 | focus_range: Some( |
2142 | ), | 2141 | 6..9, |
2143 | container_name: None, | 2142 | ), |
2144 | description: Some( | 2143 | container_name: None, |
2145 | "trait Foo", | 2144 | description: Some( |
2146 | ), | 2145 | "trait Foo", |
2147 | docs: None, | 2146 | ), |
2148 | }, | 2147 | docs: None, |
2149 | }, | 2148 | }, |
2150 | ], | 2149 | }, |
2151 | ), | 2150 | ], |
2152 | ] | 2151 | ), |
2153 | "###); | 2152 | ] |
2153 | "###); | ||
2154 | } | 2154 | } |
2155 | 2155 | ||
2156 | #[test] | 2156 | #[test] |
diff --git a/crates/ra_ide/src/mock_analysis.rs b/crates/ra_ide/src/mock_analysis.rs index 58fafecab..981bdf924 100644 --- a/crates/ra_ide/src/mock_analysis.rs +++ b/crates/ra_ide/src/mock_analysis.rs | |||
@@ -3,7 +3,7 @@ use std::{str::FromStr, sync::Arc}; | |||
3 | 3 | ||
4 | use ra_cfg::CfgOptions; | 4 | use ra_cfg::CfgOptions; |
5 | use ra_db::{CrateName, Env, FileSet, SourceRoot, VfsPath}; | 5 | use ra_db::{CrateName, Env, FileSet, SourceRoot, VfsPath}; |
6 | use test_utils::{extract_offset, extract_range, parse_fixture, FixtureEntry, CURSOR_MARKER}; | 6 | use test_utils::{extract_offset, extract_range, Fixture, CURSOR_MARKER}; |
7 | 7 | ||
8 | use crate::{ | 8 | use crate::{ |
9 | Analysis, AnalysisChange, AnalysisHost, CrateGraph, Edition, FileId, FilePosition, FileRange, | 9 | Analysis, AnalysisChange, AnalysisHost, CrateGraph, Edition, FileId, FilePosition, FileRange, |
@@ -12,7 +12,7 @@ use crate::{ | |||
12 | #[derive(Debug)] | 12 | #[derive(Debug)] |
13 | enum MockFileData { | 13 | enum MockFileData { |
14 | Plain { path: String, content: String }, | 14 | Plain { path: String, content: String }, |
15 | Fixture(FixtureEntry), | 15 | Fixture(Fixture), |
16 | } | 16 | } |
17 | 17 | ||
18 | impl MockFileData { | 18 | impl MockFileData { |
@@ -25,7 +25,7 @@ impl MockFileData { | |||
25 | fn path(&self) -> &str { | 25 | fn path(&self) -> &str { |
26 | match self { | 26 | match self { |
27 | MockFileData::Plain { path, .. } => path.as_str(), | 27 | MockFileData::Plain { path, .. } => path.as_str(), |
28 | MockFileData::Fixture(f) => f.meta.path(), | 28 | MockFileData::Fixture(f) => f.path.as_str(), |
29 | } | 29 | } |
30 | } | 30 | } |
31 | 31 | ||
@@ -39,7 +39,10 @@ impl MockFileData { | |||
39 | fn cfg_options(&self) -> CfgOptions { | 39 | fn cfg_options(&self) -> CfgOptions { |
40 | match self { | 40 | match self { |
41 | MockFileData::Fixture(f) => { | 41 | MockFileData::Fixture(f) => { |
42 | f.meta.cfg_options().map_or_else(Default::default, |o| o.clone()) | 42 | let mut cfg = CfgOptions::default(); |
43 | f.cfg_atoms.iter().for_each(|it| cfg.insert_atom(it.into())); | ||
44 | f.cfg_key_values.iter().for_each(|(k, v)| cfg.insert_key_value(k.into(), v.into())); | ||
45 | cfg | ||
43 | } | 46 | } |
44 | _ => CfgOptions::default(), | 47 | _ => CfgOptions::default(), |
45 | } | 48 | } |
@@ -48,7 +51,7 @@ impl MockFileData { | |||
48 | fn edition(&self) -> Edition { | 51 | fn edition(&self) -> Edition { |
49 | match self { | 52 | match self { |
50 | MockFileData::Fixture(f) => { | 53 | MockFileData::Fixture(f) => { |
51 | f.meta.edition().map_or(Edition::Edition2018, |v| Edition::from_str(v).unwrap()) | 54 | f.edition.as_ref().map_or(Edition::Edition2018, |v| Edition::from_str(&v).unwrap()) |
52 | } | 55 | } |
53 | _ => Edition::Edition2018, | 56 | _ => Edition::Edition2018, |
54 | } | 57 | } |
@@ -56,14 +59,14 @@ impl MockFileData { | |||
56 | 59 | ||
57 | fn env(&self) -> Env { | 60 | fn env(&self) -> Env { |
58 | match self { | 61 | match self { |
59 | MockFileData::Fixture(f) => Env::from(f.meta.env()), | 62 | MockFileData::Fixture(f) => Env::from(f.env.iter()), |
60 | _ => Env::default(), | 63 | _ => Env::default(), |
61 | } | 64 | } |
62 | } | 65 | } |
63 | } | 66 | } |
64 | 67 | ||
65 | impl From<FixtureEntry> for MockFileData { | 68 | impl From<Fixture> for MockFileData { |
66 | fn from(fixture: FixtureEntry) -> Self { | 69 | fn from(fixture: Fixture) -> Self { |
67 | Self::Fixture(fixture) | 70 | Self::Fixture(fixture) |
68 | } | 71 | } |
69 | } | 72 | } |
@@ -91,7 +94,7 @@ impl MockAnalysis { | |||
91 | /// ``` | 94 | /// ``` |
92 | pub fn with_files(fixture: &str) -> MockAnalysis { | 95 | pub fn with_files(fixture: &str) -> MockAnalysis { |
93 | let mut res = MockAnalysis::new(); | 96 | let mut res = MockAnalysis::new(); |
94 | for entry in parse_fixture(fixture) { | 97 | for entry in Fixture::parse(fixture) { |
95 | res.add_file_fixture(entry); | 98 | res.add_file_fixture(entry); |
96 | } | 99 | } |
97 | res | 100 | res |
@@ -102,7 +105,7 @@ impl MockAnalysis { | |||
102 | pub fn with_files_and_position(fixture: &str) -> (MockAnalysis, FilePosition) { | 105 | pub fn with_files_and_position(fixture: &str) -> (MockAnalysis, FilePosition) { |
103 | let mut position = None; | 106 | let mut position = None; |
104 | let mut res = MockAnalysis::new(); | 107 | let mut res = MockAnalysis::new(); |
105 | for entry in parse_fixture(fixture) { | 108 | for entry in Fixture::parse(fixture) { |
106 | if entry.text.contains(CURSOR_MARKER) { | 109 | if entry.text.contains(CURSOR_MARKER) { |
107 | assert!(position.is_none(), "only one marker (<|>) per fixture is allowed"); | 110 | assert!(position.is_none(), "only one marker (<|>) per fixture is allowed"); |
108 | position = Some(res.add_file_fixture_with_position(entry)); | 111 | position = Some(res.add_file_fixture_with_position(entry)); |
@@ -114,13 +117,13 @@ impl MockAnalysis { | |||
114 | (res, position) | 117 | (res, position) |
115 | } | 118 | } |
116 | 119 | ||
117 | pub fn add_file_fixture(&mut self, fixture: FixtureEntry) -> FileId { | 120 | pub fn add_file_fixture(&mut self, fixture: Fixture) -> FileId { |
118 | let file_id = self.next_id(); | 121 | let file_id = self.next_id(); |
119 | self.files.push(MockFileData::from(fixture)); | 122 | self.files.push(MockFileData::from(fixture)); |
120 | file_id | 123 | file_id |
121 | } | 124 | } |
122 | 125 | ||
123 | pub fn add_file_fixture_with_position(&mut self, mut fixture: FixtureEntry) -> FilePosition { | 126 | pub fn add_file_fixture_with_position(&mut self, mut fixture: Fixture) -> FilePosition { |
124 | let (offset, text) = extract_offset(&fixture.text); | 127 | let (offset, text) = extract_offset(&fixture.text); |
125 | fixture.text = text; | 128 | fixture.text = text; |
126 | let file_id = self.next_id(); | 129 | let file_id = self.next_id(); |
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index bb40d2043..4a96d6505 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs | |||
@@ -427,8 +427,8 @@ mod tests { | |||
427 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); | 427 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); |
428 | check_result( | 428 | check_result( |
429 | refs, | 429 | refs, |
430 | "Foo STRUCT_DEF FileId(2) 16..50 27..30 Other", | 430 | "Foo STRUCT_DEF FileId(2) 17..51 28..31 Other", |
431 | &["FileId(1) 52..55 StructLiteral", "FileId(3) 77..80 StructLiteral"], | 431 | &["FileId(1) 53..56 StructLiteral", "FileId(3) 79..82 StructLiteral"], |
432 | ); | 432 | ); |
433 | } | 433 | } |
434 | 434 | ||
@@ -455,7 +455,7 @@ mod tests { | |||
455 | 455 | ||
456 | let (analysis, pos) = analysis_and_position(code); | 456 | let (analysis, pos) = analysis_and_position(code); |
457 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); | 457 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); |
458 | check_result(refs, "foo SOURCE_FILE FileId(2) 0..35 Other", &["FileId(1) 13..16 Other"]); | 458 | check_result(refs, "foo SOURCE_FILE FileId(2) 0..35 Other", &["FileId(1) 14..17 Other"]); |
459 | } | 459 | } |
460 | 460 | ||
461 | #[test] | 461 | #[test] |
@@ -483,7 +483,7 @@ mod tests { | |||
483 | check_result( | 483 | check_result( |
484 | refs, | 484 | refs, |
485 | "Foo STRUCT_DEF FileId(3) 0..41 18..21 Other", | 485 | "Foo STRUCT_DEF FileId(3) 0..41 18..21 Other", |
486 | &["FileId(2) 20..23 Other", "FileId(2) 46..49 StructLiteral"], | 486 | &["FileId(2) 20..23 Other", "FileId(2) 47..50 StructLiteral"], |
487 | ); | 487 | ); |
488 | } | 488 | } |
489 | 489 | ||
@@ -510,7 +510,7 @@ mod tests { | |||
510 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); | 510 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); |
511 | check_result( | 511 | check_result( |
512 | refs, | 512 | refs, |
513 | "quux FN_DEF FileId(1) 18..34 25..29 Other", | 513 | "quux FN_DEF FileId(1) 19..35 26..30 Other", |
514 | &["FileId(2) 16..20 StructLiteral", "FileId(3) 16..20 StructLiteral"], | 514 | &["FileId(2) 16..20 StructLiteral", "FileId(3) 16..20 StructLiteral"], |
515 | ); | 515 | ); |
516 | 516 | ||
@@ -518,7 +518,7 @@ mod tests { | |||
518 | analysis.find_all_refs(pos, Some(SearchScope::single_file(bar))).unwrap().unwrap(); | 518 | analysis.find_all_refs(pos, Some(SearchScope::single_file(bar))).unwrap().unwrap(); |
519 | check_result( | 519 | check_result( |
520 | refs, | 520 | refs, |
521 | "quux FN_DEF FileId(1) 18..34 25..29 Other", | 521 | "quux FN_DEF FileId(1) 19..35 26..30 Other", |
522 | &["FileId(3) 16..20 StructLiteral"], | 522 | &["FileId(3) 16..20 StructLiteral"], |
523 | ); | 523 | ); |
524 | } | 524 | } |
@@ -637,8 +637,8 @@ mod tests { | |||
637 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); | 637 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); |
638 | check_result( | 638 | check_result( |
639 | refs, | 639 | refs, |
640 | "f FN_DEF FileId(1) 25..34 28..29 Other", | 640 | "f FN_DEF FileId(1) 26..35 29..30 Other", |
641 | &["FileId(2) 11..12 Other", "FileId(2) 27..28 StructLiteral"], | 641 | &["FileId(2) 11..12 Other", "FileId(2) 28..29 StructLiteral"], |
642 | ); | 642 | ); |
643 | } | 643 | } |
644 | 644 | ||
diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs index 8105ef373..f569a3f17 100644 --- a/crates/ra_ide/src/runnables.rs +++ b/crates/ra_ide/src/runnables.rs | |||
@@ -310,11 +310,11 @@ mod tests { | |||
310 | file_id: FileId( | 310 | file_id: FileId( |
311 | 1, | 311 | 1, |
312 | ), | 312 | ), |
313 | full_range: 22..46, | 313 | full_range: 23..47, |
314 | name: "test_foo", | 314 | name: "test_foo", |
315 | kind: FN_DEF, | 315 | kind: FN_DEF, |
316 | focus_range: Some( | 316 | focus_range: Some( |
317 | 33..41, | 317 | 34..42, |
318 | ), | 318 | ), |
319 | container_name: None, | 319 | container_name: None, |
320 | description: None, | 320 | description: None, |
@@ -335,11 +335,11 @@ mod tests { | |||
335 | file_id: FileId( | 335 | file_id: FileId( |
336 | 1, | 336 | 1, |
337 | ), | 337 | ), |
338 | full_range: 47..81, | 338 | full_range: 49..83, |
339 | name: "test_foo", | 339 | name: "test_foo", |
340 | kind: FN_DEF, | 340 | kind: FN_DEF, |
341 | focus_range: Some( | 341 | focus_range: Some( |
342 | 68..76, | 342 | 70..78, |
343 | ), | 343 | ), |
344 | container_name: None, | 344 | container_name: None, |
345 | description: None, | 345 | description: None, |
@@ -360,11 +360,11 @@ mod tests { | |||
360 | file_id: FileId( | 360 | file_id: FileId( |
361 | 1, | 361 | 1, |
362 | ), | 362 | ), |
363 | full_range: 82..104, | 363 | full_range: 85..107, |
364 | name: "bench", | 364 | name: "bench", |
365 | kind: FN_DEF, | 365 | kind: FN_DEF, |
366 | focus_range: Some( | 366 | focus_range: Some( |
367 | 94..99, | 367 | 97..102, |
368 | ), | 368 | ), |
369 | container_name: None, | 369 | container_name: None, |
370 | description: None, | 370 | description: None, |
@@ -424,7 +424,7 @@ mod tests { | |||
424 | file_id: FileId( | 424 | file_id: FileId( |
425 | 1, | 425 | 1, |
426 | ), | 426 | ), |
427 | full_range: 22..64, | 427 | full_range: 23..65, |
428 | name: "foo", | 428 | name: "foo", |
429 | kind: FN_DEF, | 429 | kind: FN_DEF, |
430 | focus_range: None, | 430 | focus_range: None, |
@@ -489,7 +489,7 @@ mod tests { | |||
489 | file_id: FileId( | 489 | file_id: FileId( |
490 | 1, | 490 | 1, |
491 | ), | 491 | ), |
492 | full_range: 51..105, | 492 | full_range: 52..106, |
493 | name: "foo", | 493 | name: "foo", |
494 | kind: FN_DEF, | 494 | kind: FN_DEF, |
495 | focus_range: None, | 495 | focus_range: None, |
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs index a44959abe..221b902b2 100644 --- a/crates/rust-analyzer/src/main_loop/handlers.rs +++ b/crates/rust-analyzer/src/main_loop/handlers.rs | |||
@@ -26,7 +26,7 @@ use ra_project_model::TargetKind; | |||
26 | use ra_syntax::{AstNode, SyntaxKind, TextRange, TextSize}; | 26 | use ra_syntax::{AstNode, SyntaxKind, TextRange, TextSize}; |
27 | use serde::{Deserialize, Serialize}; | 27 | use serde::{Deserialize, Serialize}; |
28 | use serde_json::to_value; | 28 | use serde_json::to_value; |
29 | use stdx::{format_to, split1}; | 29 | use stdx::{format_to, split_delim}; |
30 | 30 | ||
31 | use crate::{ | 31 | use crate::{ |
32 | cargo_target_spec::CargoTargetSpec, | 32 | cargo_target_spec::CargoTargetSpec, |
@@ -785,7 +785,7 @@ pub fn handle_resolve_code_action( | |||
785 | let frange = FileRange { file_id, range }; | 785 | let frange = FileRange { file_id, range }; |
786 | 786 | ||
787 | let assists = snap.analysis().resolved_assists(&snap.config.assist, frange)?; | 787 | let assists = snap.analysis().resolved_assists(&snap.config.assist, frange)?; |
788 | let (id_string, index) = split1(¶ms.id, ':').unwrap(); | 788 | let (id_string, index) = split_delim(¶ms.id, ':').unwrap(); |
789 | let index = index.parse::<usize>().unwrap(); | 789 | let index = index.parse::<usize>().unwrap(); |
790 | let assist = &assists[index]; | 790 | let assist = &assists[index]; |
791 | assert!(assist.assist.id.0 == id_string); | 791 | assert!(assist.assist.id.0 == id_string); |
diff --git a/crates/rust-analyzer/tests/heavy_tests/main.rs b/crates/rust-analyzer/tests/heavy_tests/main.rs index e0de377b4..58839b14a 100644 --- a/crates/rust-analyzer/tests/heavy_tests/main.rs +++ b/crates/rust-analyzer/tests/heavy_tests/main.rs | |||
@@ -178,14 +178,8 @@ fn main() {} | |||
178 | pub use std::collections::HashMap; | 178 | pub use std::collections::HashMap; |
179 | "#, | 179 | "#, |
180 | "range": { | 180 | "range": { |
181 | "end": { | 181 | "end": { "character": 0, "line": 6 }, |
182 | "character": 0, | 182 | "start": { "character": 0, "line": 0 } |
183 | "line": 7 | ||
184 | }, | ||
185 | "start": { | ||
186 | "character": 0, | ||
187 | "line": 0 | ||
188 | } | ||
189 | } | 183 | } |
190 | } | 184 | } |
191 | ]), | 185 | ]), |
@@ -244,14 +238,8 @@ fn main() {} | |||
244 | pub use std::collections::HashMap; | 238 | pub use std::collections::HashMap; |
245 | "#, | 239 | "#, |
246 | "range": { | 240 | "range": { |
247 | "end": { | 241 | "end": { "character": 0, "line": 9 }, |
248 | "character": 0, | 242 | "start": { "character": 0, "line": 0 } |
249 | "line": 10 | ||
250 | }, | ||
251 | "start": { | ||
252 | "character": 0, | ||
253 | "line": 0 | ||
254 | } | ||
255 | } | 243 | } |
256 | } | 244 | } |
257 | ]), | 245 | ]), |
diff --git a/crates/rust-analyzer/tests/heavy_tests/support.rs b/crates/rust-analyzer/tests/heavy_tests/support.rs index bb8585355..001a2a104 100644 --- a/crates/rust-analyzer/tests/heavy_tests/support.rs +++ b/crates/rust-analyzer/tests/heavy_tests/support.rs | |||
@@ -9,15 +9,13 @@ use std::{ | |||
9 | use crossbeam_channel::{after, select, Receiver}; | 9 | use crossbeam_channel::{after, select, Receiver}; |
10 | use lsp_server::{Connection, Message, Notification, Request}; | 10 | use lsp_server::{Connection, Message, Notification, Request}; |
11 | use lsp_types::{ | 11 | use lsp_types::{ |
12 | notification::{DidOpenTextDocument, Exit}, | 12 | notification::Exit, request::Shutdown, TextDocumentIdentifier, Url, WorkDoneProgress, |
13 | request::Shutdown, | ||
14 | DidOpenTextDocumentParams, TextDocumentIdentifier, TextDocumentItem, Url, WorkDoneProgress, | ||
15 | }; | 13 | }; |
16 | use lsp_types::{ProgressParams, ProgressParamsValue}; | 14 | use lsp_types::{ProgressParams, ProgressParamsValue}; |
17 | use serde::Serialize; | 15 | use serde::Serialize; |
18 | use serde_json::{to_string_pretty, Value}; | 16 | use serde_json::{to_string_pretty, Value}; |
19 | use tempfile::TempDir; | 17 | use tempfile::TempDir; |
20 | use test_utils::{find_mismatch, parse_fixture}; | 18 | use test_utils::{find_mismatch, Fixture}; |
21 | 19 | ||
22 | use ra_project_model::ProjectManifest; | 20 | use ra_project_model::ProjectManifest; |
23 | use rust_analyzer::{ | 21 | use rust_analyzer::{ |
@@ -66,13 +64,10 @@ impl<'a> Project<'a> { | |||
66 | ra_prof::init_from(crate::PROFILE); | 64 | ra_prof::init_from(crate::PROFILE); |
67 | }); | 65 | }); |
68 | 66 | ||
69 | let mut paths = vec![]; | 67 | for entry in Fixture::parse(self.fixture) { |
70 | 68 | let path = tmp_dir.path().join(&entry.path['/'.len_utf8()..]); | |
71 | for entry in parse_fixture(self.fixture) { | ||
72 | let path = tmp_dir.path().join(&entry.meta.path()['/'.len_utf8()..]); | ||
73 | fs::create_dir_all(path.parent().unwrap()).unwrap(); | 69 | fs::create_dir_all(path.parent().unwrap()).unwrap(); |
74 | fs::write(path.as_path(), entry.text.as_bytes()).unwrap(); | 70 | fs::write(path.as_path(), entry.text.as_bytes()).unwrap(); |
75 | paths.push((path, entry.text)); | ||
76 | } | 71 | } |
77 | 72 | ||
78 | let mut roots = | 73 | let mut roots = |
@@ -102,7 +97,7 @@ impl<'a> Project<'a> { | |||
102 | f(&mut config) | 97 | f(&mut config) |
103 | } | 98 | } |
104 | 99 | ||
105 | Server::new(tmp_dir, config, paths) | 100 | Server::new(tmp_dir, config) |
106 | } | 101 | } |
107 | } | 102 | } |
108 | 103 | ||
@@ -120,7 +115,7 @@ pub struct Server { | |||
120 | } | 115 | } |
121 | 116 | ||
122 | impl Server { | 117 | impl Server { |
123 | fn new(dir: TempDir, config: Config, files: Vec<(PathBuf, String)>) -> Server { | 118 | fn new(dir: TempDir, config: Config) -> Server { |
124 | let (connection, client) = Connection::memory(); | 119 | let (connection, client) = Connection::memory(); |
125 | 120 | ||
126 | let _thread = jod_thread::Builder::new() | 121 | let _thread = jod_thread::Builder::new() |
@@ -128,20 +123,7 @@ impl Server { | |||
128 | .spawn(move || main_loop(config, connection).unwrap()) | 123 | .spawn(move || main_loop(config, connection).unwrap()) |
129 | .expect("failed to spawn a thread"); | 124 | .expect("failed to spawn a thread"); |
130 | 125 | ||
131 | let res = | 126 | Server { req_id: Cell::new(1), dir, messages: Default::default(), client, _thread } |
132 | Server { req_id: Cell::new(1), dir, messages: Default::default(), client, _thread }; | ||
133 | |||
134 | for (path, text) in files { | ||
135 | res.notification::<DidOpenTextDocument>(DidOpenTextDocumentParams { | ||
136 | text_document: TextDocumentItem { | ||
137 | uri: Url::from_file_path(path).unwrap(), | ||
138 | language_id: "rust".to_string(), | ||
139 | version: 0, | ||
140 | text, | ||
141 | }, | ||
142 | }) | ||
143 | } | ||
144 | res | ||
145 | } | 127 | } |
146 | 128 | ||
147 | pub fn doc_id(&self, rel_path: &str) -> TextDocumentIdentifier { | 129 | pub fn doc_id(&self, rel_path: &str) -> TextDocumentIdentifier { |
diff --git a/crates/stdx/src/lib.rs b/crates/stdx/src/lib.rs index f2ff0e435..08ac6f70f 100644 --- a/crates/stdx/src/lib.rs +++ b/crates/stdx/src/lib.rs | |||
@@ -124,7 +124,89 @@ pub fn replace(buf: &mut String, from: char, to: &str) { | |||
124 | *buf = buf.replace(from, to) | 124 | *buf = buf.replace(from, to) |
125 | } | 125 | } |
126 | 126 | ||
127 | pub fn split1(haystack: &str, delim: char) -> Option<(&str, &str)> { | 127 | pub fn split_delim(haystack: &str, delim: char) -> Option<(&str, &str)> { |
128 | let idx = haystack.find(delim)?; | 128 | let idx = haystack.find(delim)?; |
129 | Some((&haystack[..idx], &haystack[idx + delim.len_utf8()..])) | 129 | Some((&haystack[..idx], &haystack[idx + delim.len_utf8()..])) |
130 | } | 130 | } |
131 | |||
132 | pub fn trim_indent(mut text: &str) -> String { | ||
133 | if text.starts_with('\n') { | ||
134 | text = &text[1..]; | ||
135 | } | ||
136 | let indent = text | ||
137 | .lines() | ||
138 | .filter(|it| !it.trim().is_empty()) | ||
139 | .map(|it| it.len() - it.trim_start().len()) | ||
140 | .min() | ||
141 | .unwrap_or(0); | ||
142 | lines_with_ends(text) | ||
143 | .map( | ||
144 | |line| { | ||
145 | if line.len() <= indent { | ||
146 | line.trim_start_matches(' ') | ||
147 | } else { | ||
148 | &line[indent..] | ||
149 | } | ||
150 | }, | ||
151 | ) | ||
152 | .collect() | ||
153 | } | ||
154 | |||
155 | pub fn lines_with_ends(text: &str) -> LinesWithEnds { | ||
156 | LinesWithEnds { text } | ||
157 | } | ||
158 | |||
159 | pub struct LinesWithEnds<'a> { | ||
160 | text: &'a str, | ||
161 | } | ||
162 | |||
163 | impl<'a> Iterator for LinesWithEnds<'a> { | ||
164 | type Item = &'a str; | ||
165 | fn next(&mut self) -> Option<&'a str> { | ||
166 | if self.text.is_empty() { | ||
167 | return None; | ||
168 | } | ||
169 | let idx = self.text.find('\n').map_or(self.text.len(), |it| it + 1); | ||
170 | let (res, next) = self.text.split_at(idx); | ||
171 | self.text = next; | ||
172 | Some(res) | ||
173 | } | ||
174 | } | ||
175 | |||
176 | #[cfg(test)] | ||
177 | mod tests { | ||
178 | use super::*; | ||
179 | |||
180 | #[test] | ||
181 | fn test_trim_indent() { | ||
182 | assert_eq!(trim_indent(""), ""); | ||
183 | assert_eq!( | ||
184 | trim_indent( | ||
185 | " | ||
186 | hello | ||
187 | world | ||
188 | " | ||
189 | ), | ||
190 | "hello\nworld\n" | ||
191 | ); | ||
192 | assert_eq!( | ||
193 | trim_indent( | ||
194 | " | ||
195 | hello | ||
196 | world" | ||
197 | ), | ||
198 | "hello\nworld" | ||
199 | ); | ||
200 | assert_eq!(trim_indent(" hello\n world\n"), "hello\nworld\n"); | ||
201 | assert_eq!( | ||
202 | trim_indent( | ||
203 | " | ||
204 | fn main() { | ||
205 | return 92; | ||
206 | } | ||
207 | " | ||
208 | ), | ||
209 | "fn main() {\n return 92;\n}\n" | ||
210 | ); | ||
211 | } | ||
212 | } | ||
diff --git a/crates/test_utils/Cargo.toml b/crates/test_utils/Cargo.toml index afd2005f8..6821db1e8 100644 --- a/crates/test_utils/Cargo.toml +++ b/crates/test_utils/Cargo.toml | |||
@@ -8,10 +8,9 @@ authors = ["rust-analyzer developers"] | |||
8 | doctest = false | 8 | doctest = false |
9 | 9 | ||
10 | [dependencies] | 10 | [dependencies] |
11 | # Avoid adding deps here, this crate is widely used in tests it should compile fast! | ||
11 | difference = "2.0.0" | 12 | difference = "2.0.0" |
12 | text-size = "1.0.0" | 13 | text-size = "1.0.0" |
13 | serde_json = "1.0.48" | 14 | serde_json = "1.0.48" |
14 | rustc-hash = "1.1.0" | 15 | rustc-hash = "1.1.0" |
15 | |||
16 | ra_cfg = { path = "../ra_cfg" } | ||
17 | stdx = { path = "../stdx" } | 16 | stdx = { path = "../stdx" } |
diff --git a/crates/test_utils/src/fixture.rs b/crates/test_utils/src/fixture.rs new file mode 100644 index 000000000..7e93fbcd6 --- /dev/null +++ b/crates/test_utils/src/fixture.rs | |||
@@ -0,0 +1,142 @@ | |||
1 | //! Defines `Fixture` -- a convenient way to describe the initial state of | ||
2 | //! rust-analyzer database from a single string. | ||
3 | |||
4 | use rustc_hash::FxHashMap; | ||
5 | use stdx::{lines_with_ends, split_delim, trim_indent}; | ||
6 | |||
7 | #[derive(Debug, Eq, PartialEq)] | ||
8 | pub struct Fixture { | ||
9 | pub path: String, | ||
10 | pub text: String, | ||
11 | pub crate_name: Option<String>, | ||
12 | pub deps: Vec<String>, | ||
13 | pub cfg_atoms: Vec<String>, | ||
14 | pub cfg_key_values: Vec<(String, String)>, | ||
15 | pub edition: Option<String>, | ||
16 | pub env: FxHashMap<String, String>, | ||
17 | } | ||
18 | |||
19 | impl Fixture { | ||
20 | /// Parses text which looks like this: | ||
21 | /// | ||
22 | /// ```not_rust | ||
23 | /// //- some meta | ||
24 | /// line 1 | ||
25 | /// line 2 | ||
26 | /// // - other meta | ||
27 | /// ``` | ||
28 | pub fn parse(ra_fixture: &str) -> Vec<Fixture> { | ||
29 | let fixture = trim_indent(ra_fixture); | ||
30 | |||
31 | let mut res: Vec<Fixture> = Vec::new(); | ||
32 | |||
33 | let default = if ra_fixture.contains("//-") { None } else { Some("//- /main.rs") }; | ||
34 | |||
35 | for (ix, line) in default.into_iter().chain(lines_with_ends(&fixture)).enumerate() { | ||
36 | if line.contains("//-") { | ||
37 | assert!( | ||
38 | line.starts_with("//-"), | ||
39 | "Metadata line {} has invalid indentation. \ | ||
40 | All metadata lines need to have the same indentation.\n\ | ||
41 | The offending line: {:?}", | ||
42 | ix, | ||
43 | line | ||
44 | ); | ||
45 | } | ||
46 | |||
47 | if line.starts_with("//-") { | ||
48 | let meta = Fixture::parse_meta_line(line); | ||
49 | res.push(meta) | ||
50 | } else if let Some(entry) = res.last_mut() { | ||
51 | entry.text.push_str(line); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | res | ||
56 | } | ||
57 | |||
58 | //- /lib.rs crate:foo deps:bar,baz cfg:foo=a,bar=b env:OUTDIR=path/to,OTHER=foo | ||
59 | pub fn parse_meta_line(meta: &str) -> Fixture { | ||
60 | assert!(meta.starts_with("//-")); | ||
61 | let meta = meta["//-".len()..].trim(); | ||
62 | let components = meta.split_ascii_whitespace().collect::<Vec<_>>(); | ||
63 | |||
64 | let path = components[0].to_string(); | ||
65 | assert!(path.starts_with("/")); | ||
66 | |||
67 | let mut krate = None; | ||
68 | let mut deps = Vec::new(); | ||
69 | let mut edition = None; | ||
70 | let mut cfg_atoms = Vec::new(); | ||
71 | let mut cfg_key_values = Vec::new(); | ||
72 | let mut env = FxHashMap::default(); | ||
73 | for component in components[1..].iter() { | ||
74 | let (key, value) = split_delim(component, ':').unwrap(); | ||
75 | match key { | ||
76 | "crate" => krate = Some(value.to_string()), | ||
77 | "deps" => deps = value.split(',').map(|it| it.to_string()).collect(), | ||
78 | "edition" => edition = Some(value.to_string()), | ||
79 | "cfg" => { | ||
80 | for entry in value.split(',') { | ||
81 | match split_delim(entry, '=') { | ||
82 | Some((k, v)) => cfg_key_values.push((k.to_string(), v.to_string())), | ||
83 | None => cfg_atoms.push(entry.to_string()), | ||
84 | } | ||
85 | } | ||
86 | } | ||
87 | "env" => { | ||
88 | for key in value.split(',') { | ||
89 | if let Some((k, v)) = split_delim(key, '=') { | ||
90 | env.insert(k.into(), v.into()); | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | _ => panic!("bad component: {:?}", component), | ||
95 | } | ||
96 | } | ||
97 | |||
98 | Fixture { | ||
99 | path, | ||
100 | text: String::new(), | ||
101 | crate_name: krate, | ||
102 | deps, | ||
103 | cfg_atoms, | ||
104 | cfg_key_values, | ||
105 | edition, | ||
106 | env, | ||
107 | } | ||
108 | } | ||
109 | } | ||
110 | |||
111 | #[test] | ||
112 | #[should_panic] | ||
113 | fn parse_fixture_checks_further_indented_metadata() { | ||
114 | Fixture::parse( | ||
115 | r" | ||
116 | //- /lib.rs | ||
117 | mod bar; | ||
118 | |||
119 | fn foo() {} | ||
120 | //- /bar.rs | ||
121 | pub fn baz() {} | ||
122 | ", | ||
123 | ); | ||
124 | } | ||
125 | |||
126 | #[test] | ||
127 | fn parse_fixture_gets_full_meta() { | ||
128 | let parsed = Fixture::parse( | ||
129 | r" | ||
130 | //- /lib.rs crate:foo deps:bar,baz cfg:foo=a,bar=b,atom env:OUTDIR=path/to,OTHER=foo | ||
131 | mod m; | ||
132 | ", | ||
133 | ); | ||
134 | assert_eq!(1, parsed.len()); | ||
135 | |||
136 | let meta = &parsed[0]; | ||
137 | assert_eq!("mod m;\n", meta.text); | ||
138 | |||
139 | assert_eq!("foo", meta.crate_name.as_ref().unwrap()); | ||
140 | assert_eq!("/lib.rs", meta.path); | ||
141 | assert_eq!(2, meta.env.len()); | ||
142 | } | ||
diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs index fd917e43b..eaeeeb97b 100644 --- a/crates/test_utils/src/lib.rs +++ b/crates/test_utils/src/lib.rs | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #[macro_use] | 9 | #[macro_use] |
10 | pub mod mark; | 10 | pub mod mark; |
11 | mod fixture; | ||
11 | 12 | ||
12 | use std::{ | 13 | use std::{ |
13 | env, fs, | 14 | env, fs, |
@@ -15,13 +16,12 @@ use std::{ | |||
15 | }; | 16 | }; |
16 | 17 | ||
17 | use serde_json::Value; | 18 | use serde_json::Value; |
18 | use stdx::split1; | ||
19 | use text_size::{TextRange, TextSize}; | 19 | use text_size::{TextRange, TextSize}; |
20 | 20 | ||
21 | pub use ra_cfg::CfgOptions; | 21 | pub use difference::Changeset as __Changeset; |
22 | pub use rustc_hash::FxHashMap; | 22 | pub use rustc_hash::FxHashMap; |
23 | 23 | ||
24 | pub use difference::Changeset as __Changeset; | 24 | pub use crate::fixture::Fixture; |
25 | 25 | ||
26 | pub const CURSOR_MARKER: &str = "<|>"; | 26 | pub const CURSOR_MARKER: &str = "<|>"; |
27 | 27 | ||
@@ -43,7 +43,7 @@ macro_rules! assert_eq_text { | |||
43 | if left.trim() == right.trim() { | 43 | if left.trim() == right.trim() { |
44 | eprintln!("Left:\n{:?}\n\nRight:\n{:?}\n\nWhitespace difference\n", left, right); | 44 | eprintln!("Left:\n{:?}\n\nRight:\n{:?}\n\nWhitespace difference\n", left, right); |
45 | } else { | 45 | } else { |
46 | let changeset = $crate::__Changeset::new(right, left, "\n"); | 46 | let changeset = $crate::__Changeset::new(left, right, "\n"); |
47 | eprintln!("Left:\n{}\n\nRight:\n{}\n\nDiff:\n{}\n", left, right, changeset); | 47 | eprintln!("Left:\n{}\n\nRight:\n{}\n\nDiff:\n{}\n", left, right, changeset); |
48 | } | 48 | } |
49 | eprintln!($($tt)*); | 49 | eprintln!($($tt)*); |
@@ -97,7 +97,7 @@ impl From<RangeOrOffset> for TextRange { | |||
97 | fn from(selection: RangeOrOffset) -> Self { | 97 | fn from(selection: RangeOrOffset) -> Self { |
98 | match selection { | 98 | match selection { |
99 | RangeOrOffset::Range(it) => it, | 99 | RangeOrOffset::Range(it) => it, |
100 | RangeOrOffset::Offset(it) => TextRange::new(it, it), | 100 | RangeOrOffset::Offset(it) => TextRange::empty(it), |
101 | } | 101 | } |
102 | } | 102 | } |
103 | } | 103 | } |
@@ -159,291 +159,6 @@ pub fn add_cursor(text: &str, offset: TextSize) -> String { | |||
159 | res | 159 | res |
160 | } | 160 | } |
161 | 161 | ||
162 | #[derive(Debug, Eq, PartialEq)] | ||
163 | pub struct FixtureEntry { | ||
164 | pub meta: FixtureMeta, | ||
165 | pub text: String, | ||
166 | } | ||
167 | |||
168 | #[derive(Debug, Eq, PartialEq)] | ||
169 | pub enum FixtureMeta { | ||
170 | Root { path: String }, | ||
171 | File(FileMeta), | ||
172 | } | ||
173 | |||
174 | #[derive(Debug, Eq, PartialEq)] | ||
175 | pub struct FileMeta { | ||
176 | pub path: String, | ||
177 | pub crate_name: Option<String>, | ||
178 | pub deps: Vec<String>, | ||
179 | pub cfg: CfgOptions, | ||
180 | pub edition: Option<String>, | ||
181 | pub env: FxHashMap<String, String>, | ||
182 | } | ||
183 | |||
184 | impl FixtureMeta { | ||
185 | pub fn path(&self) -> &str { | ||
186 | match self { | ||
187 | FixtureMeta::Root { path } => &path, | ||
188 | FixtureMeta::File(f) => &f.path, | ||
189 | } | ||
190 | } | ||
191 | |||
192 | pub fn crate_name(&self) -> Option<&String> { | ||
193 | match self { | ||
194 | FixtureMeta::File(f) => f.crate_name.as_ref(), | ||
195 | _ => None, | ||
196 | } | ||
197 | } | ||
198 | |||
199 | pub fn cfg_options(&self) -> Option<&CfgOptions> { | ||
200 | match self { | ||
201 | FixtureMeta::File(f) => Some(&f.cfg), | ||
202 | _ => None, | ||
203 | } | ||
204 | } | ||
205 | |||
206 | pub fn edition(&self) -> Option<&String> { | ||
207 | match self { | ||
208 | FixtureMeta::File(f) => f.edition.as_ref(), | ||
209 | _ => None, | ||
210 | } | ||
211 | } | ||
212 | |||
213 | pub fn env(&self) -> impl Iterator<Item = (&String, &String)> { | ||
214 | struct EnvIter<'a> { | ||
215 | iter: Option<std::collections::hash_map::Iter<'a, String, String>>, | ||
216 | } | ||
217 | |||
218 | impl<'a> EnvIter<'a> { | ||
219 | fn new(meta: &'a FixtureMeta) -> Self { | ||
220 | Self { | ||
221 | iter: match meta { | ||
222 | FixtureMeta::File(f) => Some(f.env.iter()), | ||
223 | _ => None, | ||
224 | }, | ||
225 | } | ||
226 | } | ||
227 | } | ||
228 | |||
229 | impl<'a> Iterator for EnvIter<'a> { | ||
230 | type Item = (&'a String, &'a String); | ||
231 | fn next(&mut self) -> Option<Self::Item> { | ||
232 | self.iter.as_mut().and_then(|i| i.next()) | ||
233 | } | ||
234 | } | ||
235 | |||
236 | EnvIter::new(self) | ||
237 | } | ||
238 | } | ||
239 | |||
240 | /// Parses text which looks like this: | ||
241 | /// | ||
242 | /// ```not_rust | ||
243 | /// //- some meta | ||
244 | /// line 1 | ||
245 | /// line 2 | ||
246 | /// // - other meta | ||
247 | /// ``` | ||
248 | pub fn parse_fixture(ra_fixture: &str) -> Vec<FixtureEntry> { | ||
249 | let fixture = indent_first_line(ra_fixture); | ||
250 | let margin = fixture_margin(&fixture); | ||
251 | |||
252 | let mut lines = fixture | ||
253 | .split('\n') // don't use `.lines` to not drop `\r\n` | ||
254 | .enumerate() | ||
255 | .filter_map(|(ix, line)| { | ||
256 | if line.len() >= margin { | ||
257 | assert!(line[..margin].trim().is_empty()); | ||
258 | let line_content = &line[margin..]; | ||
259 | if !line_content.starts_with("//-") { | ||
260 | assert!( | ||
261 | !line_content.contains("//-"), | ||
262 | r#"Metadata line {} has invalid indentation. All metadata lines need to have the same indentation. | ||
263 | The offending line: {:?}"#, | ||
264 | ix, | ||
265 | line | ||
266 | ); | ||
267 | } | ||
268 | Some(line_content) | ||
269 | } else { | ||
270 | assert!(line.trim().is_empty()); | ||
271 | None | ||
272 | } | ||
273 | }); | ||
274 | |||
275 | let mut res: Vec<FixtureEntry> = Vec::new(); | ||
276 | for line in lines.by_ref() { | ||
277 | if line.starts_with("//-") { | ||
278 | let meta = line["//-".len()..].trim().to_string(); | ||
279 | let meta = parse_meta(&meta); | ||
280 | res.push(FixtureEntry { meta, text: String::new() }) | ||
281 | } else if let Some(entry) = res.last_mut() { | ||
282 | entry.text.push_str(line); | ||
283 | entry.text.push('\n'); | ||
284 | } | ||
285 | } | ||
286 | res | ||
287 | } | ||
288 | |||
289 | //- /lib.rs crate:foo deps:bar,baz cfg:foo=a,bar=b env:OUTDIR=path/to,OTHER=foo | ||
290 | fn parse_meta(meta: &str) -> FixtureMeta { | ||
291 | let components = meta.split_ascii_whitespace().collect::<Vec<_>>(); | ||
292 | |||
293 | if components[0] == "root" { | ||
294 | let path = components[1].to_string(); | ||
295 | assert!(path.starts_with("/") && path.ends_with("/")); | ||
296 | return FixtureMeta::Root { path }; | ||
297 | } | ||
298 | |||
299 | let path = components[0].to_string(); | ||
300 | assert!(path.starts_with("/")); | ||
301 | |||
302 | let mut krate = None; | ||
303 | let mut deps = Vec::new(); | ||
304 | let mut edition = None; | ||
305 | let mut cfg = CfgOptions::default(); | ||
306 | let mut env = FxHashMap::default(); | ||
307 | for component in components[1..].iter() { | ||
308 | let (key, value) = split1(component, ':').unwrap(); | ||
309 | match key { | ||
310 | "crate" => krate = Some(value.to_string()), | ||
311 | "deps" => deps = value.split(',').map(|it| it.to_string()).collect(), | ||
312 | "edition" => edition = Some(value.to_string()), | ||
313 | "cfg" => { | ||
314 | for key in value.split(',') { | ||
315 | match split1(key, '=') { | ||
316 | None => cfg.insert_atom(key.into()), | ||
317 | Some((k, v)) => cfg.insert_key_value(k.into(), v.into()), | ||
318 | } | ||
319 | } | ||
320 | } | ||
321 | "env" => { | ||
322 | for key in value.split(',') { | ||
323 | if let Some((k, v)) = split1(key, '=') { | ||
324 | env.insert(k.into(), v.into()); | ||
325 | } | ||
326 | } | ||
327 | } | ||
328 | _ => panic!("bad component: {:?}", component), | ||
329 | } | ||
330 | } | ||
331 | |||
332 | FixtureMeta::File(FileMeta { path, crate_name: krate, deps, edition, cfg, env }) | ||
333 | } | ||
334 | |||
335 | /// Adjusts the indentation of the first line to the minimum indentation of the rest of the lines. | ||
336 | /// This allows fixtures to start off in a different indentation, e.g. to align the first line with | ||
337 | /// the other lines visually: | ||
338 | /// ``` | ||
339 | /// let fixture = "//- /lib.rs | ||
340 | /// mod foo; | ||
341 | /// //- /foo.rs | ||
342 | /// fn bar() {} | ||
343 | /// "; | ||
344 | /// assert_eq!(fixture_margin(fixture), | ||
345 | /// " //- /lib.rs | ||
346 | /// mod foo; | ||
347 | /// //- /foo.rs | ||
348 | /// fn bar() {} | ||
349 | /// ") | ||
350 | /// ``` | ||
351 | fn indent_first_line(fixture: &str) -> String { | ||
352 | if fixture.is_empty() { | ||
353 | return String::new(); | ||
354 | } | ||
355 | let mut lines = fixture.lines(); | ||
356 | let first_line = lines.next().unwrap(); | ||
357 | if first_line.contains("//-") { | ||
358 | let rest = lines.collect::<Vec<_>>().join("\n"); | ||
359 | let fixed_margin = fixture_margin(&rest); | ||
360 | let fixed_indent = fixed_margin - indent_len(first_line); | ||
361 | format!("\n{}{}\n{}", " ".repeat(fixed_indent), first_line, rest) | ||
362 | } else { | ||
363 | fixture.to_owned() | ||
364 | } | ||
365 | } | ||
366 | |||
367 | fn fixture_margin(fixture: &str) -> usize { | ||
368 | fixture | ||
369 | .lines() | ||
370 | .filter(|it| it.trim_start().starts_with("//-")) | ||
371 | .map(indent_len) | ||
372 | .next() | ||
373 | .expect("empty fixture") | ||
374 | } | ||
375 | |||
376 | fn indent_len(s: &str) -> usize { | ||
377 | s.len() - s.trim_start().len() | ||
378 | } | ||
379 | |||
380 | #[test] | ||
381 | #[should_panic] | ||
382 | fn parse_fixture_checks_further_indented_metadata() { | ||
383 | parse_fixture( | ||
384 | r" | ||
385 | //- /lib.rs | ||
386 | mod bar; | ||
387 | |||
388 | fn foo() {} | ||
389 | //- /bar.rs | ||
390 | pub fn baz() {} | ||
391 | ", | ||
392 | ); | ||
393 | } | ||
394 | |||
395 | #[test] | ||
396 | fn parse_fixture_can_handle_dedented_first_line() { | ||
397 | let fixture = "//- /lib.rs | ||
398 | mod foo; | ||
399 | //- /foo.rs | ||
400 | struct Bar; | ||
401 | "; | ||
402 | assert_eq!( | ||
403 | parse_fixture(fixture), | ||
404 | parse_fixture( | ||
405 | "//- /lib.rs | ||
406 | mod foo; | ||
407 | //- /foo.rs | ||
408 | struct Bar; | ||
409 | " | ||
410 | ) | ||
411 | ) | ||
412 | } | ||
413 | |||
414 | #[test] | ||
415 | fn parse_fixture_gets_full_meta() { | ||
416 | let parsed = parse_fixture( | ||
417 | r" | ||
418 | //- /lib.rs crate:foo deps:bar,baz cfg:foo=a,bar=b,atom env:OUTDIR=path/to,OTHER=foo | ||
419 | mod m; | ||
420 | ", | ||
421 | ); | ||
422 | assert_eq!(1, parsed.len()); | ||
423 | |||
424 | let parsed = &parsed[0]; | ||
425 | assert_eq!("mod m;\n\n", parsed.text); | ||
426 | |||
427 | let meta = &parsed.meta; | ||
428 | assert_eq!("foo", meta.crate_name().unwrap()); | ||
429 | assert_eq!("/lib.rs", meta.path()); | ||
430 | assert!(meta.cfg_options().is_some()); | ||
431 | assert_eq!(2, meta.env().count()); | ||
432 | } | ||
433 | |||
434 | /// Same as `parse_fixture`, except it allow empty fixture | ||
435 | pub fn parse_single_fixture(ra_fixture: &str) -> Option<FixtureEntry> { | ||
436 | if !ra_fixture.lines().any(|it| it.trim_start().starts_with("//-")) { | ||
437 | return None; | ||
438 | } | ||
439 | |||
440 | let fixtures = parse_fixture(ra_fixture); | ||
441 | if fixtures.len() > 1 { | ||
442 | panic!("too many fixtures"); | ||
443 | } | ||
444 | fixtures.into_iter().nth(0) | ||
445 | } | ||
446 | |||
447 | // Comparison functionality borrowed from cargo: | 162 | // Comparison functionality borrowed from cargo: |
448 | 163 | ||
449 | /// Compare a line with an expected pattern. | 164 | /// Compare a line with an expected pattern. |