Skip to content

Commit

Permalink
Bump minimum supported Rust version to 1.78
Browse files Browse the repository at this point in the history
Bump the minimum supported Rust version to 1.78. This version will be
required to use newer versions of cargo_metadata.

Signed-off-by: Daniel Müller <deso@posteo.net>
  • Loading branch information
d-e-s-o committed Jan 22, 2025
1 parent e4b1736 commit 79a7f08
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
with:
# Please adjust README and rust-version field in Cargo.toml files when
# bumping version.
toolchain: 1.71.0
toolchain: 1.78.0
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[workspace.package]
version = "0.25.0-beta.1"
edition = "2021"
rust-version = "1.71"
rust-version = "1.78"
license = "LGPL-2.1-only OR BSD-2-Clause"
repository = "https://github.com/libbpf/libbpf-rs"
homepage = "https://github.com/libbpf/libbpf-rs"
Expand Down
1 change: 1 addition & 0 deletions libbpf-cargo/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Unreleased
- Removed `--quiet` option of `libbpf make` sub-command
- Fixed handling of multiple types of same name in BTF by enumerating
them in the generated skeleton
- Bumped minimum Rust version to `1.78`


0.25.0-beta.1
Expand Down
2 changes: 1 addition & 1 deletion libbpf-cargo/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![CI](https://github.com/libbpf/libbpf-rs/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/libbpf/libbpf-rs/actions/workflows/test.yml)
[![rustc](https://img.shields.io/badge/rustc-1.71+-blue.svg)](https://blog.rust-lang.org/2023/07/13/Rust-1.71.0.html)
[![rustc](https://img.shields.io/badge/rustc-1.78+-blue.svg)](https://blog.rust-lang.org/2024/05/02/Rust-1.78.0.html)

# libbpf-cargo

Expand Down
2 changes: 1 addition & 1 deletion libbpf-rs/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![CI](https://github.com/libbpf/libbpf-rs/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/libbpf/libbpf-rs/actions/workflows/test.yml)
[![rustc](https://img.shields.io/badge/rustc-1.71+-blue.svg)](https://blog.rust-lang.org/2023/07/13/Rust-1.71.0.html)
[![rustc](https://img.shields.io/badge/rustc-1.78+-blue.svg)](https://blog.rust-lang.org/2024/05/02/Rust-1.78.0.html)

# libbpf-rs

Expand Down
12 changes: 3 additions & 9 deletions libbpf-rs/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn c_char_slice_to_cstr(s: &[c_char]) -> Option<&CStr> {

/// Round up a number to the next multiple of `r`
pub fn roundup(num: usize, r: usize) -> usize {
((num + (r - 1)) / r) * r
num.div_ceil(r) * r
}

/// Get the number of CPUs in the system, e.g., to interact with per-cpu maps.
Expand Down Expand Up @@ -194,16 +194,10 @@ mod tests {
assert_eq!(c_char_slice_to_cstr(&slice), None);

let slice = [0];
assert_eq!(
c_char_slice_to_cstr(&slice).unwrap(),
CStr::from_bytes_with_nul(b"\0").unwrap()
);
assert_eq!(c_char_slice_to_cstr(&slice).unwrap(), c"");

let slice = ['a' as _, 'b' as _, 'c' as _, 0 as _];
assert_eq!(
c_char_slice_to_cstr(&slice).unwrap(),
CStr::from_bytes_with_nul(b"abc\0").unwrap()
);
assert_eq!(c_char_slice_to_cstr(&slice).unwrap(), c"abc");

// Missing terminating NUL byte.
let slice = ['a' as _, 'b' as _, 'c' as _];
Expand Down

0 comments on commit 79a7f08

Please sign in to comment.