Skip to content

Commit 15086ea

Browse files
committed
Fix Rust build and make MetadataPredicates public
1 parent ee88552 commit 15086ea

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

library/core/src/ub_checks.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub(crate) const fn is_nonoverlapping(
163163

164164
pub use predicates::*;
165165

166-
pub(crate) trait MetadataPredicates<T> where T: ?Sized {
166+
pub trait MetadataPredicates<T> where T: ?Sized {
167167
/// If the metadata is the length of a slice or str, run the map function.
168168
fn map_len<U, F>(metadata: *const Self, map: F) -> Option<U>
169169
where
@@ -193,7 +193,10 @@ impl<T> MetadataPredicates<T> for () {
193193
}
194194
}
195195

196-
impl<T> MetadataPredicates<T> for usize where T: ?Sized{
196+
impl<T> MetadataPredicates<T> for usize
197+
where
198+
T: ?Sized
199+
{
197200
/// Return the result of the map function.
198201
fn map_len<U, F>(metadata: *const Self, map: F) -> Option<U>
199202
where
@@ -211,7 +214,10 @@ impl<T> MetadataPredicates<T> for usize where T: ?Sized{
211214
}
212215
}
213216

214-
impl<T> MetadataPredicates<T> for crate::ptr::DynMetadata<T> where T: ?Sized {
217+
impl<T> MetadataPredicates<T> for crate::ptr::DynMetadata<T>
218+
where
219+
T: ?Sized
220+
{
215221
/// Not a length. Return None.
216222
fn map_len<U, F>(_metadata: *const Self, _map: F) -> Option<U>
217223
where
@@ -225,7 +231,7 @@ impl<T> MetadataPredicates<T> for crate::ptr::DynMetadata<T> where T: ?Sized {
225231
where
226232
F: Fn(*const crate::ptr::DynMetadata<T>) -> U,
227233
{
228-
Some(map(metadata))
234+
Some(map(metadata))
229235
}
230236
}
231237

0 commit comments

Comments
 (0)