File tree Expand file tree Collapse file tree 4 files changed +56
-3
lines changed
Expand file tree Collapse file tree 4 files changed +56
-3
lines changed Original file line number Diff line number Diff line change 4343 - name : ' Deny Warnings'
4444 run : cargo rustc -- -D warnings
4545
46+ test-stable :
47+ name : " Test stable without features"
48+
49+ strategy :
50+ matrix :
51+ platform : [
52+ ubuntu-latest,
53+ macos-latest,
54+ windows-latest
55+ ]
56+
57+ runs-on : ${{ matrix.platform }}
58+ timeout-minutes : 15
59+
60+ steps :
61+ - name : " Checkout Repository"
62+ uses : actions/checkout@v1
63+
64+ - name : " Print Rust Version"
65+ run : |
66+ rustc -Vv
67+ cargo -Vv
68+
69+ - name : " Build without feature on stable"
70+ run : cargo +stable build --no-default-features
71+
72+ - name : " Run cargo test without features on stable"
73+ run : cargo +stable test --no-default-features
74+
4675 test-unstable :
4776 name : " Test unstable features"
4877
Original file line number Diff line number Diff line change @@ -12,9 +12,10 @@ documentation = "https://docs.rs/crate/linked_list_allocator"
1212homepage = " http://os.phil-opp.com/kernel-heap.html#a-better-allocator"
1313
1414[features ]
15- default = [" use_spin" ]
15+ default = [" use_spin" , " const_mut_refs " ]
1616use_spin = [" spinning_top" ]
1717alloc_ref = []
18+ const_mut_refs = []
1819
1920[dependencies .spinning_top ]
2021version = " 0.1.0"
Original file line number Diff line number Diff line change @@ -11,6 +11,18 @@ pub struct HoleList {
1111
1212impl HoleList {
1313 /// Creates an empty `HoleList`.
14+ #[ cfg( not( feature = "const_mut_refs" ) ) ]
15+ pub fn empty ( ) -> HoleList {
16+ HoleList {
17+ first : Hole {
18+ size : 0 ,
19+ next : None ,
20+ } ,
21+ }
22+ }
23+
24+ /// Creates an empty `HoleList`.
25+ #[ cfg( feature = "const_mut_refs" ) ]
1426 pub const fn empty ( ) -> HoleList {
1527 HoleList {
1628 first : Hole {
@@ -26,7 +38,7 @@ impl HoleList {
2638 ///
2739 /// The pointer to `hole_addr` is automatically aligned.
2840 pub unsafe fn new ( hole_addr : usize , hole_size : usize ) -> HoleList {
29- assert ! ( size_of:: <Hole >( ) == Self :: min_size( ) ) ;
41+ assert_eq ! ( size_of:: <Hole >( ) , Self :: min_size( ) ) ;
3042
3143 let aligned_hole_addr = align_up ( hole_addr, align_of :: < Hole > ( ) ) ;
3244 let ptr = aligned_hole_addr as * mut Hole ;
Original file line number Diff line number Diff line change 1- #![ feature( const_mut_refs) ]
1+ #![ cfg_attr ( feature = "const_mut_refs" , feature ( const_mut_refs) ) ]
22#![ cfg_attr(
33 feature = "alloc_ref" ,
44 feature( allocator_api, alloc_layout_extra, nonnull_slice_from_raw_parts)
@@ -41,6 +41,17 @@ pub struct Heap {
4141
4242impl Heap {
4343 /// Creates an empty heap. All allocate calls will return `None`.
44+ #[ cfg( not( feature = "const_mut_refs" ) ) ]
45+ pub fn empty ( ) -> Heap {
46+ Heap {
47+ bottom : 0 ,
48+ size : 0 ,
49+ used : 0 ,
50+ holes : HoleList :: empty ( ) ,
51+ }
52+ }
53+
54+ #[ cfg( feature = "const_mut_refs" ) ]
4455 pub const fn empty ( ) -> Heap {
4556 Heap {
4657 bottom : 0 ,
You can’t perform that action at this time.
0 commit comments