Skip to content

Commit

Permalink
Don't rely on promotion of PageTableEntry::new inside a const fn
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ecstatic-morse authored Sep 1, 2020
1 parent 8b2b5a3 commit 52e5269
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/structures/paging/page_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl PageTable {
#[inline]
pub const fn new() -> Self {
PageTable {
entries: [PageTableEntry::new(); ENTRY_COUNT],
entries: [PageTableEntry { entry: 0 }; ENTRY_COUNT],
}
}

Expand Down

0 comments on commit 52e5269

Please sign in to comment.