From 2870d2bade94ae276cba56caf8c35feaacd49422 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 15 Jun 2021 22:59:51 +0300 Subject: internal: add option to minicore --- crates/test_utils/src/fixture.rs | 2 ++ crates/test_utils/src/minicore.rs | 18 +++++++++++++++++- 2 files changed, 19 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 779146084..6ba112de8 100644 --- a/crates/test_utils/src/fixture.rs +++ b/crates/test_utils/src/fixture.rs @@ -198,6 +198,7 @@ impl MiniCore { self.activated_flags.iter().any(|it| it == flag) } + #[track_caller] fn assert_valid_flag(&self, flag: &str) { if !self.valid_flags.iter().any(|it| it == flag) { panic!("invalid flag: {:?}, valid flags: {:?}", flag, self.valid_flags); @@ -299,6 +300,7 @@ impl MiniCore { let skip = if flag == "" { false } else { + assert!(!flag.starts_with(' '), "region marker starts with a space: {:?}", flag); self.assert_valid_flag(flag); !self.has_flag(flag) }; diff --git a/crates/test_utils/src/minicore.rs b/crates/test_utils/src/minicore.rs index 127d06e59..cb18c8796 100644 --- a/crates/test_utils/src/minicore.rs +++ b/crates/test_utils/src/minicore.rs @@ -16,6 +16,7 @@ //! coerce_unsized: unsize //! pin: //! future: pin +//! option: pub mod marker { // region:sized @@ -115,6 +116,17 @@ pub mod slice { } // endregion:slice +// region:option +pub mod option { + pub enum Option { + #[lang = "None"] + None, + #[lang = "Some"] + Some(T), + } +} +// endregion:option + // region:pin pub mod pin { #[lang = "pin"] @@ -127,7 +139,10 @@ pub mod pin { // region:future pub mod future { - use crate::{pin::Pin, task::{Poll, Context}}; + use crate::{ + pin::Pin, + task::{Context, Poll}, + }; #[lang = "future_trait"] pub trait Future { @@ -153,6 +168,7 @@ pub mod task { pub mod prelude { pub mod v1 { pub use crate::marker::Sized; // :sized + pub use crate::option::Option::{self, None, Some}; // :option } pub mod rust_2015 { -- cgit v1.2.3