MiniCore

Struct MiniCore 

Source
pub struct MiniCore { /* private fields */ }

Implementations§

Source§

impl MiniCore

Source

pub const RAW_SOURCE: &'static str = "//! This is a fixture we use for tests that need lang items.\n//!\n//! We want to include the minimal subset of core for each test, so this file\n//! supports \"conditional compilation\". Tests use the following syntax to include minicore:\n//!\n//! //- minicore: flag1, flag2\n//!\n//! We then strip all the code marked with other flags.\n//!\n//! Available flags:\n//! add:\n//! asm:\n//! assert:\n//! as_mut: sized\n//! as_ref: sized\n//! async_fn: fn, tuple, future, copy\n//! bool_impl: option, fn\n//! builtin_impls:\n//! borrow: sized\n//! borrow_mut: borrow\n//! cell: copy, drop\n//! clone: sized\n//! coerce_pointee: derive, sized, unsize, coerce_unsized, dispatch_from_dyn\n//! coerce_unsized: unsize\n//! concat:\n//! copy: clone\n//! default: sized\n//! deref_mut: deref\n//! deref: sized\n//! derive:\n//! discriminant:\n//! drop: sized\n//! env: option\n//! eq: sized\n//! error: fmt\n//! fmt: option, result, transmute, coerce_unsized, copy, clone, derive\n//! fmt_before_1_89_0: fmt\n//! fn: sized, tuple\n//! from: sized, result\n//! future: pin\n//! coroutine: pin\n//! dispatch_from_dyn: unsize, pin\n//! hash: sized\n//! include:\n//! index: sized\n//! infallible:\n//! int_impl: size_of, transmute\n//! iterator: option\n//! iterators: iterator, fn\n//! manually_drop: drop\n//! non_null:\n//! non_zero:\n//! option: panic\n//! ord: eq, option\n//! panic: fmt\n//! phantom_data:\n//! pin:\n//! pointee: copy, send, sync, ord, hash, unpin, phantom_data\n//! range:\n//! receiver: deref\n//! result:\n//! send: sized\n//! size_of: sized\n//! sized:\n//! slice:\n//! str:\n//! sync: sized\n//! transmute:\n//! try: infallible\n//! tuple:\n//! unpin: sized\n//! unsize: sized\n//! write: fmt\n//! todo: panic\n//! unimplemented: panic\n//! column:\n//! addr_of:\n//! offset_of:\n\n#![rustc_coherence_is_core]\n\npub mod marker {\n // region:sized\n #[lang = \"pointee_sized\"]\n #[fundamental]\n #[rustc_specialization_trait]\n #[rustc_coinductive]\n pub trait PointeeSized {}\n\n #[lang = \"meta_sized\"]\n #[fundamental]\n #[rustc_specialization_trait]\n #[rustc_coinductive]\n pub trait MetaSized: PointeeSized {}\n\n #[lang = \"sized\"]\n #[fundamental]\n #[rustc_specialization_trait]\n #[rustc_coinductive]\n pub trait Sized: MetaSized {}\n // endregion:sized\n\n // region:send\n pub unsafe auto trait Send {}\n\n impl<T: PointeeSized> !Send for *const T {}\n impl<T: PointeeSized> !Send for *mut T {}\n // region:sync\n unsafe impl<T: Sync + PointeeSized> Send for &T {}\n unsafe impl<T: Send + PointeeSized> Send for &mut T {}\n // endregion:sync\n // endregion:send\n\n // region:sync\n pub unsafe auto trait Sync {}\n\n impl<T: PointeeSized> !Sync for *const T {}\n impl<T: PointeeSized> !Sync for *mut T {}\n // endregion:sync\n\n // region:unsize\n #[lang = \"unsize\"]\n pub trait Unsize<T: PointeeSized>: PointeeSized {}\n // endregion:unsize\n\n // region:unpin\n #[lang = \"unpin\"]\n pub auto trait Unpin {}\n // endregion:unpin\n\n // region:copy\n #[lang = \"copy\"]\n pub trait Copy: Clone {}\n // region:derive\n #[rustc_builtin_macro]\n pub macro Copy($item:item) {}\n // endregion:derive\n\n mod copy_impls {\n use super::{Copy, PointeeSized};\n\n macro_rules! impl_copy {\n ($($t:ty)*) => {\n $(\n impl Copy for $t {}\n )*\n }\n }\n\n impl_copy! {\n usize u8 u16 u32 u64 u128\n isize i8 i16 i32 i64 i128\n f16 f32 f64 f128\n bool char\n }\n\n impl<T: PointeeSized> Copy for *const T {}\n impl<T: PointeeSized> Copy for *mut T {}\n impl<T: PointeeSized> Copy for &T {}\n impl Copy for ! {}\n }\n // endregion:copy\n\n // region:tuple\n #[lang = \"tuple_trait\"]\n pub trait Tuple {}\n // endregion:tuple\n\n // region:phantom_data\n #[lang = \"phantom_data\"]\n pub struct PhantomData<T: PointeeSized>;\n\n // region:clone\n impl<T: PointeeSized> Clone for PhantomData<T> {\n fn clone(&self) -> Self { Self }\n }\n // endregion:clone\n\n // region:copy\n impl<T: PointeeSized> Copy for PhantomData<T> {}\n // endregion:copy\n\n // endregion:phantom_data\n\n // region:discriminant\n #[lang = \"discriminant_kind\"]\n pub trait DiscriminantKind {\n #[lang = \"discriminant_type\"]\n type Discriminant;\n }\n // endregion:discriminant\n\n // region:coerce_pointee\n #[rustc_builtin_macro(CoercePointee, attributes(pointee))]\n #[allow_internal_unstable(dispatch_from_dyn, coerce_unsized, unsize)]\n pub macro CoercePointee($item:item) {\n /* compiler built-in */\n }\n // endregion:coerce_pointee\n}\n\n// region:default\npub mod default {\n pub trait Default: Sized {\n fn default() -> Self;\n }\n // region:derive\n #[rustc_builtin_macro(Default, attributes(default))]\n pub macro Default($item:item) {}\n // endregion:derive\n\n // region:builtin_impls\n macro_rules! impl_default {\n ($v:literal; $($t:ty)*) => {\n $(\n impl Default for $t {\n fn default() -> Self {\n $v\n }\n }\n )*\n }\n }\n\n impl_default! {\n 0; usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128\n }\n impl_default! {\n 0.0; f16 f32 f64 f128\n }\n // endregion:builtin_impls\n}\n// endregion:default\n\n// region:hash\npub mod hash {\n use crate::marker::PointeeSized;\n\n pub trait Hasher {}\n\n pub trait Hash: PointeeSized {\n fn hash<H: Hasher>(&self, state: &mut H);\n }\n\n // region:derive\n pub(crate) mod derive {\n #[rustc_builtin_macro]\n pub macro Hash($item:item) {}\n }\n pub use derive::Hash;\n // endregion:derive\n}\n// endregion:hash\n\n// region:cell\npub mod cell {\n use crate::marker::PointeeSized;\n use crate::mem;\n\n #[lang = \"unsafe_cell\"]\n pub struct UnsafeCell<T: PointeeSized> {\n value: T,\n }\n\n impl<T> UnsafeCell<T> {\n pub const fn new(value: T) -> UnsafeCell<T> {\n UnsafeCell { value }\n }\n\n pub const fn get(&self) -> *mut T {\n self as *const UnsafeCell<T> as *const T as *mut T\n }\n }\n\n pub struct Cell<T: PointeeSized> {\n value: UnsafeCell<T>,\n }\n\n impl<T> Cell<T> {\n pub const fn new(value: T) -> Cell<T> {\n Cell { value: UnsafeCell::new(value) }\n }\n\n pub fn set(&self, val: T) {\n let old = self.replace(val);\n mem::drop(old);\n }\n\n pub fn replace(&self, val: T) -> T {\n mem::replace(unsafe { &mut *self.value.get() }, val)\n }\n }\n\n impl<T: Copy> Cell<T> {\n pub fn get(&self) -> T {\n unsafe { *self.value.get() }\n }\n }\n}\n// endregion:cell\n\n// region:clone\npub mod clone {\n #[lang = \"clone\"]\n pub trait Clone: Sized {\n fn clone(&self) -> Self;\n }\n\n impl<T> Clone for &T {\n fn clone(&self) -> Self {\n *self\n }\n }\n\n // region:builtin_impls\n macro_rules! impl_clone {\n ($($t:ty)*) => {\n $(\n impl const Clone for $t {\n fn clone(&self) -> Self {\n *self\n }\n }\n )*\n }\n }\n\n impl_clone! {\n usize u8 u16 u32 u64 u128\n isize i8 i16 i32 i64 i128\n f16 f32 f64 f128\n bool char\n }\n\n impl Clone for ! {\n fn clone(&self) {\n *self\n }\n }\n\n impl<T: Clone> Clone for [T; 0] {\n fn clone(&self) -> Self {\n []\n }\n }\n\n impl<T: Clone> Clone for [T; 1] {\n fn clone(&self) -> Self {\n [self[0].clone()]\n }\n }\n // endregion:builtin_impls\n\n // region:derive\n #[rustc_builtin_macro]\n pub macro Clone($item:item) {}\n // endregion:derive\n}\n// endregion:clone\n\npub mod convert {\n // region:from\n pub trait From<T>: Sized {\n fn from(_: T) -> Self;\n }\n pub trait Into<T>: Sized {\n fn into(self) -> T;\n }\n\n impl<T, U> Into<U> for T\n where\n U: From<T>,\n {\n fn into(self) -> U {\n U::from(self)\n }\n }\n\n impl<T> From<T> for T {\n fn from(t: T) -> T {\n t\n }\n }\n\n pub trait TryFrom<T>: Sized {\n type Error;\n fn try_from(value: T) -> Result<Self, Self::Error>;\n }\n pub trait TryInto<T>: Sized {\n type Error;\n fn try_into(self) -> Result<T, Self::Error>;\n }\n\n impl<T, U> TryInto<U> for T\n where\n U: TryFrom<T>,\n {\n type Error = U::Error;\n fn try_into(self) -> Result<U, U::Error> {\n U::try_from(self)\n }\n }\n // endregion:from\n\n // region:as_ref\n pub trait AsRef<T: crate::marker::PointeeSized>: crate::marker::PointeeSized {\n fn as_ref(&self) -> &T;\n }\n // endregion:as_ref\n // region:as_mut\n pub trait AsMut<T: crate::marker::PointeeSized>: crate::marker::PointeeSized {\n fn as_mut(&mut self) -> &mut T;\n }\n // endregion:as_mut\n // region:infallible\n pub enum Infallible {}\n // endregion:infallible\n}\n\npub mod borrow {\n // region:borrow\n pub trait Borrow<Borrowed: ?Sized> {\n fn borrow(&self) -> &Borrowed;\n }\n // endregion:borrow\n\n // region:borrow_mut\n pub trait BorrowMut<Borrowed: ?Sized>: Borrow<Borrowed> {\n fn borrow_mut(&mut self) -> &mut Borrowed;\n }\n // endregion:borrow_mut\n}\n\npub mod mem {\n // region:manually_drop\n use crate::marker::PointeeSized;\n\n #[lang = \"manually_drop\"]\n #[repr(transparent)]\n pub struct ManuallyDrop<T: PointeeSized> {\n value: T,\n }\n\n impl<T> ManuallyDrop<T> {\n pub const fn new(value: T) -> ManuallyDrop<T> {\n ManuallyDrop { value }\n }\n }\n\n // region:deref\n impl<T: PointeeSized> crate::ops::Deref for ManuallyDrop<T> {\n type Target = T;\n fn deref(&self) -> &T {\n &self.value\n }\n }\n // endregion:deref\n\n // endregion:manually_drop\n\n // region:drop\n pub fn drop<T>(_x: T) {}\n pub const fn replace<T>(dest: &mut T, src: T) -> T {\n unsafe {\n let result = crate::ptr::read(dest);\n crate::ptr::write(dest, src);\n result\n }\n }\n // endregion:drop\n\n // region:transmute\n #[rustc_intrinsic]\n pub fn transmute<Src, Dst>(src: Src) -> Dst;\n // endregion:transmute\n\n // region:size_of\n #[rustc_intrinsic]\n pub fn size_of<T>() -> usize;\n // endregion:size_of\n\n // region:discriminant\n use crate::marker::DiscriminantKind;\n pub struct Discriminant<T>(<T as DiscriminantKind>::Discriminant);\n // endregion:discriminant\n\n // region:offset_of\n pub macro offset_of($Container:ty, $($fields:expr)+ $(,)?) {\n // The `{}` is for better error messages\n {builtin # offset_of($Container, $($fields)+)}\n }\n // endregion:offset_of\n}\n\npub mod ptr {\n // region:drop\n #[lang = \"drop_in_place\"]\n pub unsafe fn drop_in_place<T: crate::marker::PointeeSized>(to_drop: *mut T) {\n unsafe { drop_in_place(to_drop) }\n }\n pub const unsafe fn read<T>(src: *const T) -> T {\n unsafe { *src }\n }\n pub const unsafe fn write<T>(dst: *mut T, src: T) {\n unsafe {\n *dst = src;\n }\n }\n // endregion:drop\n\n // region:pointee\n #[lang = \"pointee_trait\"]\n #[rustc_deny_explicit_impl(implement_via_object = false)]\n pub trait Pointee: crate::marker::PointeeSized {\n #[lang = \"metadata_type\"]\n type Metadata: Copy + Send + Sync + Ord + Hash + Unpin;\n }\n\n #[lang = \"dyn_metadata\"]\n pub struct DynMetadata<Dyn: PointeeSized> {\n _phantom: crate::marker::PhantomData<Dyn>,\n }\n\n pub const fn metadata<T: PointeeSized>(ptr: *const T) -> <T as Pointee>::Metadata {\n loop {}\n }\n\n // endregion:pointee\n // region:non_null\n #[rustc_layout_scalar_valid_range_start(1)]\n #[rustc_nonnull_optimization_guaranteed]\n pub struct NonNull<T: crate::marker::PointeeSized> {\n pointer: *const T,\n }\n // region:coerce_unsized\n impl<T: crate::marker::PointeeSized, U: crate::marker::PointeeSized>\n crate::ops::CoerceUnsized<NonNull<U>> for NonNull<T>\n where\n T: crate::marker::Unsize<U>,\n {\n }\n // endregion:coerce_unsized\n // endregion:non_null\n\n // region:addr_of\n #[rustc_macro_transparency = \"semitransparent\"]\n pub macro addr_of($place:expr) {\n &raw const $place\n }\n #[rustc_macro_transparency = \"semitransparent\"]\n pub macro addr_of_mut($place:expr) {\n &raw mut $place\n }\n // endregion:addr_of\n}\n\npub mod ops {\n // region:coerce_unsized\n mod unsize {\n use crate::marker::{PointeeSized, Unsize};\n\n #[lang = \"coerce_unsized\"]\n pub trait CoerceUnsized<T> {}\n\n impl<\'a, T: PointeeSized + Unsize<U>, U: PointeeSized> CoerceUnsized<&\'a mut U> for &\'a mut T {}\n impl<\'a, \'b: \'a, T: PointeeSized + Unsize<U>, U: PointeeSized> CoerceUnsized<&\'a U> for &\'b mut T {}\n impl<\'a, T: PointeeSized + Unsize<U>, U: PointeeSized> CoerceUnsized<*mut U> for &\'a mut T {}\n impl<\'a, T: PointeeSized + Unsize<U>, U: PointeeSized> CoerceUnsized<*const U> for &\'a mut T {}\n\n impl<\'a, \'b: \'a, T: PointeeSized + Unsize<U>, U: PointeeSized> CoerceUnsized<&\'a U> for &\'b T {}\n impl<\'a, T: PointeeSized + Unsize<U>, U: PointeeSized> CoerceUnsized<*const U> for &\'a T {}\n\n impl<T: PointeeSized + Unsize<U>, U: PointeeSized> CoerceUnsized<*mut U> for *mut T {}\n impl<T: PointeeSized + Unsize<U>, U: PointeeSized> CoerceUnsized<*const U> for *mut T {}\n impl<T: PointeeSized + Unsize<U>, U: PointeeSized> CoerceUnsized<*const U> for *const T {}\n }\n pub use self::unsize::CoerceUnsized;\n // endregion:coerce_unsized\n\n // region:deref\n mod deref {\n use crate::marker::PointeeSized;\n\n #[lang = \"deref\"]\n pub trait Deref: PointeeSized {\n #[lang = \"deref_target\"]\n type Target: ?Sized;\n fn deref(&self) -> &Self::Target;\n }\n\n impl<T: PointeeSized> Deref for &T {\n type Target = T;\n fn deref(&self) -> &T {\n loop {}\n }\n }\n impl<T: PointeeSized> Deref for &mut T {\n type Target = T;\n fn deref(&self) -> &T {\n loop {}\n }\n }\n // region:deref_mut\n #[lang = \"deref_mut\"]\n pub trait DerefMut: Deref + PointeeSized {\n fn deref_mut(&mut self) -> &mut Self::Target;\n }\n // endregion:deref_mut\n\n // region:receiver\n #[lang = \"receiver\"]\n pub trait Receiver: PointeeSized {\n #[lang = \"receiver_target\"]\n type Target: ?Sized;\n }\n\n impl<P: PointeeSized, T: PointeeSized> Receiver for P\n where\n P: Deref<Target = T>,\n {\n type Target = T;\n }\n // endregion:receiver\n }\n pub use self::deref::{\n Deref,\n DerefMut, // :deref_mut\n Receiver, // :receiver\n };\n // endregion:deref\n\n // region:drop\n #[lang = \"drop\"]\n pub trait Drop {\n fn drop(&mut self);\n }\n // endregion:drop\n\n // region:index\n mod index {\n #[lang = \"index\"]\n pub trait Index<Idx: ?Sized> {\n type Output: ?Sized;\n fn index(&self, index: Idx) -> &Self::Output;\n }\n #[lang = \"index_mut\"]\n pub trait IndexMut<Idx: ?Sized>: Index<Idx> {\n fn index_mut(&mut self, index: Idx) -> &mut Self::Output;\n }\n\n // region:slice\n impl<T, I> Index<I> for [T]\n where\n I: SliceIndex<[T]>,\n {\n type Output = I::Output;\n fn index(&self, _index: I) -> &I::Output {\n loop {}\n }\n }\n impl<T, I> IndexMut<I> for [T]\n where\n I: SliceIndex<[T]>,\n {\n fn index_mut(&mut self, _index: I) -> &mut I::Output {\n loop {}\n }\n }\n\n impl<T, I, const N: usize> Index<I> for [T; N]\n where\n I: SliceIndex<[T]>,\n {\n type Output = I::Output;\n fn index(&self, _index: I) -> &I::Output {\n loop {}\n }\n }\n impl<T, I, const N: usize> IndexMut<I> for [T; N]\n where\n I: SliceIndex<[T]>,\n {\n fn index_mut(&mut self, _index: I) -> &mut I::Output {\n loop {}\n }\n }\n\n pub unsafe trait SliceIndex<T: ?Sized> {\n type Output: ?Sized;\n }\n unsafe impl<T> SliceIndex<[T]> for usize {\n type Output = T;\n }\n // endregion:slice\n }\n pub use self::index::{Index, IndexMut};\n // endregion:index\n\n // region:range\n mod range {\n #[lang = \"RangeFull\"]\n pub struct RangeFull;\n\n #[lang = \"Range\"]\n pub struct Range<Idx> {\n pub start: Idx,\n pub end: Idx,\n }\n\n #[lang = \"RangeFrom\"]\n pub struct RangeFrom<Idx> {\n pub start: Idx,\n }\n\n #[lang = \"RangeTo\"]\n pub struct RangeTo<Idx> {\n pub end: Idx,\n }\n\n #[lang = \"RangeInclusive\"]\n pub struct RangeInclusive<Idx> {\n pub(crate) start: Idx,\n pub(crate) end: Idx,\n pub(crate) exhausted: bool,\n }\n\n #[lang = \"RangeToInclusive\"]\n pub struct RangeToInclusive<Idx> {\n pub end: Idx,\n }\n }\n pub use self::range::{Range, RangeFrom, RangeFull, RangeTo};\n pub use self::range::{RangeInclusive, RangeToInclusive};\n // endregion:range\n\n // region:fn\n mod function {\n use crate::marker::Tuple;\n\n #[lang = \"fn\"]\n #[fundamental]\n #[rustc_paren_sugar]\n pub trait Fn<Args: Tuple>: FnMut<Args> {\n extern \"rust-call\" fn call(&self, args: Args) -> Self::Output;\n }\n\n #[lang = \"fn_mut\"]\n #[fundamental]\n #[rustc_paren_sugar]\n pub trait FnMut<Args: Tuple>: FnOnce<Args> {\n extern \"rust-call\" fn call_mut(&mut self, args: Args) -> Self::Output;\n }\n\n #[lang = \"fn_once\"]\n #[fundamental]\n #[rustc_paren_sugar]\n pub trait FnOnce<Args: Tuple> {\n #[lang = \"fn_once_output\"]\n type Output;\n extern \"rust-call\" fn call_once(self, args: Args) -> Self::Output;\n }\n\n mod impls {\n use crate::marker::Tuple;\n\n #[stable(feature = \"rust1\", since = \"1.0.0\")]\n #[rustc_const_unstable(feature = \"const_fn_trait_ref_impls\", issue = \"101803\")]\n impl<A: Tuple, F: ?Sized> const Fn<A> for &F\n where\n F: [const] Fn<A>,\n {\n extern \"rust-call\" fn call(&self, args: A) -> F::Output {\n (**self).call(args)\n }\n }\n\n #[stable(feature = \"rust1\", since = \"1.0.0\")]\n #[rustc_const_unstable(feature = \"const_fn_trait_ref_impls\", issue = \"101803\")]\n impl<A: Tuple, F: ?Sized> const FnMut<A> for &F\n where\n F: [const] Fn<A>,\n {\n extern \"rust-call\" fn call_mut(&mut self, args: A) -> F::Output {\n (**self).call(args)\n }\n }\n\n #[stable(feature = \"rust1\", since = \"1.0.0\")]\n #[rustc_const_unstable(feature = \"const_fn_trait_ref_impls\", issue = \"101803\")]\n impl<A: Tuple, F: ?Sized> const FnOnce<A> for &F\n where\n F: [const] Fn<A>,\n {\n type Output = F::Output;\n\n extern \"rust-call\" fn call_once(self, args: A) -> F::Output {\n (*self).call(args)\n }\n }\n\n #[stable(feature = \"rust1\", since = \"1.0.0\")]\n #[rustc_const_unstable(feature = \"const_fn_trait_ref_impls\", issue = \"101803\")]\n impl<A: Tuple, F: ?Sized> const FnMut<A> for &mut F\n where\n F: [const] FnMut<A>,\n {\n extern \"rust-call\" fn call_mut(&mut self, args: A) -> F::Output {\n (*self).call_mut(args)\n }\n }\n\n #[stable(feature = \"rust1\", since = \"1.0.0\")]\n #[rustc_const_unstable(feature = \"const_fn_trait_ref_impls\", issue = \"101803\")]\n impl<A: Tuple, F: ?Sized> const FnOnce<A> for &mut F\n where\n F: [const] FnMut<A>,\n {\n type Output = F::Output;\n extern \"rust-call\" fn call_once(self, args: A) -> F::Output {\n (*self).call_mut(args)\n }\n }\n }\n }\n pub use self::function::{Fn, FnMut, FnOnce};\n // endregion:fn\n\n // region:async_fn\n mod async_function {\n use crate::{future::Future, marker::Tuple};\n\n #[lang = \"async_fn\"]\n #[fundamental]\n #[rustc_paren_sugar]\n pub trait AsyncFn<Args: Tuple>: AsyncFnMut<Args> {\n extern \"rust-call\" fn async_call(&self, args: Args) -> Self::CallRefFuture<\'_>;\n }\n\n #[lang = \"async_fn_mut\"]\n #[fundamental]\n #[rustc_paren_sugar]\n pub trait AsyncFnMut<Args: Tuple>: AsyncFnOnce<Args> {\n #[lang = \"call_ref_future\"]\n type CallRefFuture<\'a>: Future<Output = Self::Output>\n where\n Self: \'a;\n extern \"rust-call\" fn async_call_mut(&mut self, args: Args) -> Self::CallRefFuture<\'_>;\n }\n\n #[lang = \"async_fn_once\"]\n #[fundamental]\n #[rustc_paren_sugar]\n pub trait AsyncFnOnce<Args: Tuple> {\n #[lang = \"async_fn_once_output\"]\n type Output;\n #[lang = \"call_once_future\"]\n type CallOnceFuture: Future<Output = Self::Output>;\n extern \"rust-call\" fn async_call_once(self, args: Args) -> Self::CallOnceFuture;\n }\n\n mod impls {\n use super::{AsyncFn, AsyncFnMut, AsyncFnOnce};\n use crate::marker::Tuple;\n\n impl<A: Tuple, F: ?Sized> AsyncFn<A> for &F\n where\n F: AsyncFn<A>,\n {\n extern \"rust-call\" fn async_call(&self, args: A) -> Self::CallRefFuture<\'_> {\n F::async_call(*self, args)\n }\n }\n\n impl<A: Tuple, F: ?Sized> AsyncFnMut<A> for &F\n where\n F: AsyncFn<A>,\n {\n type CallRefFuture<\'a>\n = F::CallRefFuture<\'a>\n where\n Self: \'a;\n\n extern \"rust-call\" fn async_call_mut(\n &mut self,\n args: A,\n ) -> Self::CallRefFuture<\'_> {\n F::async_call(*self, args)\n }\n }\n\n impl<\'a, A: Tuple, F: ?Sized> AsyncFnOnce<A> for &\'a F\n where\n F: AsyncFn<A>,\n {\n type Output = F::Output;\n type CallOnceFuture = F::CallRefFuture<\'a>;\n\n extern \"rust-call\" fn async_call_once(self, args: A) -> Self::CallOnceFuture {\n F::async_call(self, args)\n }\n }\n\n impl<A: Tuple, F: ?Sized> AsyncFnMut<A> for &mut F\n where\n F: AsyncFnMut<A>,\n {\n type CallRefFuture<\'a>\n = F::CallRefFuture<\'a>\n where\n Self: \'a;\n\n extern \"rust-call\" fn async_call_mut(\n &mut self,\n args: A,\n ) -> Self::CallRefFuture<\'_> {\n F::async_call_mut(*self, args)\n }\n }\n\n impl<\'a, A: Tuple, F: ?Sized> AsyncFnOnce<A> for &\'a mut F\n where\n F: AsyncFnMut<A>,\n {\n type Output = F::Output;\n type CallOnceFuture = F::CallRefFuture<\'a>;\n\n extern \"rust-call\" fn async_call_once(self, args: A) -> Self::CallOnceFuture {\n F::async_call_mut(self, args)\n }\n }\n }\n }\n pub use self::async_function::{AsyncFn, AsyncFnMut, AsyncFnOnce};\n // endregion:async_fn\n\n // region:try\n mod try_ {\n use crate::convert::Infallible;\n\n pub enum ControlFlow<B, C = ()> {\n #[lang = \"Continue\"]\n Continue(C),\n #[lang = \"Break\"]\n Break(B),\n }\n pub trait FromResidual<R = <Self as Try>::Residual> {\n #[lang = \"from_residual\"]\n fn from_residual(residual: R) -> Self;\n }\n #[lang = \"Try\"]\n pub trait Try: FromResidual<Self::Residual> {\n type Output;\n type Residual;\n #[lang = \"from_output\"]\n fn from_output(output: Self::Output) -> Self;\n #[lang = \"branch\"]\n fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;\n }\n\n impl<B, C> Try for ControlFlow<B, C> {\n type Output = C;\n type Residual = ControlFlow<B, Infallible>;\n fn from_output(output: Self::Output) -> Self {\n ControlFlow::Continue(output)\n }\n fn branch(self) -> ControlFlow<Self::Residual, Self::Output> {\n match self {\n ControlFlow::Continue(x) => ControlFlow::Continue(x),\n ControlFlow::Break(x) => ControlFlow::Break(ControlFlow::Break(x)),\n }\n }\n }\n\n impl<B, C> FromResidual for ControlFlow<B, C> {\n fn from_residual(residual: ControlFlow<B, Infallible>) -> Self {\n match residual {\n ControlFlow::Break(b) => ControlFlow::Break(b),\n ControlFlow::Continue(_) => loop {},\n }\n }\n }\n // region:option\n impl<T> Try for Option<T> {\n type Output = T;\n type Residual = Option<Infallible>;\n fn from_output(output: Self::Output) -> Self {\n Some(output)\n }\n fn branch(self) -> ControlFlow<Self::Residual, Self::Output> {\n match self {\n Some(x) => ControlFlow::Continue(x),\n None => ControlFlow::Break(None),\n }\n }\n }\n\n impl<T> FromResidual for Option<T> {\n fn from_residual(x: Option<Infallible>) -> Self {\n match x {\n None => None,\n Some(_) => loop {},\n }\n }\n }\n // endregion:option\n // region:result\n // region:from\n use crate::convert::From;\n\n impl<T, E> Try for Result<T, E> {\n type Output = T;\n type Residual = Result<Infallible, E>;\n\n fn from_output(output: Self::Output) -> Self {\n Ok(output)\n }\n\n fn branch(self) -> ControlFlow<Self::Residual, Self::Output> {\n match self {\n Ok(v) => ControlFlow::Continue(v),\n Err(e) => ControlFlow::Break(Err(e)),\n }\n }\n }\n\n impl<T, E, F: From<E>> FromResidual<Result<Infallible, E>> for Result<T, F> {\n fn from_residual(residual: Result<Infallible, E>) -> Self {\n match residual {\n Err(e) => Err(F::from(e)),\n Ok(_) => loop {},\n }\n }\n }\n // endregion:from\n // endregion:result\n }\n pub use self::try_::{ControlFlow, FromResidual, Try};\n // endregion:try\n\n // region:add\n #[lang = \"add\"]\n pub trait Add<Rhs = Self> {\n type Output;\n fn add(self, rhs: Rhs) -> Self::Output;\n }\n\n #[lang = \"add_assign\"]\n pub const trait AddAssign<Rhs = Self> {\n fn add_assign(&mut self, rhs: Rhs);\n }\n\n // region:builtin_impls\n macro_rules! add_impl {\n ($($t:ty)*) => ($(\n impl const Add for $t {\n type Output = $t;\n fn add(self, other: $t) -> $t { self + other }\n }\n )*)\n }\n\n add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128 }\n // endregion:builtin_impls\n // endregion:add\n\n // region:coroutine\n mod coroutine {\n use crate::pin::Pin;\n\n #[lang = \"coroutine\"]\n pub trait Coroutine<R = ()> {\n #[lang = \"coroutine_yield\"]\n type Yield;\n #[lang = \"coroutine_return\"]\n type Return;\n fn resume(self: Pin<&mut Self>, arg: R) -> CoroutineState<Self::Yield, Self::Return>;\n }\n\n #[lang = \"coroutine_state\"]\n pub enum CoroutineState<Y, R> {\n Yielded(Y),\n Complete(R),\n }\n }\n pub use self::coroutine::{Coroutine, CoroutineState};\n // endregion:coroutine\n\n // region:dispatch_from_dyn\n mod dispatch_from_dyn {\n use crate::marker::{PointeeSized, Unsize};\n\n #[lang = \"dispatch_from_dyn\"]\n pub trait DispatchFromDyn<T> {}\n\n impl<\'a, T: PointeeSized + Unsize<U>, U: PointeeSized> DispatchFromDyn<&\'a U> for &\'a T {}\n\n impl<\'a, T: PointeeSized + Unsize<U>, U: PointeeSized> DispatchFromDyn<&\'a mut U> for &\'a mut T {}\n\n impl<T: PointeeSized + Unsize<U>, U: PointeeSized> DispatchFromDyn<*const U> for *const T {}\n\n impl<T: PointeeSized + Unsize<U>, U: PointeeSized> DispatchFromDyn<*mut U> for *mut T {}\n }\n pub use self::dispatch_from_dyn::DispatchFromDyn;\n // endregion:dispatch_from_dyn\n}\n\n// region:eq\npub mod cmp {\n use crate::marker::PointeeSized;\n\n #[lang = \"eq\"]\n pub trait PartialEq<Rhs: PointeeSized = Self>: PointeeSized {\n fn eq(&self, other: &Rhs) -> bool;\n fn ne(&self, other: &Rhs) -> bool {\n !self.eq(other)\n }\n }\n\n pub trait Eq: PartialEq<Self> + PointeeSized {}\n\n // region:derive\n #[rustc_builtin_macro]\n pub macro PartialEq($item:item) {}\n #[rustc_builtin_macro]\n pub macro Eq($item:item) {}\n // endregion:derive\n\n // region:ord\n #[lang = \"partial_ord\"]\n pub trait PartialOrd<Rhs: PointeeSized = Self>: PartialEq<Rhs> + PointeeSized {\n fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;\n }\n\n pub trait Ord: Eq + PartialOrd<Self> + PointeeSized {\n fn cmp(&self, other: &Self) -> Ordering;\n }\n\n pub enum Ordering {\n Less = -1,\n Equal = 0,\n Greater = 1,\n }\n\n // region:derive\n #[rustc_builtin_macro]\n pub macro PartialOrd($item:item) {}\n #[rustc_builtin_macro]\n pub macro Ord($item:item) {}\n // endregion:derive\n\n // endregion:ord\n}\n// endregion:eq\n\n// region:fmt\npub mod fmt {\n use crate::marker::PointeeSized;\n\n pub struct Error;\n pub type Result = crate::result::Result<(), Error>;\n pub struct Formatter<\'a>(&\'a ());\n pub struct DebugTuple;\n pub struct DebugStruct;\n impl Formatter<\'_> {\n pub fn debug_tuple(&mut self, _name: &str) -> DebugTuple {\n DebugTuple\n }\n\n pub fn debug_struct(&mut self, _name: &str) -> DebugStruct {\n DebugStruct\n }\n }\n\n impl DebugTuple {\n pub fn field(&mut self, _value: &dyn Debug) -> &mut Self {\n self\n }\n\n pub fn finish(&mut self) -> Result {\n Ok(())\n }\n }\n\n impl DebugStruct {\n pub fn field(&mut self, _name: &str, _value: &dyn Debug) -> &mut Self {\n self\n }\n\n pub fn finish(&mut self) -> Result {\n Ok(())\n }\n }\n\n pub trait Debug: PointeeSized {\n fn fmt(&self, f: &mut Formatter<\'_>) -> Result;\n }\n pub trait Display: PointeeSized {\n fn fmt(&self, f: &mut Formatter<\'_>) -> Result;\n }\n\n mod rt {\n use super::*;\n\n extern \"C\" {\n type Opaque;\n }\n\n #[derive(Copy, Clone)]\n #[lang = \"format_argument\"]\n pub struct Argument<\'a> {\n value: &\'a Opaque,\n formatter: fn(&Opaque, &mut Formatter<\'_>) -> Result,\n }\n\n impl<\'a> Argument<\'a> {\n pub fn new<\'b, T>(x: &\'b T, f: fn(&T, &mut Formatter<\'_>) -> Result) -> Argument<\'b> {\n use crate::mem::transmute;\n unsafe { Argument { formatter: transmute(f), value: transmute(x) } }\n }\n\n pub fn new_display<\'b, T: crate::fmt::Display>(x: &\'b T) -> Argument<\'_> {\n Self::new(x, crate::fmt::Display::fmt)\n }\n }\n\n #[lang = \"format_alignment\"]\n pub enum Alignment {\n Left,\n Right,\n Center,\n Unknown,\n }\n\n #[lang = \"format_count\"]\n pub enum Count {\n Is(usize),\n Param(usize),\n Implied,\n }\n\n #[lang = \"format_placeholder\"]\n pub struct Placeholder {\n pub position: usize,\n pub fill: char,\n pub align: Alignment,\n pub flags: u32,\n pub precision: Count,\n pub width: Count,\n }\n\n impl Placeholder {\n pub const fn new(\n position: usize,\n fill: char,\n align: Alignment,\n flags: u32,\n precision: Count,\n width: Count,\n ) -> Self {\n Placeholder { position, fill, align, flags, precision, width }\n }\n }\n\n // region:fmt_before_1_89_0\n #[lang = \"format_unsafe_arg\"]\n pub struct UnsafeArg {\n _private: (),\n }\n\n impl UnsafeArg {\n pub unsafe fn new() -> Self {\n UnsafeArg { _private: () }\n }\n }\n // endregion:fmt_before_1_89_0\n }\n\n #[derive(Copy, Clone)]\n #[lang = \"format_arguments\"]\n pub struct Arguments<\'a> {\n pieces: &\'a [&\'static str],\n fmt: Option<&\'a [rt::Placeholder]>,\n args: &\'a [rt::Argument<\'a>],\n }\n\n impl<\'a> Arguments<\'a> {\n pub const fn new_v1(pieces: &\'a [&\'static str], args: &\'a [Argument<\'a>]) -> Arguments<\'a> {\n Arguments { pieces, fmt: None, args }\n }\n\n pub const fn new_const(pieces: &\'a [&\'static str]) -> Arguments<\'a> {\n Arguments { pieces, fmt: None, args: &[] }\n }\n\n // region:fmt_before_1_89_0\n pub fn new_v1_formatted(\n pieces: &\'a [&\'static str],\n args: &\'a [rt::Argument<\'a>],\n fmt: &\'a [rt::Placeholder],\n _unsafe_arg: rt::UnsafeArg,\n ) -> Arguments<\'a> {\n Arguments { pieces, fmt: Some(fmt), args }\n }\n // endregion:fmt_before_1_89_0\n\n // region:!fmt_before_1_89_0\n pub unsafe fn new_v1_formatted(\n pieces: &\'a [&\'static str],\n args: &\'a [rt::Argument<\'a>],\n fmt: &\'a [rt::Placeholder],\n ) -> Arguments<\'a> {\n Arguments { pieces, fmt: Some(fmt), args }\n }\n // endregion:!fmt_before_1_89_0\n\n pub const fn as_str(&self) -> Option<&\'static str> {\n match (self.pieces, self.args) {\n ([], []) => Some(\"\"),\n ([s], []) => Some(s),\n _ => None,\n }\n }\n }\n\n // region:derive\n pub(crate) mod derive {\n #[rustc_builtin_macro]\n pub macro Debug($item:item) {}\n }\n pub use derive::Debug;\n // endregion:derive\n\n // region:builtin_impls\n macro_rules! impl_debug {\n ($($t:ty)*) => {\n $(\n impl const Debug for $t {\n fn fmt(&self, _f: &mut Formatter<\'_>) -> Result {\n Ok(())\n }\n }\n )*\n }\n }\n\n impl_debug! {\n usize u8 u16 u32 u64 u128\n isize i8 i16 i32 i64 i128\n f16 f32 f64 f128\n bool char\n }\n\n impl<T: Debug> Debug for [T] {\n fn fmt(&self, _f: &mut Formatter<\'_>) -> Result {\n Ok(())\n }\n }\n\n impl<T: Debug + PointeeSized> Debug for &T {\n fn fmt(&self, f: &mut Formatter<\'_>) -> Result {\n (&**self).fmt(f)\n }\n }\n // endregion:builtin_impls\n}\n// endregion:fmt\n\n// region:slice\npub mod slice {\n #[lang = \"slice\"]\n impl<T> [T] {\n #[lang = \"slice_len_fn\"]\n pub fn len(&self) -> usize {\n loop {}\n }\n }\n}\n// endregion:slice\n\n// region:option\npub mod option {\n pub enum Option<T> {\n #[lang = \"None\"]\n None,\n #[lang = \"Some\"]\n Some(T),\n }\n\n // region:copy\n impl<T: Copy> Copy for Option<T> {}\n // endregion:copy\n\n impl<T> Option<T> {\n pub const fn unwrap(self) -> T {\n match self {\n Some(val) => val,\n None => panic!(\"called `Option::unwrap()` on a `None` value\"),\n }\n }\n\n pub const fn as_ref(&self) -> Option<&T> {\n match self {\n Some(x) => Some(x),\n None => None,\n }\n }\n\n pub fn and<U>(self, _optb: Option<U>) -> Option<U> {\n loop {}\n }\n pub fn unwrap_or(self, default: T) -> T {\n match self {\n Some(val) => val,\n None => default,\n }\n }\n // region:result\n pub const fn ok_or<E>(self, err: E) -> Result<T, E> {\n match self {\n Some(v) => Ok(v),\n None => Err(err),\n }\n }\n // endregion:result\n // region:fn\n pub fn and_then<U, F>(self, _f: F) -> Option<U>\n where\n F: FnOnce(T) -> Option<U>,\n {\n loop {}\n }\n pub fn unwrap_or_else<F>(self, _f: F) -> T\n where\n F: FnOnce() -> T,\n {\n loop {}\n }\n pub fn map_or<U, F>(self, _default: U, _f: F) -> U\n where\n F: FnOnce(T) -> U,\n {\n loop {}\n }\n pub fn map_or_else<U, D, F>(self, _default: D, _f: F) -> U\n where\n D: FnOnce() -> U,\n F: FnOnce(T) -> U,\n {\n loop {}\n }\n // endregion:fn\n }\n}\n// endregion:option\n\n// region:result\npub mod result {\n pub enum Result<T, E> {\n #[lang = \"Ok\"]\n Ok(T),\n #[lang = \"Err\"]\n Err(E),\n }\n}\n// endregion:result\n\n// region:pin\npub mod pin {\n #[lang = \"pin\"]\n #[fundamental]\n pub struct Pin<P> {\n pointer: P,\n }\n impl<P> Pin<P> {\n pub fn new(pointer: P) -> Pin<P> {\n Pin { pointer }\n }\n }\n // region:deref\n impl<P: crate::ops::Deref> crate::ops::Deref for Pin<P> {\n type Target = P::Target;\n fn deref(&self) -> &P::Target {\n loop {}\n }\n }\n // endregion:deref\n // region:dispatch_from_dyn\n impl<Ptr, U> crate::ops::DispatchFromDyn<Pin<U>> for Pin<Ptr> where\n Ptr: crate::ops::DispatchFromDyn<U>\n {\n }\n // endregion:dispatch_from_dyn\n}\n// endregion:pin\n\n// region:future\npub mod future {\n use crate::{\n pin::Pin,\n task::{Context, Poll},\n };\n\n #[doc(notable_trait)]\n #[lang = \"future_trait\"]\n pub trait Future {\n #[lang = \"future_output\"]\n type Output;\n #[lang = \"poll\"]\n fn poll(self: Pin<&mut Self>, cx: &mut Context<\'_>) -> Poll<Self::Output>;\n }\n\n pub trait IntoFuture {\n type Output;\n type IntoFuture: Future<Output = Self::Output>;\n #[lang = \"into_future\"]\n fn into_future(self) -> Self::IntoFuture;\n }\n\n impl<F: Future> IntoFuture for F {\n type Output = F::Output;\n type IntoFuture = F;\n fn into_future(self) -> F {\n self\n }\n }\n}\npub mod task {\n pub enum Poll<T> {\n #[lang = \"Ready\"]\n Ready(T),\n #[lang = \"Pending\"]\n Pending,\n }\n\n pub struct Context<\'a> {\n waker: &\'a (),\n }\n}\n// endregion:future\n\n// region:iterator\npub mod iter {\n // region:iterators\n mod adapters {\n pub struct Take<I> {\n iter: I,\n n: usize,\n }\n impl<I> Iterator for Take<I>\n where\n I: Iterator,\n {\n type Item = <I as Iterator>::Item;\n\n fn next(&mut self) -> Option<<I as Iterator>::Item> {\n loop {}\n }\n }\n\n pub struct FilterMap<I, F> {\n iter: I,\n f: F,\n }\n impl<B, I: Iterator, F> Iterator for FilterMap<I, F>\n where\n F: FnMut(I::Item) -> Option<B>,\n {\n type Item = B;\n\n #[inline]\n fn next(&mut self) -> Option<B> {\n loop {}\n }\n }\n }\n pub use self::adapters::{FilterMap, Take};\n\n mod sources {\n mod repeat {\n pub fn repeat<T>(_elt: T) -> Repeat<T> {\n loop {}\n }\n\n pub struct Repeat<A> {\n element: A,\n }\n\n impl<A> Iterator for Repeat<A> {\n type Item = A;\n\n fn next(&mut self) -> Option<A> {\n loop {}\n }\n }\n }\n pub use self::repeat::{Repeat, repeat};\n }\n pub use self::sources::{Repeat, repeat};\n // endregion:iterators\n\n mod traits {\n mod iterator {\n use crate::marker::PointeeSized;\n\n #[doc(notable_trait)]\n #[lang = \"iterator\"]\n pub trait Iterator {\n type Item;\n #[lang = \"next\"]\n fn next(&mut self) -> Option<Self::Item>;\n fn nth(&mut self, n: usize) -> Option<Self::Item> {\n loop {}\n }\n fn by_ref(&mut self) -> &mut Self\n where\n Self: Sized,\n {\n self\n }\n // region:iterators\n fn take(self, n: usize) -> crate::iter::Take<Self>\n where\n Self: Sized,\n {\n loop {}\n }\n fn filter_map<B, F>(self, _f: F) -> crate::iter::FilterMap<Self, F>\n where\n Self: Sized,\n F: FnMut(Self::Item) -> Option<B>,\n {\n loop {}\n }\n fn collect<B: FromIterator<Self::Item>>(self) -> B\n where\n Self: Sized,\n {\n loop {}\n }\n // endregion:iterators\n }\n impl<I: Iterator + PointeeSized> Iterator for &mut I {\n type Item = I::Item;\n fn next(&mut self) -> Option<I::Item> {\n (**self).next()\n }\n }\n }\n pub use self::iterator::Iterator;\n\n mod collect {\n pub trait IntoIterator {\n type Item;\n type IntoIter: Iterator<Item = Self::Item>;\n #[lang = \"into_iter\"]\n fn into_iter(self) -> Self::IntoIter;\n }\n impl<I: Iterator> IntoIterator for I {\n type Item = I::Item;\n type IntoIter = I;\n fn into_iter(self) -> I {\n self\n }\n }\n struct IndexRange {\n start: usize,\n end: usize,\n }\n pub struct IntoIter<T, const N: usize> {\n data: [T; N],\n range: IndexRange,\n }\n impl<T, const N: usize> IntoIterator for [T; N] {\n type Item = T;\n type IntoIter = IntoIter<T, N>;\n fn into_iter(self) -> Self::IntoIter {\n IntoIter { data: self, range: IndexRange { start: 0, end: loop {} } }\n }\n }\n impl<T, const N: usize> Iterator for IntoIter<T, N> {\n type Item = T;\n fn next(&mut self) -> Option<T> {\n loop {}\n }\n }\n pub struct Iter<\'a, T> {\n slice: &\'a [T],\n }\n impl<\'a, T> IntoIterator for &\'a [T; N] {\n type Item = &\'a T;\n type IntoIter = Iter<\'a, T>;\n fn into_iter(self) -> Self::IntoIter {\n loop {}\n }\n }\n impl<\'a, T> IntoIterator for &\'a [T] {\n type Item = &\'a T;\n type IntoIter = Iter<\'a, T>;\n fn into_iter(self) -> Self::IntoIter {\n loop {}\n }\n }\n impl<\'a, T> Iterator for Iter<\'a, T> {\n type Item = &\'a T;\n fn next(&mut self) -> Option<T> {\n loop {}\n }\n }\n pub trait FromIterator<A>: Sized {\n fn from_iter<T: IntoIterator<Item = A>>(iter: T) -> Self;\n }\n }\n pub use self::collect::{IntoIterator, FromIterator};\n }\n pub use self::traits::{IntoIterator, FromIterator, Iterator};\n}\n// endregion:iterator\n\n// region:str\npub mod str {\n pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {\n \"\"\n }\n pub trait FromStr: Sized {\n type Err;\n fn from_str(s: &str) -> Result<Self, Self::Err>;\n }\n impl str {\n pub fn parse<F: FromStr>(&self) -> Result<F, F::Err> {\n FromStr::from_str(self)\n }\n }\n}\n// endregion:str\n\n// region:panic\nmod panic {\n pub macro panic_2021 {\n () => ({\n const fn panic_cold_explicit() -> ! {\n $crate::panicking::panic_explicit()\n }\n panic_cold_explicit();\n }),\n // Special-case the single-argument case for const_panic.\n (\"{}\", $arg:expr $(,)?) => ({\n #[rustc_const_panic_str] // enforce a &&str argument in const-check and hook this by const-eval\n #[rustc_do_not_const_check] // hooked by const-eval\n const fn panic_cold_display<T: $crate::fmt::Display>(arg: &T) -> ! {\n $crate::panicking::panic_display(arg)\n }\n panic_cold_display(&$arg);\n }),\n ($($t:tt)+) => ({\n // Semicolon to prevent temporaries inside the formatting machinery from\n // being considered alive in the caller after the panic_fmt call.\n $crate::panicking::panic_fmt($crate::const_format_args!($($t)+));\n }),\n }\n}\n\nmod panicking {\n #[rustc_const_panic_str] // enforce a &&str argument in const-check and hook this by const-eval\n pub const fn panic_display<T: crate::fmt::Display>(x: &T) -> ! {\n panic_fmt(crate::format_args!(\"{}\", *x));\n }\n\n // This function is used instead of panic_fmt in const eval.\n #[lang = \"const_panic_fmt\"]\n pub const fn const_panic_fmt(fmt: crate::fmt::Arguments<\'_>) -> ! {\n if let Some(msg) = fmt.as_str() {\n // The panic_display function is hooked by const eval.\n panic_display(&msg);\n } else {\n loop {}\n }\n }\n\n #[lang = \"panic_fmt\"] // needed for const-evaluated panics\n pub const fn panic_fmt(fmt: crate::fmt::Arguments<\'_>) -> ! {\n loop {}\n }\n\n #[lang = \"panic\"]\n pub const fn panic(expr: &\'static str) -> ! {\n panic_fmt(crate::fmt::Arguments::new_const(&[expr]))\n }\n}\n// endregion:panic\n\n// region:asm\nmod arch {\n #[rustc_builtin_macro]\n pub macro asm(\"assembly template\", $(operands,)* $(options($(option),*))?) {\n /* compiler built-in */\n }\n #[rustc_builtin_macro]\n pub macro global_asm(\"assembly template\", $(operands,)* $(options($(option),*))?) {\n /* compiler built-in */\n }\n}\n// endregion:asm\n\n#[macro_use]\nmod macros {\n // region:panic\n #[macro_export]\n #[rustc_builtin_macro(core_panic)]\n macro_rules! panic {\n ($($arg:tt)*) => {\n /* compiler built-in */\n };\n }\n // endregion:panic\n\n // region:write\n #[macro_export]\n macro_rules! write {\n ($dst:expr, $($arg:tt)*) => {\n $dst.write_fmt($crate::format_args!($($arg)*))\n };\n }\n\n #[macro_export]\n #[allow_internal_unstable(format_args_nl)]\n macro_rules! writeln {\n ($dst:expr $(,)?) => {\n $crate::write!($dst, \"\\n\")\n };\n ($dst:expr, $($arg:tt)*) => {\n $dst.write_fmt($crate::format_args_nl!($($arg)*))\n };\n }\n // endregion:write\n\n // region:assert\n #[macro_export]\n #[rustc_builtin_macro]\n #[allow_internal_unstable(core_panic, edition_panic, generic_assert_internals)]\n macro_rules! assert {\n ($($arg:tt)*) => {\n /* compiler built-in */\n };\n }\n // endregion:assert\n\n // region:fmt\n #[allow_internal_unstable(fmt_internals, const_fmt_arguments_new)]\n #[macro_export]\n #[rustc_builtin_macro]\n macro_rules! const_format_args {\n ($fmt:expr) => {{ /* compiler built-in */ }};\n ($fmt:expr, $($args:tt)*) => {{ /* compiler built-in */ }};\n }\n\n #[allow_internal_unstable(fmt_internals)]\n #[macro_export]\n #[rustc_builtin_macro]\n macro_rules! format_args {\n ($fmt:expr) => {{ /* compiler built-in */ }};\n ($fmt:expr, $($args:tt)*) => {{ /* compiler built-in */ }};\n }\n\n #[allow_internal_unstable(fmt_internals)]\n #[macro_export]\n #[rustc_builtin_macro]\n macro_rules! format_args_nl {\n ($fmt:expr) => {{ /* compiler built-in */ }};\n ($fmt:expr, $($args:tt)*) => {{ /* compiler built-in */ }};\n }\n\n #[macro_export]\n macro_rules! print {\n ($($arg:tt)*) => {{\n $crate::io::_print($crate::format_args!($($arg)*));\n }};\n }\n\n // endregion:fmt\n\n // region:todo\n #[macro_export]\n #[allow_internal_unstable(core_panic)]\n macro_rules! todo {\n () => {\n $crate::panicking::panic(\"not yet implemented\")\n };\n ($($arg:tt)+) => {\n $crate::panic!(\"not yet implemented: {}\", $crate::format_args!($($arg)+))\n };\n }\n // endregion:todo\n\n // region:unimplemented\n #[macro_export]\n #[allow_internal_unstable(core_panic)]\n macro_rules! unimplemented {\n () => {\n $crate::panicking::panic(\"not implemented\")\n };\n ($($arg:tt)+) => {\n $crate::panic!(\"not implemented: {}\", $crate::format_args!($($arg)+))\n };\n }\n // endregion:unimplemented\n\n // region:derive\n pub(crate) mod builtin {\n #[rustc_builtin_macro]\n pub macro derive($item:item) {\n /* compiler built-in */\n }\n\n #[rustc_builtin_macro]\n pub macro derive_const($item:item) {\n /* compiler built-in */\n }\n }\n // endregion:derive\n\n // region:include\n #[rustc_builtin_macro]\n #[macro_export]\n macro_rules! include {\n ($file:expr $(,)?) => {{ /* compiler built-in */ }};\n }\n // endregion:include\n\n // region:concat\n #[rustc_builtin_macro]\n #[macro_export]\n macro_rules! concat {}\n // endregion:concat\n\n // region:env\n #[rustc_builtin_macro]\n #[macro_export]\n macro_rules! env {}\n #[rustc_builtin_macro]\n #[macro_export]\n macro_rules! option_env {}\n // endregion:env\n}\n\n// region:non_zero\npub mod num {\n #[repr(transparent)]\n #[rustc_layout_scalar_valid_range_start(1)]\n #[rustc_nonnull_optimization_guaranteed]\n pub struct NonZeroU8(u8);\n}\n// endregion:non_zero\n\n// region:bool_impl\n#[lang = \"bool\"]\nimpl bool {\n pub fn then<T, F: FnOnce() -> T>(self, f: F) -> Option<T> {\n if self { Some(f()) } else { None }\n }\n}\n// endregion:bool_impl\n\n// region:int_impl\nmacro_rules! impl_int {\n ($($t:ty)*) => {\n $(\n impl $t {\n pub const fn from_ne_bytes(bytes: [u8; size_of::<Self>()]) -> Self {\n unsafe { mem::transmute(bytes) }\n }\n }\n )*\n }\n}\n\nimpl_int! {\n usize u8 u16 u32 u64 u128\n isize i8 i16 i32 i64 i128\n}\n// endregion:int_impl\n\n// region:error\npub mod error {\n #[rustc_has_incoherent_inherent_impls]\n pub trait Error: crate::fmt::Debug + crate::fmt::Display {\n fn source(&self) -> Option<&(dyn Error + \'static)> {\n None\n }\n }\n}\n// endregion:error\n\n// region:column\n#[rustc_builtin_macro]\n#[macro_export]\nmacro_rules! column {\n () => {};\n}\n// endregion:column\n\npub mod prelude {\n pub mod v1 {\n pub use crate::{\n clone::Clone, // :clone\n cmp::{Eq, PartialEq}, // :eq\n cmp::{Ord, PartialOrd}, // :ord\n convert::AsMut, // :as_mut\n convert::AsRef, // :as_ref\n convert::{From, Into, TryFrom, TryInto}, // :from\n default::Default, // :default\n iter::{IntoIterator, Iterator, FromIterator}, // :iterator\n macros::builtin::{derive, derive_const}, // :derive\n marker::Copy, // :copy\n marker::Send, // :send\n marker::Sized, // :sized\n marker::Sync, // :sync\n mem::drop, // :drop\n mem::size_of, // :size_of\n ops::Drop, // :drop\n ops::{AsyncFn, AsyncFnMut, AsyncFnOnce}, // :async_fn\n ops::{Fn, FnMut, FnOnce}, // :fn\n option::Option::{self, None, Some}, // :option\n panic, // :panic\n result::Result::{self, Err, Ok}, // :result\n str::FromStr, // :str\n fmt::derive::Debug, // :fmt, derive\n hash::derive::Hash, // :hash, derive\n };\n }\n\n pub mod rust_2015 {\n pub use super::v1::*;\n }\n\n pub mod rust_2018 {\n pub use super::v1::*;\n }\n\n pub mod rust_2021 {\n pub use super::v1::*;\n }\n\n pub mod rust_2024 {\n pub use super::v1::*;\n }\n}\n\n#[prelude_import]\n#[allow(unused)]\nuse prelude::v1::*;\n"

Source

pub fn from_flags<'a>(flags: impl IntoIterator<Item = &'a str>) -> Self

Source

pub fn available_flags(raw_source: &str) -> impl Iterator<Item = &str>

Source

pub fn source_code(self, raw_source: &str) -> String

Strips parts of minicore.rs which are flagged by inactive flags.

This is probably over-engineered to support flags dependencies.

Trait Implementations§

Source§

impl Debug for MiniCore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoBox<dyn Any> for T
where T: Any,

Source§

fn into_box(self) -> Box<dyn Any>

Convert self into the appropriate boxed form.
Source§

impl<T> IntoBox<dyn Any + Send> for T
where T: Any + Send,

Source§

fn into_box(self) -> Box<dyn Any + Send>

Convert self into the appropriate boxed form.
Source§

impl<T> IntoBox<dyn Any + Sync + Send> for T
where T: Any + Send + Sync,

Source§

fn into_box(self) -> Box<dyn Any + Sync + Send>

Convert self into the appropriate boxed form.
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more