diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..d1ec11f --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,40 @@ +name: Rust + +on: + push: + branches: [ "main" ] + paths: + - "etw/rust/**" + pull_request: + branches: [ "main" ] + paths: + - "etw/rust/**" + +env: + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 + RUST_BACKTRACE: short + +defaults: + run: + working-directory: ./etw/rust + +jobs: + windows-buildtest: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - name: Setup Cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose diff --git a/etw/rust/Cargo.toml b/etw/rust/Cargo.toml index 88114e3..95b4e4f 100644 --- a/etw/rust/Cargo.toml +++ b/etw/rust/Cargo.toml @@ -1,4 +1,6 @@ [workspace] +resolver = "2" + members = [ "tracelogging", "tracelogging_dynamic", diff --git a/etw/rust/tracelogging/Cargo.toml b/etw/rust/tracelogging/Cargo.toml index c59fbeb..0b31b51 100644 --- a/etw/rust/tracelogging/Cargo.toml +++ b/etw/rust/tracelogging/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tracelogging" -version = "1.2.2" +version = "1.2.3" edition = "2021" authors = ["Microsoft"] license = "MIT" @@ -30,7 +30,7 @@ kernel_mode = [] macros = ["dep:tracelogging_macros"] [dependencies] -tracelogging_macros = { optional = true, version = "= 1.2.0", path = "../tracelogging_macros" } +tracelogging_macros = { optional = true, version = "= 1.2.3", path = "../tracelogging_macros" } [dev-dependencies] windows = ">= 0.39" diff --git a/etw/rust/tracelogging/src/changelog.rs b/etw/rust/tracelogging/src/changelog.rs index 0e064aa..2ed6e6a 100644 --- a/etw/rust/tracelogging/src/changelog.rs +++ b/etw/rust/tracelogging/src/changelog.rs @@ -3,6 +3,11 @@ #[allow(unused_imports)] use crate::*; // For docs +/// # v1.2.3 (2025-03-02) +/// - Fix newer warnings about unsafe code +/// - Update `tracelongging-macros` dependency to 1.2.1 +pub mod v1_2_3 {} + /// # v1.2.2 (2024-05-20) /// - tracelogging crate supports use in kernel mode via feature /// `kernel_mode`. diff --git a/etw/rust/tracelogging/src/native.rs b/etw/rust/tracelogging/src/native.rs index 287f613..b2434db 100644 --- a/etw/rust/tracelogging/src/native.rs +++ b/etw/rust/tracelogging/src/native.rs @@ -175,7 +175,7 @@ impl ProviderContext { } #[cfg(all(windows, feature = "etw"))] { - result = /* unsafe */ { &mut *self.cell.get() }.register( + result = unsafe { &mut *self.cell.get() }.register( _provider_id, _callback_fn, _callback_context); @@ -422,14 +422,16 @@ impl ProviderContextInner { filter_data: usize, outer_context: usize, ) { - (*(outer_context as *mut Self)).outer_callback_impl( - source_id, - event_control_code, - level, - match_any_keyword, - match_all_keyword, - filter_data, - ); + unsafe { + (*(outer_context as *mut Self)).outer_callback_impl( + source_id, + event_control_code, + level, + match_any_keyword, + match_all_keyword, + filter_data, + ); + } } } diff --git a/etw/rust/tracelogging_dynamic/Cargo.toml b/etw/rust/tracelogging_dynamic/Cargo.toml index 28a1625..0b975c1 100644 --- a/etw/rust/tracelogging_dynamic/Cargo.toml +++ b/etw/rust/tracelogging_dynamic/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tracelogging_dynamic" -version = "1.2.2" +version = "1.2.3" edition = "2021" authors = ["Microsoft"] license = "MIT" @@ -28,4 +28,4 @@ default = ["etw"] etw = ["tracelogging/etw"] # Logging is enabled if windows && etw. [dependencies] -tracelogging = { default-features = false, version = "= 1.2.2", path = "../tracelogging" } +tracelogging = { default-features = false, version = "= 1.2.3", path = "../tracelogging" } diff --git a/etw/rust/tracelogging_dynamic/src/changelog.rs b/etw/rust/tracelogging_dynamic/src/changelog.rs index a2f7978..4143787 100644 --- a/etw/rust/tracelogging_dynamic/src/changelog.rs +++ b/etw/rust/tracelogging_dynamic/src/changelog.rs @@ -3,6 +3,11 @@ #[allow(unused_imports)] use crate::*; // For docs +/// # v1.2.3 (2025-03-02) +/// - Fix newer warnings about unsafe code +/// - Update `tracelongging` dependency to 1.2.3 +pub mod v1_2_3 {} + /// # v1.2.2 (2024-05-20) /// - tracelogging crate supports use in kernel mode via feature /// `kernel_mode`. diff --git a/etw/rust/tracelogging_dynamic/src/provider.rs b/etw/rust/tracelogging_dynamic/src/provider.rs index 52cca09..32cb5fa 100644 --- a/etw/rust/tracelogging_dynamic/src/provider.rs +++ b/etw/rust/tracelogging_dynamic/src/provider.rs @@ -329,9 +329,9 @@ impl Provider { /// provider is dropped. (This is implied by the rules for `Pin` but repeated here /// for clarity.) pub unsafe fn register(self: Pin<&Self>) -> u32 { - let result = self + let result = unsafe { self .context - .register(&self.id, self.callback_fn, self.callback_context); + .register(&self.id, self.callback_fn, self.callback_context) }; if result == 0 { self.context.set_information( 2, // EventProviderSetTraits diff --git a/etw/rust/tracelogging_macros/Cargo.toml b/etw/rust/tracelogging_macros/Cargo.toml index fc3d299..b705a3a 100644 --- a/etw/rust/tracelogging_macros/Cargo.toml +++ b/etw/rust/tracelogging_macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tracelogging_macros" -version = "1.2.0" +version = "1.2.3" edition = "2021" authors = ["Microsoft"] license = "MIT" diff --git a/etw/rust/tracelogging_macros/src/lib.rs b/etw/rust/tracelogging_macros/src/lib.rs index 89635ef..c124ed9 100644 --- a/etw/rust/tracelogging_macros/src/lib.rs +++ b/etw/rust/tracelogging_macros/src/lib.rs @@ -4,6 +4,13 @@ #![allow(clippy::needless_return)] //! Implements the macros that are exported by the tracelogging crate. +//! +//! # Changelog +//! +//! ## v1.2.3 (2025-03-02) +//! - Fix `repr_packed_without_abi` warning. +//! +//! ## v1.2.0 (2023-05-23) extern crate proc_macro; use proc_macro::{Span, TokenStream};