Skip to content

Commit 9d94af3

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 9d94af3

File tree

2 files changed

+22
-26
lines changed

2 files changed

+22
-26
lines changed

library/std/src/sys/mod.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,25 @@ 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+
#[cfg_attr(not(target_os = "linux"), allow(unused))]
43+
pub(crate) trait AsInner<Inner: ?Sized> {
44+
fn as_inner(&self) -> &Inner;
45+
}
46+
47+
/// A trait for viewing representations from std types.
48+
#[cfg_attr(not(target_os = "linux"), allow(unused))]
49+
pub(crate) trait AsInnerMut<Inner: ?Sized> {
50+
fn as_inner_mut(&mut self) -> &mut Inner;
51+
}
52+
53+
/// A trait for extracting representations from std types.
54+
pub(crate) trait IntoInner<Inner> {
55+
fn into_inner(self) -> Inner;
56+
}
57+
58+
/// A trait for creating std types from internal representations.
59+
pub(crate) trait FromInner<Inner> {
60+
fn from_inner(inner: Inner) -> Self;
61+
}

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)