diff options
author | Aleksey Kladov <[email protected]> | 2021-06-16 20:48:48 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-06-16 20:48:48 +0100 |
commit | 604267088c9ef6afa021807b437dab22d72dfc99 (patch) | |
tree | a98a495f7d24f943541f50c8d21f22ff3460729d /crates/hir_ty | |
parent | 7ba5482a04e2534890b85cf832616a08c1b1bf21 (diff) |
internal: add iterator to minicore
Diffstat (limited to 'crates/hir_ty')
-rw-r--r-- | crates/hir_ty/src/tests/regression.rs | 47 |
1 files changed, 8 insertions, 39 deletions
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() { | |||
418 | fn issue_2683_chars_impl() { | 418 | fn issue_2683_chars_impl() { |
419 | check_types( | 419 | check_types( |
420 | r#" | 420 | r#" |
421 | //- /main.rs crate:main deps:std | 421 | //- minicore: iterator |
422 | pub struct Chars<'a> {} | ||
423 | impl<'a> Iterator for Chars<'a> { | ||
424 | type Item = char; | ||
425 | fn next(&mut self) -> Option<char> {} | ||
426 | } | ||
427 | |||
422 | fn test() { | 428 | fn test() { |
423 | let chars: std::str::Chars<'_>; | 429 | let chars: Chars<'_>; |
424 | (chars.next(), chars.nth(1)); | 430 | (chars.next(), chars.nth(1)); |
425 | } //^ (Option<char>, Option<char>) | 431 | } //^ (Option<char>, Option<char>) |
426 | |||
427 | //- /std.rs crate:std | ||
428 | #[prelude_import] | ||
429 | use self::prelude::rust_2018::*; | ||
430 | pub mod prelude { | ||
431 | pub mod rust_2018 { | ||
432 | pub use crate::iter::Iterator; | ||
433 | pub use crate::option::Option; | ||
434 | } | ||
435 | } | ||
436 | |||
437 | pub mod iter { | ||
438 | pub use self::traits::Iterator; | ||
439 | pub mod traits { | ||
440 | pub use self::iterator::Iterator; | ||
441 | |||
442 | pub mod iterator { | ||
443 | pub trait Iterator { | ||
444 | type Item; | ||
445 | fn next(&mut self) -> Option<Self::Item>; | ||
446 | fn nth(&mut self, n: usize) -> Option<Self::Item> {} | ||
447 | } | ||
448 | } | ||
449 | } | ||
450 | } | ||
451 | |||
452 | pub mod option { | ||
453 | pub enum Option<T> {} | ||
454 | } | ||
455 | |||
456 | pub mod str { | ||
457 | pub struct Chars<'a> {} | ||
458 | impl<'a> Iterator for Chars<'a> { | ||
459 | type Item = char; | ||
460 | fn next(&mut self) -> Option<char> {} | ||
461 | } | ||
462 | } | ||
463 | "#, | 432 | "#, |
464 | ); | 433 | ); |
465 | } | 434 | } |