From 991919e71f048f9321e702512248e11c6c5fef70 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 18 Jun 2021 22:37:03 +0300 Subject: internal: add index to minicore --- crates/hir_ty/src/tests/traits.rs | 45 ++++++--------------------------------- 1 file changed, 7 insertions(+), 38 deletions(-) (limited to 'crates/hir_ty') diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs index dd1ea817f..0b6a3a1e9 100644 --- a/crates/hir_ty/src/tests/traits.rs +++ b/crates/hir_ty/src/tests/traits.rs @@ -567,11 +567,11 @@ fn indexing_arrays() { fn infer_ops_index() { check_types( r#" -//- /main.rs crate:main deps:std +//- minicore: index struct Bar; struct Foo; -impl std::ops::Index for Bar { +impl core::ops::Index for Bar { type Output = Foo; } @@ -580,15 +580,6 @@ fn test() { let b = a[1u32]; b; } //^ Foo - -//- /std.rs crate:std -#[prelude_import] use ops::*; -mod ops { - #[lang = "index"] - pub trait Index { - type Output; - } -} "#, ); } @@ -597,16 +588,16 @@ mod ops { fn infer_ops_index_int() { check_types( r#" -//- /main.rs crate:main deps:std +//- minicore: index struct Bar; struct Foo; -impl std::ops::Index for Bar { +impl core::ops::Index for Bar { type Output = Foo; } struct Range; -impl std::ops::Index for Bar { +impl core::ops::Index for Bar { type Output = Bar; } @@ -616,15 +607,6 @@ fn test() { b; //^ Foo } - -//- /std.rs crate:std -#[prelude_import] use ops::*; -mod ops { - #[lang = "index"] - pub trait Index { - type Output; - } -} "#, ); } @@ -633,25 +615,12 @@ mod ops { fn infer_ops_index_autoderef() { check_types( r#" -//- /main.rs crate:main deps:std +//- minicore: index, slice fn test() { let a = &[1u32, 2, 3]; - let b = a[1u32]; + let b = a[1]; b; } //^ u32 - -//- /std.rs crate:std -impl ops::Index for [T] { - type Output = T; -} - -#[prelude_import] use ops::*; -mod ops { - #[lang = "index"] - pub trait Index { - type Output; - } -} "#, ); } -- cgit v1.2.3