File tree Expand file tree Collapse file tree 2 files changed +15
-8
lines changed
crates/std_detect/src/detect Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ macro_rules! features {
52
52
#[ derive( Copy , Clone ) ]
53
53
#[ repr( u8 ) ]
54
54
#[ unstable( feature = "stdsimd_internal" , issue = "0" ) ]
55
- pub enum Feature {
55
+ pub ( crate ) enum Feature {
56
56
$(
57
57
$( #[ $feature_comment] ) *
58
58
$feature,
@@ -63,13 +63,13 @@ macro_rules! features {
63
63
}
64
64
65
65
impl Feature {
66
- pub fn to_str( self ) -> & ' static str {
66
+ pub ( crate ) fn to_str( self ) -> & ' static str {
67
67
match self {
68
68
$( Feature :: $feature => $feature_lit, ) *
69
69
Feature :: _last => unreachable!( ) ,
70
70
}
71
71
}
72
- pub fn from_str( s: & str ) -> Result <Feature , ( ) > {
72
+ pub ( crate ) fn from_str( s: & str ) -> Result <Feature , ( ) > {
73
73
match s {
74
74
$( $feature_lit => Ok ( Feature :: $feature) , ) *
75
75
_ => Err ( ( ) )
@@ -89,6 +89,7 @@ macro_rules! features {
89
89
90
90
/// PLEASE: do not use this, it is an implementation detail
91
91
/// subject to change.
92
+ #[ inline]
92
93
#[ doc( hidden) ]
93
94
#[ $stability_attr]
94
95
pub fn $feature( ) -> bool {
Original file line number Diff line number Diff line change @@ -56,22 +56,28 @@ cfg_if! {
56
56
// Unimplemented architecture:
57
57
mod arch {
58
58
#[ doc( hidden) ]
59
- pub enum Feature {
59
+ pub ( crate ) enum Feature {
60
60
Null
61
61
}
62
62
#[ doc( hidden) ]
63
63
pub mod __is_feature_detected { }
64
64
65
65
impl Feature {
66
66
#[ doc( hidden) ]
67
- pub fn from_str( _s: & str ) -> Result <Feature , ( ) > { Err ( ( ) ) }
67
+ pub ( crate ) fn from_str( _s: & str ) -> Result <Feature , ( ) > { Err ( ( ) ) }
68
68
#[ doc( hidden) ]
69
- pub fn to_str( self ) -> & ' static str { "" }
69
+ pub ( crate ) fn to_str( self ) -> & ' static str { "" }
70
70
}
71
71
}
72
72
}
73
73
}
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 ;
75
81
76
82
mod bit;
77
83
mod cache;
@@ -106,7 +112,7 @@ cfg_if! {
106
112
107
113
/// Performs run-time feature detection.
108
114
#[ inline]
109
- pub fn check_for ( x : Feature ) -> bool {
115
+ fn check_for ( x : Feature ) -> bool {
110
116
cache:: test ( x as u32 , self :: os:: detect_features)
111
117
}
112
118
You can’t perform that action at this time.
0 commit comments