@@ -5,7 +5,6 @@ use crate::structures::mem_encrypt::ENC_BIT_MASK;
5
5
use crate :: structures:: paging:: page_table:: PageTableLevel ;
6
6
use crate :: structures:: paging:: { PageOffset , PageTableIndex } ;
7
7
use bit_field:: BitField ;
8
- use const_fn:: const_fn;
9
8
use core:: convert:: TryFrom ;
10
9
use core:: fmt;
11
10
#[ cfg( feature = "step_trait" ) ]
@@ -446,8 +445,8 @@ impl PhysAddr {
446
445
/// If the `memory_encryption` feature is available and has been enabled, this function also
447
446
/// panics fails if the encryption bit is manually set in the address.
448
447
#[ inline]
449
- #[ const_fn ( cfg ( not( feature = "memory_encryption" ) ) ) ]
450
- pub const fn new ( addr : u64 ) -> Self {
448
+ #[ cfg_attr ( all ( not( feature = "memory_encryption" ) , feature = "const_fn" ) , const_fn :: const_fn ) ]
449
+ pub fn new ( addr : u64 ) -> Self {
451
450
// TODO: Replace with .ok().expect(msg) when that works on stable.
452
451
match Self :: try_new ( addr) {
453
452
Ok ( p) => p,
@@ -471,8 +470,8 @@ impl PhysAddr {
471
470
/// If the `memory_encryption` feature is available and has been enabled, this also fails if the
472
471
/// encryption bit is manually set in the address.
473
472
#[ inline]
474
- #[ const_fn ( cfg ( not( feature = "memory_encryption" ) ) ) ]
475
- pub const fn try_new ( addr : u64 ) -> Result < Self , PhysAddrNotValid > {
473
+ #[ cfg_attr ( all ( not( feature = "memory_encryption" ) , feature = "const_fn" ) , const_fn :: const_fn ) ]
474
+ pub fn try_new ( addr : u64 ) -> Result < Self , PhysAddrNotValid > {
476
475
let p = Self :: new_truncate ( addr) ;
477
476
if p. 0 == addr {
478
477
Ok ( p)
0 commit comments