Skip to content

Commit d3e28e9

Browse files
committed
Remove stabilized const_mut_refs feature
Make `GDT::append` and `GDT::push` `const` by default. The `const_fn` feature is now a no-op.
1 parent 7b47163 commit d3e28e9

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ rustversion = "1.0.5"
2828
[features]
2929
default = ["nightly", "instructions"]
3030
instructions = []
31-
nightly = [ "const_fn", "step_trait", "abi_x86_interrupt", "asm_const" ]
31+
nightly = ["const_fn", "step_trait", "abi_x86_interrupt", "asm_const"]
3232
abi_x86_interrupt = []
33+
# deprecated, no longer needed
3334
const_fn = []
3435
asm_const = []
3536
step_trait = []

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//! and access to various system registers.
33
44
#![cfg_attr(not(test), no_std)]
5-
#![cfg_attr(feature = "const_fn", feature(const_mut_refs))] // GDT::append()
65
#![cfg_attr(feature = "abi_x86_interrupt", feature(abi_x86_interrupt))]
76
#![cfg_attr(feature = "step_trait", feature(step_trait))]
87
#![cfg_attr(feature = "doc_auto_cfg", feature(doc_auto_cfg))]

src/structures/gdt.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,7 @@ impl<const MAX: usize> GlobalDescriptorTable<MAX> {
193193
///
194194
/// Panics if the GDT doesn't have enough free entries.
195195
#[inline]
196-
#[cfg_attr(feature = "const_fn", rustversion::attr(all(), const))]
197-
pub fn append(&mut self, entry: Descriptor) -> SegmentSelector {
196+
pub const fn append(&mut self, entry: Descriptor) -> SegmentSelector {
198197
let index = match entry {
199198
Descriptor::UserSegment(value) => {
200199
if self.len > self.table.len().saturating_sub(1) {
@@ -246,8 +245,7 @@ impl<const MAX: usize> GlobalDescriptorTable<MAX> {
246245
}
247246

248247
#[inline]
249-
#[cfg_attr(feature = "const_fn", rustversion::attr(all(), const))]
250-
fn push(&mut self, value: u64) -> usize {
248+
const fn push(&mut self, value: u64) -> usize {
251249
let index = self.len;
252250
self.table[index] = Entry::new(value);
253251
self.len += 1;

0 commit comments

Comments
 (0)