Skip to content

Commit e2ab0c6

Browse files
committed
fix: make from_bits_unchecked const
1 parent f00dc02 commit e2ab0c6

File tree

9 files changed

+13
-13
lines changed

9 files changed

+13
-13
lines changed

src/registers/control.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ bitflags! {
5454
impl Cr0Flags {
5555
#[deprecated = "use the safe `from_bits_retain` method instead"]
5656
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
57-
pub unsafe fn from_bits_unchecked(bits: u64) -> Self {
57+
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
5858
Self::from_bits_retain(bits)
5959
}
6060
}
@@ -85,7 +85,7 @@ bitflags! {
8585
impl Cr3Flags {
8686
#[deprecated = "use the safe `from_bits_retain` method instead"]
8787
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
88-
pub unsafe fn from_bits_unchecked(bits: u64) -> Self {
88+
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
8989
Self::from_bits_retain(bits)
9090
}
9191
}
@@ -181,7 +181,7 @@ bitflags! {
181181
impl Cr4Flags {
182182
#[deprecated = "use the safe `from_bits_retain` method instead"]
183183
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
184-
pub unsafe fn from_bits_unchecked(bits: u64) -> Self {
184+
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
185185
Self::from_bits_retain(bits)
186186
}
187187
}

src/registers/debug.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl Dr6Flags {
163163

164164
#[deprecated = "use the safe `from_bits_retain` method instead"]
165165
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
166-
pub unsafe fn from_bits_unchecked(bits: u64) -> Self {
166+
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
167167
Self::from_bits_retain(bits)
168168
}
169169
}
@@ -242,7 +242,7 @@ impl Dr7Flags {
242242

243243
#[deprecated = "use the safe `from_bits_retain` method instead"]
244244
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
245-
pub unsafe fn from_bits_unchecked(bits: u64) -> Self {
245+
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
246246
Self::from_bits_retain(bits)
247247
}
248248
}

src/registers/model_specific.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ bitflags! {
135135
impl EferFlags {
136136
#[deprecated = "use the safe `from_bits_retain` method instead"]
137137
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
138-
pub unsafe fn from_bits_unchecked(bits: u64) -> Self {
138+
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
139139
Self::from_bits_retain(bits)
140140
}
141141
}
@@ -168,7 +168,7 @@ bitflags! {
168168
impl CetFlags {
169169
#[deprecated = "use the safe `from_bits_retain` method instead"]
170170
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
171-
pub unsafe fn from_bits_unchecked(bits: u64) -> Self {
171+
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
172172
Self::from_bits_retain(bits)
173173
}
174174
}

src/registers/mxcsr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl Default for MxCsr {
6363
impl MxCsr {
6464
#[deprecated = "use the safe `from_bits_retain` method instead"]
6565
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
66-
pub unsafe fn from_bits_unchecked(bits: u32) -> Self {
66+
pub const unsafe fn from_bits_unchecked(bits: u32) -> Self {
6767
Self::from_bits_retain(bits)
6868
}
6969
}

src/registers/rflags.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ bitflags! {
6767
impl RFlags {
6868
#[deprecated = "use the safe `from_bits_retain` method instead"]
6969
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
70-
pub unsafe fn from_bits_unchecked(bits: u64) -> Self {
70+
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
7171
Self::from_bits_retain(bits)
7272
}
7373
}

src/registers/xcontrol.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ bitflags! {
5656
impl XCr0Flags {
5757
#[deprecated = "use the safe `from_bits_retain` method instead"]
5858
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
59-
pub unsafe fn from_bits_unchecked(bits: u64) -> Self {
59+
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
6060
Self::from_bits_retain(bits)
6161
}
6262
}

src/structures/gdt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ impl DescriptorFlags {
272272

273273
#[deprecated = "use the safe `from_bits_retain` method instead"]
274274
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
275-
pub unsafe fn from_bits_unchecked(bits: u64) -> Self {
275+
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
276276
Self::from_bits_retain(bits)
277277
}
278278
}

src/structures/idt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ bitflags! {
10121012
impl PageFaultErrorCode {
10131013
#[deprecated = "use the safe `from_bits_retain` method instead"]
10141014
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
1015-
pub unsafe fn from_bits_unchecked(bits: u64) -> Self {
1015+
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
10161016
Self::from_bits_retain(bits)
10171017
}
10181018
}

src/structures/paging/page_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ bitflags! {
172172
impl PageTableFlags {
173173
#[deprecated = "use the safe `from_bits_retain` method instead"]
174174
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
175-
pub unsafe fn from_bits_unchecked(bits: u64) -> Self {
175+
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
176176
Self::from_bits_retain(bits)
177177
}
178178
}

0 commit comments

Comments
 (0)