File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change
1
+ #![ feature( const_intoiterator_identity) ]
1
2
#![ feature( generic_const_exprs) ]
2
3
#![ feature( const_refs_to_cell) ]
3
4
#![ feature( const_trait_impl) ]
4
5
#![ feature( naked_functions) ]
5
6
#![ feature( const_mut_refs) ]
6
7
#![ feature( slice_ptr_get) ]
7
8
#![ feature( slice_ptr_len) ]
9
+ #![ feature( const_iter) ]
8
10
#![ feature( decl_macro) ]
9
11
#![ feature( asm_const) ]
12
+ #![ feature( const_for) ]
10
13
#![ deny( unsafe_op_in_unsafe_fn) ]
11
14
#![ cfg_attr(
12
15
feature = "doc" ,
Original file line number Diff line number Diff line change @@ -15,22 +15,19 @@ pub type InterruptHandlerTable = [InterruptHandler; NUM_INTERRUPTS];
15
15
/// Used by `use_port!`
16
16
pub const fn make_interrupt_handler_table < Traits : KernelTraits > ( ) -> InterruptHandlerTable {
17
17
let mut table = [ InterruptHandler { undefined : 0 } ; NUM_INTERRUPTS ] ;
18
- let mut i = 0 ;
19
18
20
- // `for` is unusable in `const fn` [ref:const_for]
21
- while i < table. len ( ) {
19
+ // `[T]::iter_mut` is unusable in `const fn` [ref:const_slice_iter]
20
+ // `core::array::from_fn` is not `const fn` [ref:const_array_from_fn]
21
+ for i in 0 ..table. len ( ) {
22
22
table[ i] = if let Some ( x) = Traits :: INTERRUPT_HANDLERS . get ( i + 16 ) {
23
23
InterruptHandler { defined : x }
24
24
} else {
25
25
InterruptHandler { undefined : 0 }
26
26
} ;
27
- i += 1 ;
28
27
}
29
28
30
29
// Disallow registering in range `0..16` except for SysTick
31
- i = 0 ;
32
- // `for` is unusable in `const fn` [ref:const_for]
33
- while i < 16 {
30
+ for i in 0 ..16 {
34
31
if i != INTERRUPT_SYSTICK {
35
32
// TODO: This check trips even if no handler is registered at `i`
36
33
#[ cfg( any( ) ) ]
@@ -40,7 +37,6 @@ pub const fn make_interrupt_handler_table<Traits: KernelTraits>() -> InterruptHa
40
37
disallowed except for SysTick"
41
38
) ;
42
39
}
43
- i += 1 ;
44
40
}
45
41
46
42
table
You can’t perform that action at this time.
0 commit comments