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.
16 //! coerce_unsized: unsize
26 #[rustc_specialization_trait]
32 pub trait Unsize<T: ?Sized> {}
37 // region:coerce_unsized
39 use crate::marker::Unsize;
41 #[lang = "coerce_unsized"]
42 pub trait CoerceUnsized<T: ?Sized> {}
44 impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a mut U> for &'a mut T {}
45 impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b mut T {}
46 impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for &'a mut T {}
47 impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for &'a mut T {}
49 impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {}
50 impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for &'a T {}
52 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for *mut T {}
53 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *mut T {}
54 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {}
56 pub use self::unsize::CoerceUnsized;
57 // endregion:coerce_unsized
63 #[lang = "deref_target"]
65 fn deref(&self) -> &Self::Target;
68 pub use self::deref::Deref;
77 pub struct Range<Idx> {
83 pub struct RangeFrom<Idx> {
88 pub struct RangeTo<Idx> {
92 #[lang = "RangeInclusive"]
93 pub struct RangeInclusive<Idx> {
94 pub(crate) start: Idx,
96 pub(crate) exhausted: bool,
99 #[lang = "RangeToInclusive"]
100 pub struct RangeToInclusive<Idx> {
104 pub use self::range::{Range, RangeFrom, RangeFull, RangeTo};
105 pub use self::range::{RangeInclusive, RangeToInclusive};
113 pub fn len(&self) -> usize {
133 pub enum Result<T, E> {
156 task::{Context, Poll},
159 #[lang = "future_trait"]
163 fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>;
174 pub struct Context<'a> {
183 marker::Sized, // :sized
184 option::Option::{self, None, Some}, // :option
185 result::Result::{self, Err, Ok}, // :result
190 pub use super::v1::*;
194 pub use super::v1::*;
198 pub use super::v1::*;