diff options
Diffstat (limited to 'crates/hir_ty/src/tests/patterns.rs')
-rw-r--r-- | crates/hir_ty/src/tests/patterns.rs | 76 |
1 files changed, 36 insertions, 40 deletions
diff --git a/crates/hir_ty/src/tests/patterns.rs b/crates/hir_ty/src/tests/patterns.rs index aa513c56d..5adbe9c45 100644 --- a/crates/hir_ty/src/tests/patterns.rs +++ b/crates/hir_ty/src/tests/patterns.rs | |||
@@ -571,48 +571,44 @@ fn main() { | |||
571 | fn match_ergonomics_in_closure_params() { | 571 | fn match_ergonomics_in_closure_params() { |
572 | check_infer( | 572 | check_infer( |
573 | r#" | 573 | r#" |
574 | #[lang = "fn_once"] | 574 | //- minicore: fn |
575 | trait FnOnce<Args> { | 575 | fn foo<T, U, F: FnOnce(T) -> U>(t: T, f: F) -> U { loop {} } |
576 | type Output; | ||
577 | } | ||
578 | |||
579 | fn foo<T, U, F: FnOnce(T) -> U>(t: T, f: F) -> U { loop {} } | ||
580 | 576 | ||
581 | fn test() { | 577 | fn test() { |
582 | foo(&(1, "a"), |&(x, y)| x); // normal, no match ergonomics | 578 | foo(&(1, "a"), |&(x, y)| x); // normal, no match ergonomics |
583 | foo(&(1, "a"), |(x, y)| x); | 579 | foo(&(1, "a"), |(x, y)| x); |
584 | } | 580 | } |
585 | "#, | 581 | "#, |
586 | expect![[r#" | 582 | expect![[r#" |
587 | 93..94 't': T | 583 | 32..33 't': T |
588 | 99..100 'f': F | 584 | 38..39 'f': F |
589 | 110..121 '{ loop {} }': U | 585 | 49..60 '{ loop {} }': U |
590 | 112..119 'loop {}': ! | 586 | 51..58 'loop {}': ! |
591 | 117..119 '{}': () | 587 | 56..58 '{}': () |
592 | 133..232 '{ ... x); }': () | 588 | 72..171 '{ ... x); }': () |
593 | 139..142 'foo': fn foo<&(i32, &str), i32, |&(i32, &str)| -> i32>(&(i32, &str), |&(i32, &str)| -> i32) -> i32 | 589 | 78..81 'foo': fn foo<&(i32, &str), i32, |&(i32, &str)| -> i32>(&(i32, &str), |&(i32, &str)| -> i32) -> i32 |
594 | 139..166 'foo(&(...y)| x)': i32 | 590 | 78..105 'foo(&(...y)| x)': i32 |
595 | 143..152 '&(1, "a")': &(i32, &str) | 591 | 82..91 '&(1, "a")': &(i32, &str) |
596 | 144..152 '(1, "a")': (i32, &str) | 592 | 83..91 '(1, "a")': (i32, &str) |
597 | 145..146 '1': i32 | 593 | 84..85 '1': i32 |
598 | 148..151 '"a"': &str | 594 | 87..90 '"a"': &str |
599 | 154..165 '|&(x, y)| x': |&(i32, &str)| -> i32 | 595 | 93..104 '|&(x, y)| x': |&(i32, &str)| -> i32 |
600 | 155..162 '&(x, y)': &(i32, &str) | 596 | 94..101 '&(x, y)': &(i32, &str) |
601 | 156..162 '(x, y)': (i32, &str) | 597 | 95..101 '(x, y)': (i32, &str) |
602 | 157..158 'x': i32 | 598 | 96..97 'x': i32 |
603 | 160..161 'y': &str | 599 | 99..100 'y': &str |
604 | 164..165 'x': i32 | 600 | 103..104 'x': i32 |
605 | 203..206 'foo': fn foo<&(i32, &str), &i32, |&(i32, &str)| -> &i32>(&(i32, &str), |&(i32, &str)| -> &i32) -> &i32 | 601 | 142..145 'foo': fn foo<&(i32, &str), &i32, |&(i32, &str)| -> &i32>(&(i32, &str), |&(i32, &str)| -> &i32) -> &i32 |
606 | 203..229 'foo(&(...y)| x)': &i32 | 602 | 142..168 'foo(&(...y)| x)': &i32 |
607 | 207..216 '&(1, "a")': &(i32, &str) | 603 | 146..155 '&(1, "a")': &(i32, &str) |
608 | 208..216 '(1, "a")': (i32, &str) | 604 | 147..155 '(1, "a")': (i32, &str) |
609 | 209..210 '1': i32 | 605 | 148..149 '1': i32 |
610 | 212..215 '"a"': &str | 606 | 151..154 '"a"': &str |
611 | 218..228 '|(x, y)| x': |&(i32, &str)| -> &i32 | 607 | 157..167 '|(x, y)| x': |&(i32, &str)| -> &i32 |
612 | 219..225 '(x, y)': (i32, &str) | 608 | 158..164 '(x, y)': (i32, &str) |
613 | 220..221 'x': &i32 | 609 | 159..160 'x': &i32 |
614 | 223..224 'y': &&str | 610 | 162..163 'y': &&str |
615 | 227..228 'x': &i32 | 611 | 166..167 'x': &i32 |
616 | "#]], | 612 | "#]], |
617 | ); | 613 | ); |
618 | } | 614 | } |