Skip to content

Commit 52e5269

Browse files
Don't rely on promotion of PageTableEntry::new inside a const fn
Hi! Rust compiler team member here. When the `const_fn` feature is enabled, the implementation of `PageTable::new` relies on a compiler bug to work. Specifically, `PageTableEntry::new` should not be eligible for promotion as part of an array initializer. See rust-lang/rust#75502 for more information. This bug may be fixed in the future, which will cause this crate to stop compiling.
1 parent 8b2b5a3 commit 52e5269

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/structures/paging/page_table.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ impl PageTable {
189189
#[inline]
190190
pub const fn new() -> Self {
191191
PageTable {
192-
entries: [PageTableEntry::new(); ENTRY_COUNT],
192+
entries: [PageTableEntry { entry: 0 }; ENTRY_COUNT],
193193
}
194194
}
195195

0 commit comments

Comments
 (0)