We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3dae94b commit 1785493Copy full SHA for 1785493
crates/hir_ty/src/tests/method_resolution.rs
@@ -1283,6 +1283,35 @@ fn f() {
1283
);
1284
}
1285
1286
+#[test]
1287
+fn resolve_const_generic_array_methods() {
1288
+ check_types(
1289
+ r#"
1290
+#[lang = "array"]
1291
+impl<T, const N: usize> [T; N] {
1292
+ pub fn map<F, U>(self, f: F) -> [U; N]
1293
+ where
1294
+ F: FnMut(T) -> U,
1295
+ { loop {} }
1296
+}
1297
+
1298
+#[lang = "slice"]
1299
+impl<T> [T] {
1300
+ pub fn map<F, U>(self, f: F) -> &[U]
1301
1302
1303
1304
1305
1306
+fn f() {
1307
+ let v = [1, 2].map::<_, usize>(|x| -> x * 2);
1308
+ v;
1309
+ //^ [usize; _]
1310
1311
+ "#,
1312
+ );
1313
1314
1315
#[test]
1316
fn skip_array_during_method_dispatch() {
1317
check_types(
0 commit comments