Skip to content

Commit 9522b25

Browse files
committed
Bump Rust edition to 2024
1 parent db2254b commit 9522b25

File tree

13 files changed

+25
-21
lines changed

13 files changed

+25
-21
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
os: [ ubuntu-latest, windows-latest ]
16-
toolchain: [1.83, stable, beta]
16+
toolchain: [1.85, stable, beta]
1717
steps:
1818
- uses: actions/checkout@v4
1919
with:

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ authors = [
55
"sum_catnip <[email protected]>",
66
"Marcondiro <[email protected]>",
77
]
8-
edition = "2021"
8+
edition = "2024"
99
license = "MIT"
1010
description = "The Intel Processor Trace (Intel PT) Decoder Library is Intel's reference implementation for decoding Intel PT."
1111
categories = ["development-tools::debugging", "development-tools::profiling"]
1212
repository = "https://github.com/sum-catnip/libipt-rs"
1313
keywords = ["IntelPT", "ProcessorTrace", "libipt"]
14-
rust-version = "1.83.0"
14+
rust-version = "1.85.0"
1515

1616
[features]
1717
libipt_master = ["libipt-sys/libipt_master"]

src/block/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::Block;
22
use crate::asid::Asid;
3-
use crate::error::{ensure_ptok, extract_status_or_pterr, PtError, PtErrorCode};
3+
use crate::error::{PtError, PtErrorCode, ensure_ptok, extract_status_or_pterr};
44
use crate::event::Event;
55
use crate::image::Image;
66
use crate::status::Status;

src/enc_dec_builder/cpu.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Certain casts are required only on Windows. Inform Clippy to ignore them.
22
#![allow(clippy::unnecessary_cast)]
33

4-
use crate::error::ensure_ptok;
54
use crate::error::PtError;
5+
use crate::error::ensure_ptok;
66
use libipt_sys::{
77
pt_cpu, pt_cpu_errata, pt_cpu_vendor, pt_cpu_vendor_pcv_intel, pt_cpu_vendor_pcv_unknown,
88
pt_errata,

src/event/qry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::enc_dec_builder::{EncoderDecoderBuilder, PtEncoderDecoder};
2-
use crate::error::{ensure_ptok, extract_status_or_pterr, PtError, PtErrorCode};
2+
use crate::error::{PtError, PtErrorCode, ensure_ptok, extract_status_or_pterr};
33
use crate::event::Event;
44
use crate::status::Status;
55

src/image/iscache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::error::{ensure_ptok, extract_pterr, PtError, PtErrorCode};
1+
use crate::error::{PtError, PtErrorCode, ensure_ptok, extract_pterr};
22
use crate::image::{name_ptr_to_option_string, str_to_cstring_pterror};
33
use libipt_sys::{
44
pt_image_section_cache, pt_iscache_add_file, pt_iscache_alloc, pt_iscache_free,

src/image/mod.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::asid::Asid;
2-
use crate::error::{ensure_ptok, extract_pterr, PtError, PtErrorCode};
2+
use crate::error::{PtError, PtErrorCode, ensure_ptok, extract_pterr};
33
use libipt_sys::{
44
pt_asid, pt_image, pt_image_add_cached, pt_image_add_file, pt_image_alloc, pt_image_copy,
55
pt_image_free, pt_image_name, pt_image_remove_by_asid, pt_image_remove_by_filename,
@@ -23,9 +23,11 @@ unsafe extern "C" fn read_callback(
2323
ip: u64,
2424
context: *mut c_void,
2525
) -> i32 {
26-
let buffer = std::slice::from_raw_parts_mut(buffer, size);
27-
let asid = Asid(*asid);
28-
BoxedCallback::call(context, buffer, ip, asid)
26+
unsafe {
27+
let buffer = std::slice::from_raw_parts_mut(buffer, size);
28+
let asid = Asid(*asid);
29+
BoxedCallback::call(context, buffer, ip, asid)
30+
}
2931
}
3032

3133
/// Represent a boxed Rust function that can be passed to and from C code.
@@ -79,9 +81,11 @@ impl BoxedCallback {
7981

8082
/// Invoke the callback behind the given opaque boxed callback pointer.
8183
unsafe fn call(opaque_cb: *mut c_void, buf: &mut [u8], size: u64, asid: Asid) -> i32 {
82-
let raw_boxed_ptr = opaque_cb.cast::<*mut dyn FnMut(&mut [u8], u64, Asid) -> i32>();
83-
let func = (*raw_boxed_ptr).as_mut().unwrap();
84-
func(buf, size, asid)
84+
unsafe {
85+
let raw_boxed_ptr = opaque_cb.cast::<*mut dyn FnMut(&mut [u8], u64, Asid) -> i32>();
86+
let func = (*raw_boxed_ptr).as_mut().unwrap();
87+
func(buf, size, asid)
88+
}
8589
}
8690
}
8791

src/insn/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use super::Insn;
22
use crate::asid::Asid;
33
use crate::enc_dec_builder::EncoderDecoderBuilder;
44
use crate::enc_dec_builder::PtEncoderDecoder;
5-
use crate::error::{ensure_ptok, extract_status_or_pterr, PtError, PtErrorCode};
5+
use crate::error::{PtError, PtErrorCode, ensure_ptok, extract_status_or_pterr};
66
use crate::event::Event;
77
use crate::image::Image;
88
use crate::status::Status;

src/packet/conversions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
macro_rules! wrap2raw {
2-
($target:ty, $type:expr, $payload:ident) => {
2+
($target:ty, $type:expr_2021, $payload:ident) => {
33
impl From<$target> for libipt_sys::pt_packet {
44
#[inline]
55
fn from(origin: $target) -> Self {
@@ -14,7 +14,7 @@ macro_rules! wrap2raw {
1414
}
1515

1616
macro_rules! raw2wrap {
17-
($target:ty, $target_fac:expr, $origin:ty) => {
17+
($target:ty, $target_fac:expr_2021, $origin:ty) => {
1818
impl From<$origin> for $target {
1919
#[inline]
2020
fn from(origin: $origin) -> Self {

src/packet/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use super::Packet;
2-
use crate::error::{ensure_ptok, PtError, PtErrorCode};
2+
use crate::error::{PtError, PtErrorCode, ensure_ptok};
33

44
use crate::enc_dec_builder::{EncoderDecoderBuilder, PtEncoderDecoder};
55
use libipt_sys::{

0 commit comments

Comments
 (0)