diff options
Diffstat (limited to 'crates/test_utils')
-rw-r--r-- | crates/test_utils/src/minicore.rs | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/crates/test_utils/src/minicore.rs b/crates/test_utils/src/minicore.rs index 8f8f1c9f8..a61459f6d 100644 --- a/crates/test_utils/src/minicore.rs +++ b/crates/test_utils/src/minicore.rs | |||
@@ -9,7 +9,9 @@ | |||
9 | //! | 9 | //! |
10 | //! Available flags: | 10 | //! Available flags: |
11 | //! sized: | 11 | //! sized: |
12 | //! slice: | ||
12 | //! unsize: sized | 13 | //! unsize: sized |
14 | //! deref: sized | ||
13 | //! coerce_unsized: unsize | 15 | //! coerce_unsized: unsize |
14 | 16 | ||
15 | pub mod marker { | 17 | pub mod marker { |
@@ -27,8 +29,8 @@ pub mod marker { | |||
27 | } | 29 | } |
28 | 30 | ||
29 | pub mod ops { | 31 | pub mod ops { |
32 | // region:coerce_unsized | ||
30 | mod unsize { | 33 | mod unsize { |
31 | // region:coerce_unsized | ||
32 | use crate::marker::Unsize; | 34 | use crate::marker::Unsize; |
33 | 35 | ||
34 | #[lang = "coerce_unsized"] | 36 | #[lang = "coerce_unsized"] |
@@ -45,11 +47,31 @@ pub mod ops { | |||
45 | impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for *mut T {} | 47 | impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for *mut T {} |
46 | impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *mut T {} | 48 | impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *mut T {} |
47 | impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {} | 49 | impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {} |
48 | // endregion:coerce_unsized | ||
49 | } | 50 | } |
51 | pub use self::unsize::CoerceUnsized; | ||
52 | // endregion:coerce_unsized | ||
50 | 53 | ||
51 | pub use self::unsize::CoerceUnsized; // :coerce_unsized | 54 | // region:deref |
55 | mod deref { | ||
56 | #[lang = "deref"] | ||
57 | pub trait Deref { | ||
58 | #[lang = "deref_target"] | ||
59 | type Target: ?Sized; | ||
60 | fn deref(&self) -> &Self::Target; | ||
61 | } | ||
62 | } | ||
63 | pub use self::deref::Deref; | ||
64 | // endregion:deref | ||
65 | } | ||
66 | |||
67 | // region:slice | ||
68 | pub mod slice { | ||
69 | #[lang = "slice"] | ||
70 | impl<T> [T] { | ||
71 | pub fn len(&self) -> usize { loop {} } | ||
72 | } | ||
52 | } | 73 | } |
74 | // endregion:slice | ||
53 | 75 | ||
54 | pub mod prelude { | 76 | pub mod prelude { |
55 | pub mod v1 { | 77 | pub mod v1 { |