Skip to content

Commit def4212

Browse files
committed
only make append & push const on Rust 1.83+
1 parent e045300 commit def4212

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/structures/gdt.rs

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

247248
#[inline]
248-
const fn push(&mut self, value: u64) -> usize {
249+
#[rustversion::attr(since(1.83), const)]
250+
fn push(&mut self, value: u64) -> usize {
249251
let index = self.len;
250252
self.table[index] = Entry::new(value);
251253
self.len += 1;

0 commit comments

Comments
 (0)