Skip to content

Commit a579179

Browse files
committed
std: move FromInner etc. to sys
... and remove the `#[doc(hidden)]` in favour of making them `pub(crate)`.
1 parent f8a1bf9 commit a579179

File tree

2 files changed

+21
-26
lines changed

2 files changed

+21
-26
lines changed

library/std/src/sys/mod.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,24 @@ pub mod thread_local;
3737
// FIXME(117276): remove this, move feature implementations into individual
3838
// submodules.
3939
pub use pal::*;
40+
41+
/// A trait for viewing representations from std types.
42+
pub(crate) trait AsInner<Inner: ?Sized> {
43+
fn as_inner(&self) -> &Inner;
44+
}
45+
46+
/// A trait for viewing representations from std types.
47+
#[cfg_attr(not(target_os = "linux"), allow(unused))]
48+
pub(crate) trait AsInnerMut<Inner: ?Sized> {
49+
fn as_inner_mut(&mut self) -> &mut Inner;
50+
}
51+
52+
/// A trait for extracting representations from std types.
53+
pub(crate) trait IntoInner<Inner> {
54+
fn into_inner(self) -> Inner;
55+
}
56+
57+
/// A trait for creating std types from internal representations.
58+
pub(crate) trait FromInner<Inner> {
59+
fn from_inner(inner: Inner) -> Self;
60+
}

library/std/src/sys_common/mod.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,6 @@ pub mod wstr;
2323

2424
// common error constructors
2525

26-
/// A trait for viewing representations from std types
27-
#[doc(hidden)]
28-
#[allow(dead_code)] // not used on all platforms
29-
pub trait AsInner<Inner: ?Sized> {
30-
fn as_inner(&self) -> &Inner;
31-
}
32-
33-
/// A trait for viewing representations from std types
34-
#[doc(hidden)]
35-
#[allow(dead_code)] // not used on all platforms
36-
pub trait AsInnerMut<Inner: ?Sized> {
37-
fn as_inner_mut(&mut self) -> &mut Inner;
38-
}
39-
40-
/// A trait for extracting representations from std types
41-
#[doc(hidden)]
42-
pub trait IntoInner<Inner> {
43-
fn into_inner(self) -> Inner;
44-
}
45-
46-
/// A trait for creating std types from internal representations
47-
#[doc(hidden)]
48-
pub trait FromInner<Inner> {
49-
fn from_inner(inner: Inner) -> Self;
50-
}
51-
5226
// Computes (value*numerator)/denom without overflow, as long as both (numerator*denom) and the
5327
// overall result fit into i64 (which is the case for our time conversions).
5428
#[allow(dead_code)] // not used on all platforms

0 commit comments

Comments
 (0)