aboutsummaryrefslogtreecommitdiff
path: root/crates/test_utils/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-06-17 09:30:08 +0100
committerGitHub <[email protected]>2021-06-17 09:30:08 +0100
commitb5830fbf9222b9a83309dc61fe1df480b0c3b153 (patch)
treeb927b06a3f866f6ebac907d7714fa05af7422d4e /crates/test_utils/src
parent7b4f5c0262bbdf7e9db81734eb9c82dd04eb82cb (diff)
parentc42cdff3d2ed2e30add09dd0d602181b6f83534d (diff)
Merge #9306
9306: internal: minimize minicore r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/test_utils/src')
-rw-r--r--crates/test_utils/src/fixture.rs2
-rw-r--r--crates/test_utils/src/minicore.rs39
2 files changed, 40 insertions, 1 deletions
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 {
154 let components = meta.split_ascii_whitespace().collect::<Vec<_>>(); 154 let components = meta.split_ascii_whitespace().collect::<Vec<_>>();
155 155
156 let path = components[0].to_string(); 156 let path = components[0].to_string();
157 assert!(path.starts_with('/')); 157 assert!(path.starts_with('/'), "fixture path does not start with `/`: {:?}", path);
158 158
159 let mut krate = None; 159 let mut krate = None;
160 let mut deps = Vec::new(); 160 let mut deps = Vec::new();
diff --git a/crates/test_utils/src/minicore.rs b/crates/test_utils/src/minicore.rs
index 2f0da7fe5..e6d2301c7 100644
--- a/crates/test_utils/src/minicore.rs
+++ b/crates/test_utils/src/minicore.rs
@@ -21,6 +21,7 @@
21//! option: 21//! option:
22//! result: 22//! result:
23//! iterator: option 23//! iterator: option
24//! iterators: iterator
24 25
25pub mod marker { 26pub mod marker {
26 // region:sized 27 // region:sized
@@ -209,6 +210,7 @@ pub mod task {
209 210
210// region:iterator 211// region:iterator
211pub mod iter { 212pub mod iter {
213 // region:iterators
212 mod adapters { 214 mod adapters {
213 pub struct Take<I> { 215 pub struct Take<I> {
214 iter: I, 216 iter: I,
@@ -228,6 +230,29 @@ pub mod iter {
228 } 230 }
229 pub use self::adapters::Take; 231 pub use self::adapters::Take;
230 232
233 mod sources {
234 mod repeat {
235 pub fn repeat<T>(elt: T) -> Repeat<T> {
236 loop {}
237 }
238
239 pub struct Repeat<A> {
240 element: A,
241 }
242
243 impl<A> Iterator for Repeat<A> {
244 type Item = A;
245
246 fn next(&mut self) -> Option<A> {
247 loop {}
248 }
249 }
250 }
251 pub use self::repeat::{repeat, Repeat};
252 }
253 pub use self::sources::{repeat, Repeat};
254 // endregion:iterators
255
231 mod traits { 256 mod traits {
232 mod iterator { 257 mod iterator {
233 use super::super::Take; 258 use super::super::Take;
@@ -239,9 +264,23 @@ pub mod iter {
239 fn nth(&mut self, n: usize) -> Option<Self::Item> { 264 fn nth(&mut self, n: usize) -> Option<Self::Item> {
240 loop {} 265 loop {}
241 } 266 }
267 fn by_ref(&mut self) -> &mut Self
268 where
269 Self: Sized,
270 {
271 self
272 }
273 // region:iterators
242 fn take(self, n: usize) -> crate::iter::Take<Self> { 274 fn take(self, n: usize) -> crate::iter::Take<Self> {
243 loop {} 275 loop {}
244 } 276 }
277 // endregion:iterators
278 }
279 impl<I: Iterator + ?Sized> Iterator for &mut I {
280 type Item = I::Item;
281 fn next(&mut self) -> Option<I::Item> {
282 (**self).next()
283 }
245 } 284 }
246 } 285 }
247 pub use self::iterator::Iterator; 286 pub use self::iterator::Iterator;