File tree Expand file tree Collapse file tree 3 files changed +3
-17
lines changed Expand file tree Collapse file tree 3 files changed +3
-17
lines changed Original file line number Diff line number Diff line change @@ -544,7 +544,7 @@ impl Sub<PhysAddr> for PhysAddr {
544
544
/// feature, the panic message will be "index out of bounds".
545
545
#[ inline]
546
546
pub const fn align_down ( addr : u64 , align : u64 ) -> u64 {
547
- const_assert ! ( align. is_power_of_two( ) , "`align` must be a power of two" ) ;
547
+ assert ! ( align. is_power_of_two( ) , "`align` must be a power of two" ) ;
548
548
addr & !( align - 1 )
549
549
}
550
550
@@ -556,7 +556,7 @@ pub const fn align_down(addr: u64, align: u64) -> u64 {
556
556
/// feature, the panic message will be "index out of bounds".
557
557
#[ inline]
558
558
pub const fn align_up ( addr : u64 , align : u64 ) -> u64 {
559
- const_assert ! ( align. is_power_of_two( ) , "`align` must be a power of two" ) ;
559
+ assert ! ( align. is_power_of_two( ) , "`align` must be a power of two" ) ;
560
560
let align_mask = align - 1 ;
561
561
if addr & align_mask == 0 {
562
562
addr // already aligned
Original file line number Diff line number Diff line change 2
2
//! and access to various system registers.
3
3
4
4
#![ cfg_attr( not( test) , no_std) ]
5
- #![ cfg_attr( feature = "const_fn" , feature( const_panic) ) ] // Better panic messages
6
5
#![ cfg_attr( feature = "const_fn" , feature( const_mut_refs) ) ] // GDT add_entry()
7
6
#![ cfg_attr( feature = "const_fn" , feature( const_fn_fn_ptr_basics) ) ] // IDT new()
8
7
#![ cfg_attr( feature = "const_fn" , feature( const_fn_trait_bound) ) ] // PageSize marker trait
@@ -45,19 +44,6 @@ macro_rules! const_fn {
45
44
} ;
46
45
}
47
46
48
- // Helper method for assert! in const fn. Uses out of bounds indexing if an
49
- // assertion fails and the "const_fn" feature is not enabled.
50
- #[ cfg( feature = "const_fn" ) ]
51
- macro_rules! const_assert {
52
- ( $cond: expr, $( $arg: tt) +) => { assert!( $cond, $( $arg) * ) } ;
53
- }
54
- #[ cfg( not( feature = "const_fn" ) ) ]
55
- macro_rules! const_assert {
56
- ( $cond: expr, $( $arg: tt) +) => {
57
- [ ( ) ; 1 ] [ !( $cond as bool ) as usize ]
58
- } ;
59
- }
60
-
61
47
#[ cfg( all( feature = "instructions" , feature = "external_asm" ) ) ]
62
48
pub ( crate ) mod asm;
63
49
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ impl GlobalDescriptorTable {
72
72
let mut table = [ 0 ; 8 ] ;
73
73
let mut idx = 0 ;
74
74
75
- const_assert ! (
75
+ assert ! (
76
76
next_free <= 8 ,
77
77
"initializing a GDT from a slice requires it to be **at most** 8 elements."
78
78
) ;
You can’t perform that action at this time.
0 commit comments