File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 116116#![ feature( link_cfg) ]
117117#![ feature( offset_of_enum) ]
118118#![ feature( panic_internals) ]
119+ #![ feature( pattern_type_macro) ]
119120#![ feature( ptr_alignment_type) ]
120121#![ feature( ptr_metadata) ]
121122#![ feature( set_ptr_value) ]
171172#![ feature( never_type) ]
172173#![ feature( no_core) ]
173174#![ feature( optimize_attribute) ]
175+ #![ feature( pattern_types) ]
174176#![ feature( prelude_import) ]
175177#![ feature( reborrow) ]
176178#![ feature( repr_simd) ]
Original file line number Diff line number Diff line change 11//! Helper module for exporting the `pattern_type` macro
22
3+ use crate :: marker:: { Freeze , PointeeSized , Unsize } ;
4+ use crate :: ops:: { CoerceUnsized , DispatchFromDyn } ;
5+
36/// Creates a pattern type.
47/// ```ignore (cannot test this from within core yet)
58/// type Positive = std::pat::pattern_type!(i32 is 1..);
@@ -73,3 +76,16 @@ impl const RangePattern for char {
7376 }
7477 }
7578}
79+
80+ impl < T : PointeeSized , U : PointeeSized > CoerceUnsized < pattern_type ! ( * const U is !null) > for pattern_type ! ( * const T is !null) where
81+ T : Unsize < U >
82+ {
83+ }
84+
85+ impl < T : DispatchFromDyn < U > , U > DispatchFromDyn < pattern_type ! ( U is !null) > for pattern_type ! ( T is !null) { }
86+
87+ impl < T : PointeeSized > Unpin for pattern_type ! ( * const T is !null) { }
88+
89+ unsafe impl < T : PointeeSized > Freeze for pattern_type ! ( * const T is !null) { }
90+
91+ unsafe impl < T : PointeeSized > Freeze for pattern_type ! ( * mut T is !null) { }
You can’t perform that action at this time.
0 commit comments