1 //! This is a fixture we use for tests that need lang items.
3 //! We want to include the minimal subset of core for each test, so this file
4 //! supports "conditional compilation". Tests use the following syntax to include minicore:
6 //! //- minicore: flag1, flag2
8 //! We then strip all the code marked with other flags.
13 //! coerce_unsized: unsize
29 #[rustc_specialization_trait]
35 pub trait Unsize<T: ?Sized> {}
40 // region:coerce_unsized
42 use crate::marker::Unsize;
44 #[lang = "coerce_unsized"]
45 pub trait CoerceUnsized<T: ?Sized> {}
47 impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a mut U> for &'a mut T {}
48 impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b mut T {}
49 impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for &'a mut T {}
50 impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for &'a mut T {}
52 impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {}
53 impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for &'a T {}
55 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for *mut T {}
56 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *mut T {}
57 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {}
59 pub use self::unsize::CoerceUnsized;
60 // endregion:coerce_unsized
66 #[lang = "deref_target"]
68 fn deref(&self) -> &Self::Target;
72 pub trait DerefMut: Deref {
73 fn deref_mut(&mut self) -> &mut Self::Target;
75 // endregion:deref_mut
77 pub use self::deref::Deref;
78 pub use self::deref::DerefMut; //:deref_mut
87 pub struct Range<Idx> {
93 pub struct RangeFrom<Idx> {
98 pub struct RangeTo<Idx> {
102 #[lang = "RangeInclusive"]
103 pub struct RangeInclusive<Idx> {
104 pub(crate) start: Idx,
106 pub(crate) exhausted: bool,
109 #[lang = "RangeToInclusive"]
110 pub struct RangeToInclusive<Idx> {
114 pub use self::range::{Range, RangeFrom, RangeFull, RangeTo};
115 pub use self::range::{RangeInclusive, RangeToInclusive};
122 pub trait Fn<Args>: FnMut<Args> {}
126 pub trait FnMut<Args>: FnOnce<Args> {}
130 pub trait FnOnce<Args> {
131 #[lang = "fn_once_output"]
135 pub use self::function::{Fn, FnMut, FnOnce};
143 pub fn len(&self) -> usize {
163 pub enum Result<T, E> {
186 task::{Context, Poll},
189 #[lang = "future_trait"]
193 fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>;
204 pub struct Context<'a> {
217 fn next(&mut self) -> Option<Self::Item>;
218 fn nth(&mut self, n: usize) -> Option<Self::Item> {
224 pub trait IntoIterator {
226 type IntoIter: Iterator<Item = Self::Item>;
227 #[lang = "into_iter"]
228 fn into_iter(self) -> Self::IntoIter;
230 impl<I: Iterator> IntoIterator for I {
233 fn into_iter(self) -> I {
238 pub use self::collect::IntoIterator;
239 pub use self::iterator::Iterator;
241 pub use self::traits::{IntoIterator, Iterator};
243 // endregion:iterator
248 iter::{IntoIterator, Iterator}, // :iterator
249 marker::Sized, // :sized
250 ops::{Fn, FnMut, FnOnce}, // :fn
251 option::Option::{self, None, Some}, // :option
252 result::Result::{self, Err, Ok}, // :result
257 pub use super::v1::*;
261 pub use super::v1::*;
265 pub use super::v1::*;