From 8a4d9bb80a484193dc24c474af30d0d0e091963b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 16 Jun 2021 10:48:07 +0300 Subject: internal: add fn to minicore --- crates/hir_ty/src/tests/patterns.rs | 76 ++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 40 deletions(-) (limited to 'crates/hir_ty/src/tests/patterns.rs') 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() { fn match_ergonomics_in_closure_params() { check_infer( r#" - #[lang = "fn_once"] - trait FnOnce { - type Output; - } - - fn foo U>(t: T, f: F) -> U { loop {} } +//- minicore: fn +fn foo U>(t: T, f: F) -> U { loop {} } - fn test() { - foo(&(1, "a"), |&(x, y)| x); // normal, no match ergonomics - foo(&(1, "a"), |(x, y)| x); - } - "#, +fn test() { + foo(&(1, "a"), |&(x, y)| x); // normal, no match ergonomics + foo(&(1, "a"), |(x, y)| x); +} +"#, expect![[r#" - 93..94 't': T - 99..100 'f': F - 110..121 '{ loop {} }': U - 112..119 'loop {}': ! - 117..119 '{}': () - 133..232 '{ ... x); }': () - 139..142 'foo': fn foo<&(i32, &str), i32, |&(i32, &str)| -> i32>(&(i32, &str), |&(i32, &str)| -> i32) -> i32 - 139..166 'foo(&(...y)| x)': i32 - 143..152 '&(1, "a")': &(i32, &str) - 144..152 '(1, "a")': (i32, &str) - 145..146 '1': i32 - 148..151 '"a"': &str - 154..165 '|&(x, y)| x': |&(i32, &str)| -> i32 - 155..162 '&(x, y)': &(i32, &str) - 156..162 '(x, y)': (i32, &str) - 157..158 'x': i32 - 160..161 'y': &str - 164..165 'x': i32 - 203..206 'foo': fn foo<&(i32, &str), &i32, |&(i32, &str)| -> &i32>(&(i32, &str), |&(i32, &str)| -> &i32) -> &i32 - 203..229 'foo(&(...y)| x)': &i32 - 207..216 '&(1, "a")': &(i32, &str) - 208..216 '(1, "a")': (i32, &str) - 209..210 '1': i32 - 212..215 '"a"': &str - 218..228 '|(x, y)| x': |&(i32, &str)| -> &i32 - 219..225 '(x, y)': (i32, &str) - 220..221 'x': &i32 - 223..224 'y': &&str - 227..228 'x': &i32 + 32..33 't': T + 38..39 'f': F + 49..60 '{ loop {} }': U + 51..58 'loop {}': ! + 56..58 '{}': () + 72..171 '{ ... x); }': () + 78..81 'foo': fn foo<&(i32, &str), i32, |&(i32, &str)| -> i32>(&(i32, &str), |&(i32, &str)| -> i32) -> i32 + 78..105 'foo(&(...y)| x)': i32 + 82..91 '&(1, "a")': &(i32, &str) + 83..91 '(1, "a")': (i32, &str) + 84..85 '1': i32 + 87..90 '"a"': &str + 93..104 '|&(x, y)| x': |&(i32, &str)| -> i32 + 94..101 '&(x, y)': &(i32, &str) + 95..101 '(x, y)': (i32, &str) + 96..97 'x': i32 + 99..100 'y': &str + 103..104 'x': i32 + 142..145 'foo': fn foo<&(i32, &str), &i32, |&(i32, &str)| -> &i32>(&(i32, &str), |&(i32, &str)| -> &i32) -> &i32 + 142..168 'foo(&(...y)| x)': &i32 + 146..155 '&(1, "a")': &(i32, &str) + 147..155 '(1, "a")': (i32, &str) + 148..149 '1': i32 + 151..154 '"a"': &str + 157..167 '|(x, y)| x': |&(i32, &str)| -> &i32 + 158..164 '(x, y)': (i32, &str) + 159..160 'x': &i32 + 162..163 'y': &&str + 166..167 'x': &i32 "#]], ); } -- cgit v1.2.3