From 52e52693d9aac944c174dcd1863d8c72a1d59efb Mon Sep 17 00:00:00 2001 From: ecstatic-morse Date: Tue, 1 Sep 2020 12:18:38 -0700 Subject: [PATCH] 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. --- src/structures/paging/page_table.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/paging/page_table.rs b/src/structures/paging/page_table.rs index 8605d28a5..24c6f5947 100644 --- a/src/structures/paging/page_table.rs +++ b/src/structures/paging/page_table.rs @@ -189,7 +189,7 @@ impl PageTable { #[inline] pub const fn new() -> Self { PageTable { - entries: [PageTableEntry::new(); ENTRY_COUNT], + entries: [PageTableEntry { entry: 0 }; ENTRY_COUNT], } }