Skip to content

Commit

Permalink
Increase MSRV to 1.79
Browse files Browse the repository at this point in the history
Mark a few new functions `const` to satisfy clippy lints.

Also drop the "Keep in Sync with README!" comment for the MSRV doc; it's not in
the readme anymore.
  • Loading branch information
nicholasbishop committed Oct 27, 2024
1 parent 9a4c435 commit acd5a84
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/msrv_toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.70"
channel = "1.79"
targets = ["aarch64-unknown-uefi", "i686-unknown-uefi", "x86_64-unknown-uefi"]
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ edition = "2021"
keywords = ["uefi", "efi"]
license = "MPL-2.0"
repository = "https://github.com/rust-osdev/uefi-rs"
rust-version = "1.70"
rust-version = "1.79"

[workspace.dependencies]
bitflags = "2.0.0"
Expand Down
3 changes: 3 additions & 0 deletions uefi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# uefi - [Unreleased]

## Changed
- MSRV increased to 1.79.


# uefi - 0.33.0 (2024-10-23)

Expand Down
2 changes: 1 addition & 1 deletion uefi/src/data_types/unaligned_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl<'a, T: Copy> UnalignedSlice<'a, T> {
/// Returns the element at `index`, or `None` if the `index` is out
/// of bounds.
#[must_use]
pub fn get(&self, index: usize) -> Option<T> {
pub const fn get(&self, index: usize) -> Option<T> {
if index < self.len {
Some(unsafe { self.data.add(index).read_unaligned() })
} else {
Expand Down
3 changes: 1 addition & 2 deletions uefi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@
//! can't test all possible hardware/firmware/platform combinations in CI.
//!
//! ## MSRV
//! <!-- Keep in Sync with README! -->
//!
//! The minimum supported Rust version is currently 1.70.
//! The minimum supported Rust version is currently 1.79.
//! Our policy is to support at least the past two stable releases.
//!
//! # API/User Documentation, Documentation Structure, and other Resources
Expand Down
2 changes: 1 addition & 1 deletion uefi/src/mem/memory_map/impl_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ impl MemoryMapBackingMemory {

/// Returns a slice to the underlying memory.
#[must_use]
pub fn as_slice(&self) -> &[u8] {
pub const fn as_slice(&self) -> &[u8] {
unsafe { self.0.as_ref() }
}

Expand Down
6 changes: 3 additions & 3 deletions uefi/src/proto/driver/component_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl ComponentName1 {
/// English is encoded as "eng".
///
/// [ISO 639-2]: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
pub fn supported_languages(&self) -> core::result::Result<LanguageIter, LanguageError> {
pub const fn supported_languages(&self) -> core::result::Result<LanguageIter, LanguageError> {

Check warning on line 44 in uefi/src/proto/driver/component_name.rs

View check run for this annotation

Codecov / codecov/patch

uefi/src/proto/driver/component_name.rs#L44

Added line #L44 was not covered by tests
LanguageIter::new(self.0.supported_languages, LanguageIterKind::V1)
}

Expand Down Expand Up @@ -108,7 +108,7 @@ impl ComponentName2 {
/// as "en".
///
/// [RFC 4646]: https://www.rfc-editor.org/rfc/rfc4646
pub fn supported_languages(&self) -> core::result::Result<LanguageIter, LanguageError> {
pub const fn supported_languages(&self) -> core::result::Result<LanguageIter, LanguageError> {

Check warning on line 111 in uefi/src/proto/driver/component_name.rs

View check run for this annotation

Codecov / codecov/patch

uefi/src/proto/driver/component_name.rs#L111

Added line #L111 was not covered by tests
LanguageIter::new(self.0.supported_languages, LanguageIterKind::V2)
}

Expand Down Expand Up @@ -266,7 +266,7 @@ pub struct LanguageIter<'a> {
}

impl<'a> LanguageIter<'a> {
fn new(
const fn new(
languages: *const u8,
kind: LanguageIterKind,
) -> core::result::Result<Self, LanguageError> {
Expand Down

0 comments on commit acd5a84

Please sign in to comment.