From 9b3aa591cd0672e9b7bdf3e5aab630cd09a4d546 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 17 Jun 2021 11:18:37 +0300 Subject: internal: switch some tests to minicore --- crates/test_utils/src/fixture.rs | 2 +- crates/test_utils/src/minicore.rs | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) (limited to 'crates/test_utils/src') diff --git a/crates/test_utils/src/fixture.rs b/crates/test_utils/src/fixture.rs index 005a5c092..8d8f3b560 100644 --- a/crates/test_utils/src/fixture.rs +++ b/crates/test_utils/src/fixture.rs @@ -154,7 +154,7 @@ impl Fixture { let components = meta.split_ascii_whitespace().collect::>(); let path = components[0].to_string(); - assert!(path.starts_with('/')); + assert!(path.starts_with('/'), "fixture path does not start with `/`: {:?}", path); let mut krate = None; let mut deps = Vec::new(); diff --git a/crates/test_utils/src/minicore.rs b/crates/test_utils/src/minicore.rs index 2f0da7fe5..1a0573d7a 100644 --- a/crates/test_utils/src/minicore.rs +++ b/crates/test_utils/src/minicore.rs @@ -228,6 +228,28 @@ pub mod iter { } pub use self::adapters::Take; + mod sources { + mod repeat { + pub fn repeat(elt: T) -> Repeat { + loop {} + } + + pub struct Repeat { + element: A, + } + + impl Iterator for Repeat { + type Item = A; + + fn next(&mut self) -> Option { + loop {} + } + } + } + pub use self::repeat::{repeat, Repeat}; + } + pub use self::sources::{repeat, Repeat}; + mod traits { mod iterator { use super::super::Take; @@ -242,6 +264,18 @@ pub mod iter { fn take(self, n: usize) -> crate::iter::Take { loop {} } + fn by_ref(&mut self) -> &mut Self + where + Self: Sized, + { + self + } + } + impl Iterator for &mut I { + type Item = I::Item; + fn next(&mut self) -> Option { + (**self).next() + } } } pub use self::iterator::Iterator; -- cgit v1.2.3