File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -3663,6 +3663,14 @@ mod utils {
3663
3663
) {
3664
3664
let prefix = ctx. trait_prefix ( ) ;
3665
3665
3666
+ // If the target supports `const fn`, declare eligible functions
3667
+ // as `const fn` else just `fn`.
3668
+ let const_fn = if ctx. options ( ) . rust_features ( ) . min_const_fn {
3669
+ quote ! { const fn }
3670
+ } else {
3671
+ quote ! { fn }
3672
+ } ;
3673
+
3666
3674
// TODO(emilio): The fmt::Debug impl could be way nicer with
3667
3675
// std::intrinsics::type_name, but...
3668
3676
let union_field_decl = quote ! {
@@ -3673,7 +3681,7 @@ mod utils {
3673
3681
let union_field_impl = quote ! {
3674
3682
impl <T > __BindgenUnionField<T > {
3675
3683
#[ inline]
3676
- pub fn new( ) -> Self {
3684
+ pub #const_fn new( ) -> Self {
3677
3685
__BindgenUnionField( :: #prefix:: marker:: PhantomData )
3678
3686
}
3679
3687
Original file line number Diff line number Diff line change 11
11
pub struct __BindgenUnionField < T > ( :: std:: marker:: PhantomData < T > ) ;
12
12
impl < T > __BindgenUnionField < T > {
13
13
#[ inline]
14
- pub fn new ( ) -> Self {
14
+ pub const fn new ( ) -> Self {
15
15
__BindgenUnionField ( :: std:: marker:: PhantomData )
16
16
}
17
17
#[ inline]
You can’t perform that action at this time.
0 commit comments