From 8a4d9bb80a484193dc24c474af30d0d0e091963b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 16 Jun 2021 10:48:07 +0300 Subject: internal: add fn to minicore --- crates/test_utils/src/fixture.rs | 4 +++- crates/test_utils/src/minicore.rs | 28 +++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) (limited to 'crates/test_utils') diff --git a/crates/test_utils/src/fixture.rs b/crates/test_utils/src/fixture.rs index 313088c37..005a5c092 100644 --- a/crates/test_utils/src/fixture.rs +++ b/crates/test_utils/src/fixture.rs @@ -164,7 +164,9 @@ impl Fixture { let mut env = FxHashMap::default(); let mut introduce_new_source_root = false; for component in components[1..].iter() { - let (key, value) = component.split_once(':').unwrap(); + let (key, value) = component + .split_once(':') + .unwrap_or_else(|| panic!("invalid meta line: {:?}", meta)); match key { "crate" => krate = Some(value.to_string()), "deps" => deps = value.split(',').map(|it| it.to_string()).collect(), diff --git a/crates/test_utils/src/minicore.rs b/crates/test_utils/src/minicore.rs index 8555ff935..e04ca58d2 100644 --- a/crates/test_utils/src/minicore.rs +++ b/crates/test_utils/src/minicore.rs @@ -9,12 +9,13 @@ //! //! Available flags: //! sized: +//! unsize: sized +//! coerce_unsized: unsize //! slice: //! range: -//! unsize: sized //! deref: sized //! deref_mut: deref -//! coerce_unsized: unsize +//! fn: //! pin: //! future: pin //! option: @@ -74,7 +75,7 @@ pub mod ops { } pub use self::deref::Deref; pub use self::deref::DerefMut; //:deref_mut - // endregion:deref + // endregion:deref // region:range mod range { @@ -112,6 +113,26 @@ pub mod ops { pub use self::range::{Range, RangeFrom, RangeFull, RangeTo}; pub use self::range::{RangeInclusive, RangeToInclusive}; // endregion:range + + // region:fn + mod function { + #[lang = "fn"] + #[fundamental] + pub trait Fn: FnMut {} + + #[lang = "fn_mut"] + #[fundamental] + pub trait FnMut: FnOnce {} + + #[lang = "fn_once"] + #[fundamental] + pub trait FnOnce { + #[lang = "fn_once_output"] + type Output; + } + } + pub use self::function::{Fn, FnMut, FnOnce}; + // endregion:fn } // region:slice @@ -189,6 +210,7 @@ pub mod prelude { pub mod v1 { pub use crate::{ marker::Sized, // :sized + ops::{Fn, FnMut, FnOnce}, // :fn option::Option::{self, None, Some}, // :option result::Result::{self, Err, Ok}, // :result }; -- cgit v1.2.3