From 604267088c9ef6afa021807b437dab22d72dfc99 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 16 Jun 2021 22:48:48 +0300 Subject: internal: add iterator to minicore --- crates/hir_ty/src/tests/regression.rs | 47 ++++++----------------------------- 1 file changed, 8 insertions(+), 39 deletions(-) (limited to 'crates/hir_ty') diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs index 1edec1615..e0ad41fb9 100644 --- a/crates/hir_ty/src/tests/regression.rs +++ b/crates/hir_ty/src/tests/regression.rs @@ -418,48 +418,17 @@ fn issue_2705() { fn issue_2683_chars_impl() { check_types( r#" -//- /main.rs crate:main deps:std +//- minicore: iterator +pub struct Chars<'a> {} +impl<'a> Iterator for Chars<'a> { + type Item = char; + fn next(&mut self) -> Option {} +} + fn test() { - let chars: std::str::Chars<'_>; + let chars: Chars<'_>; (chars.next(), chars.nth(1)); } //^ (Option, Option) - -//- /std.rs crate:std -#[prelude_import] -use self::prelude::rust_2018::*; -pub mod prelude { - pub mod rust_2018 { - pub use crate::iter::Iterator; - pub use crate::option::Option; - } -} - -pub mod iter { - pub use self::traits::Iterator; - pub mod traits { - pub use self::iterator::Iterator; - - pub mod iterator { - pub trait Iterator { - type Item; - fn next(&mut self) -> Option; - fn nth(&mut self, n: usize) -> Option {} - } - } - } -} - -pub mod option { - pub enum Option {} -} - -pub mod str { - pub struct Chars<'a> {} - impl<'a> Iterator for Chars<'a> { - type Item = char; - fn next(&mut self) -> Option {} - } -} "#, ); } -- cgit v1.2.3 From ee7b649d445b9c33486f3b5c3bef29bdb28124bc Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 16 Jun 2021 22:54:57 +0300 Subject: internal: switch some tests to minicore --- crates/hir_ty/src/tests/traits.rs | 16 +--------------- 1 file changed, 1 insertion(+), 15 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 065cca74f..22e0bfc49 100644 --- a/crates/hir_ty/src/tests/traits.rs +++ b/crates/hir_ty/src/tests/traits.rs @@ -1492,7 +1492,7 @@ fn test>(x: T, y: impl Trait) { fn impl_trait_assoc_binding_projection_bug() { check_types( r#" -//- /main.rs crate:main deps:std +//- minicore: iterator pub trait Language { type Kind; } @@ -1512,20 +1512,6 @@ fn api_walkthrough() { node.clone(); } //^ {unknown} } - -//- /std.rs crate:std -#[prelude_import] use iter::*; -mod iter { - trait IntoIterator { - type Item; - } - trait Iterator { - type Item; - } - impl IntoIterator for T { - type Item = ::Item; - } -} "#, ); } -- cgit v1.2.3