Skip to content

Commit e6ff36d

Browse files
committed
const_fn: Remove stablized features
Both `const_fn_fn_ptr_basics` and `const_fn_trait_bound` were stabilized in Rust relese 1.61. We can't immediately remove the `const_fn!` quite yet. 1.61 is not yet on stable, and even it were, removing them would increase our MSRV to 1.61 (which we may or may not want to do in a patch release). See also: #262 (comment) Signed-off-by: Joe Richey <[email protected]>
1 parent 8bec7be commit e6ff36d

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
44
#![cfg_attr(not(test), no_std)]
55
#![cfg_attr(feature = "const_fn", feature(const_mut_refs))] // GDT add_entry()
6-
#![cfg_attr(feature = "const_fn", feature(const_fn_fn_ptr_basics))] // IDT new()
7-
#![cfg_attr(feature = "const_fn", feature(const_fn_trait_bound))] // PageSize marker trait
86
#![cfg_attr(feature = "abi_x86_interrupt", feature(abi_x86_interrupt))]
97
#![cfg_attr(feature = "step_trait", feature(step_trait))]
108
#![cfg_attr(feature = "doc_cfg", feature(doc_cfg))]

src/structures/idt.rs

+1
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ pub struct InterruptDescriptorTable {
410410
}
411411

412412
impl InterruptDescriptorTable {
413+
// TODO: Remove const_fn! when our minimum supported stable Rust version is 1.61
413414
const_fn! {
414415
/// Creates a new IDT filled with non-present entries.
415416
#[inline]

src/structures/paging/frame.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ use core::ops::{Add, AddAssign, Sub, SubAssign};
1111
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
1212
#[repr(C)]
1313
pub struct PhysFrame<S: PageSize = Size4KiB> {
14-
pub(crate) start_address: PhysAddr, // TODO: remove when start_address() is const
14+
// TODO: Make private when our minimum supported stable Rust version is 1.61
15+
pub(crate) start_address: PhysAddr,
1516
size: PhantomData<S>,
1617
}
1718

@@ -29,6 +30,7 @@ impl<S: PageSize> PhysFrame<S> {
2930
Ok(unsafe { PhysFrame::from_start_address_unchecked(address) })
3031
}
3132

33+
// TODO: Remove const_fn! when our minimum supported stable Rust version is 1.61
3234
const_fn! {
3335
/// Returns the frame that starts at the given virtual address.
3436
///
@@ -53,6 +55,7 @@ impl<S: PageSize> PhysFrame<S> {
5355
}
5456
}
5557

58+
// TODO: Remove const_fn! when our minimum supported stable Rust version is 1.61
5659
const_fn! {
5760
/// Returns the start address of the frame.
5861
#[inline]
@@ -61,6 +64,7 @@ impl<S: PageSize> PhysFrame<S> {
6164
}
6265
}
6366

67+
// TODO: Remove const_fn! when our minimum supported stable Rust version is 1.61
6468
const_fn! {
6569
/// Returns the size the frame (4KB, 2MB or 1GB).
6670
#[inline]
@@ -69,6 +73,7 @@ impl<S: PageSize> PhysFrame<S> {
6973
}
7074
}
7175

76+
// TODO: Remove const_fn! when our minimum supported stable Rust version is 1.61
7277
const_fn! {
7378
/// Returns a range of frames, exclusive `end`.
7479
#[inline]
@@ -77,6 +82,7 @@ impl<S: PageSize> PhysFrame<S> {
7782
}
7883
}
7984

85+
// TODO: Remove const_fn! when our minimum supported stable Rust version is 1.61
8086
const_fn! {
8187
/// Returns a range of frames, inclusive `end`.
8288
#[inline]

src/structures/paging/page.rs

+9
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ impl<S: PageSize> Page<S> {
7777
Ok(Page::containing_address(address))
7878
}
7979

80+
// TODO: Remove const_fn! when our minimum supported stable Rust version is 1.61
8081
const_fn! {
8182
/// Returns the page that starts at the given virtual address.
8283
///
@@ -101,6 +102,7 @@ impl<S: PageSize> Page<S> {
101102
}
102103
}
103104

105+
// TODO: Remove const_fn! when our minimum supported stable Rust version is 1.61
104106
const_fn! {
105107
/// Returns the start address of the page.
106108
#[inline]
@@ -109,6 +111,7 @@ impl<S: PageSize> Page<S> {
109111
}
110112
}
111113

114+
// TODO: Remove const_fn! when our minimum supported stable Rust version is 1.61
112115
const_fn! {
113116
/// Returns the size the page (4KB, 2MB or 1GB).
114117
#[inline]
@@ -117,6 +120,7 @@ impl<S: PageSize> Page<S> {
117120
}
118121
}
119122

123+
// TODO: Remove const_fn! when our minimum supported stable Rust version is 1.61
120124
const_fn! {
121125
/// Returns the level 4 page table index of this page.
122126
#[inline]
@@ -125,6 +129,7 @@ impl<S: PageSize> Page<S> {
125129
}
126130
}
127131

132+
// TODO: Remove const_fn! when our minimum supported stable Rust version is 1.61
128133
const_fn! {
129134
/// Returns the level 3 page table index of this page.
130135
#[inline]
@@ -133,6 +138,7 @@ impl<S: PageSize> Page<S> {
133138
}
134139
}
135140

141+
// TODO: Remove const_fn! when our minimum supported stable Rust version is 1.61
136142
const_fn! {
137143
/// Returns the table index of this page at the specified level.
138144
#[inline]
@@ -141,6 +147,7 @@ impl<S: PageSize> Page<S> {
141147
}
142148
}
143149

150+
// TODO: Remove const_fn! when our minimum supported stable Rust version is 1.61
144151
const_fn! {
145152
/// Returns a range of pages, exclusive `end`.
146153
#[inline]
@@ -149,6 +156,7 @@ impl<S: PageSize> Page<S> {
149156
}
150157
}
151158

159+
// TODO: Remove const_fn! when our minimum supported stable Rust version is 1.61
152160
const_fn! {
153161
/// Returns a range of pages, inclusive `end`.
154162
#[inline]
@@ -159,6 +167,7 @@ impl<S: PageSize> Page<S> {
159167
}
160168

161169
impl<S: NotGiantPageSize> Page<S> {
170+
// TODO: Remove const_fn! when our minimum supported stable Rust version is 1.61
162171
const_fn! {
163172
/// Returns the level 2 page table index of this page.
164173
#[inline]

0 commit comments

Comments
 (0)