File tree Expand file tree Collapse file tree 3 files changed +26
-10
lines changed Expand file tree Collapse file tree 3 files changed +26
-10
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ std = []
28
28
align = []
29
29
rustc-dep-of-std = [' align' , ' rustc-std-workspace-core' ]
30
30
extra_traits = []
31
+ const-fn = []
31
32
# use_std is deprecated, use `std` instead
32
33
use_std = [ ' std' ]
33
34
Original file line number Diff line number Diff line change 34
34
#![ no_std]
35
35
#![ cfg_attr( feature = "rustc-dep-of-std" , no_core) ]
36
36
#![ cfg_attr( target_os = "redox" , feature( static_nobundle) ) ]
37
- #![ feature( const_extern_fn) ]
37
+ #![ cfg_attr ( feature = "const-fn" , feature ( const_extern_fn) ) ]
38
38
39
39
#[ macro_use]
40
40
mod macros;
Original file line number Diff line number Diff line change @@ -121,16 +121,31 @@ macro_rules! s_no_extra_traits {
121
121
) ;
122
122
}
123
123
124
- #[ allow( unused_macros) ]
125
- macro_rules! f {
126
- ( $( pub fn $i: ident( $( $arg: ident: $argty: ty) ,* ) $( $constness: ident) * -> $ret: ty {
127
- $( $body: stmt) ;*
128
- } ) * ) => ( $(
129
- #[ inline]
130
- pub $( $constness) * unsafe extern fn $i( $( $arg: $argty) ,* ) -> $ret {
131
- $( $body) ;*
124
+ cfg_if ! {
125
+ if #[ cfg( feature = "const-fn" ) ] {
126
+ #[ allow( unused_macros) ]
127
+ macro_rules! f {
128
+ ( $( pub fn $i: ident( $( $arg: ident: $argty: ty) , * ) $( $constness: ident) * -> $ret: ty {
129
+ $( $body: stmt) ; *
130
+ } ) * ) => ( $(
131
+ #[ inline]
132
+ pub $( $constness) * unsafe extern fn $i( $( $arg: $argty) , * ) -> $ret {
133
+ $( $body) ; *
134
+ }
135
+ ) * )
132
136
}
133
- ) * )
137
+ } else {
138
+ macro_rules! f {
139
+ ( $( pub fn $i: ident( $( $arg: ident: $argty: ty) , * ) $( $constness: ident) * -> $ret: ty {
140
+ $( $body: stmt) ; *
141
+ } ) * ) => ( $(
142
+ #[ inline]
143
+ pub unsafe extern fn $i( $( $arg: $argty) , * ) -> $ret {
144
+ $( $body) ; *
145
+ }
146
+ ) * )
147
+ }
148
+ }
134
149
}
135
150
136
151
#[ allow( unused_macros) ]
You can’t perform that action at this time.
0 commit comments