Skip to content

Commit fb6ea98

Browse files
committed
These items do not need to be public
1 parent e7f1180 commit fb6ea98

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

crates/std_detect/src/detect/macros.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ macro_rules! features {
5252
#[derive(Copy, Clone)]
5353
#[repr(u8)]
5454
#[unstable(feature = "stdsimd_internal", issue = "0")]
55-
pub enum Feature {
55+
pub(crate) enum Feature {
5656
$(
5757
$(#[$feature_comment])*
5858
$feature,
@@ -63,13 +63,13 @@ macro_rules! features {
6363
}
6464

6565
impl Feature {
66-
pub fn to_str(self) -> &'static str {
66+
pub(crate) fn to_str(self) -> &'static str {
6767
match self {
6868
$(Feature::$feature => $feature_lit,)*
6969
Feature::_last => unreachable!(),
7070
}
7171
}
72-
pub fn from_str(s: &str) -> Result<Feature, ()> {
72+
pub(crate) fn from_str(s: &str) -> Result<Feature, ()> {
7373
match s {
7474
$($feature_lit => Ok(Feature::$feature),)*
7575
_ => Err(())
@@ -89,6 +89,7 @@ macro_rules! features {
8989

9090
/// PLEASE: do not use this, it is an implementation detail
9191
/// subject to change.
92+
#[inline]
9293
#[doc(hidden)]
9394
#[$stability_attr]
9495
pub fn $feature() -> bool {

crates/std_detect/src/detect/mod.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,28 @@ cfg_if! {
5656
// Unimplemented architecture:
5757
mod arch {
5858
#[doc(hidden)]
59-
pub enum Feature {
59+
pub(crate) enum Feature {
6060
Null
6161
}
6262
#[doc(hidden)]
6363
pub mod __is_feature_detected {}
6464

6565
impl Feature {
6666
#[doc(hidden)]
67-
pub fn from_str(_s: &str) -> Result<Feature, ()> { Err(()) }
67+
pub(crate) fn from_str(_s: &str) -> Result<Feature, ()> { Err(()) }
6868
#[doc(hidden)]
69-
pub fn to_str(self) -> &'static str { "" }
69+
pub(crate) fn to_str(self) -> &'static str { "" }
7070
}
7171
}
7272
}
7373
}
74-
pub use self::arch::{Feature, __is_feature_detected};
74+
75+
// This module needs to be public because the `is_{arch}_feature_detected!`
76+
// macros expand calls to items within it in user crates.
77+
#[doc(hidden)]
78+
pub use self::arch::__is_feature_detected;
79+
80+
pub(crate) use self::arch::Feature;
7581

7682
mod bit;
7783
mod cache;
@@ -106,7 +112,7 @@ cfg_if! {
106112

107113
/// Performs run-time feature detection.
108114
#[inline]
109-
pub fn check_for(x: Feature) -> bool {
115+
fn check_for(x: Feature) -> bool {
110116
cache::test(x as u32, self::os::detect_features)
111117
}
112118

0 commit comments

Comments
 (0)