From 55cf560626f3c186fc5260d36f6a0a23f7a672b3 Mon Sep 17 00:00:00 2001 From: Luke Carr Date: Thu, 20 Nov 2025 12:58:27 +0000 Subject: [PATCH 1/7] Bump dependencies to latest versions Bumps dependencies in `Cargo.toml` files, including fixes for breaking changes in upgrading `rand` crate from `0.8` to `0.9`, and bumped actions in GHA workflow files. --- .github/workflows/main.yml | 10 +++++----- .github/workflows/pr_review.yml | 2 +- example-service/Cargo.toml | 14 +++++++------- example-service/src/server.rs | 6 +++--- tarpc/Cargo.toml | 28 ++++++++++++++-------------- tarpc/src/context.rs | 2 +- tarpc/src/trace.rs | 6 +++--- 7 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 50d51a72e..4b506ecfd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,7 +42,7 @@ jobs: - unix: "--features unix" serde-transport: "" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@stable - run: > cargo test --manifest-path tarpc/Cargo.toml @@ -56,7 +56,7 @@ jobs: outputs: examples: ${{ steps.matrix.outputs.examples }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@stable - id: matrix run: | @@ -79,7 +79,7 @@ jobs: matrix: example: ${{ fromJSON(needs.list-examples.outputs.examples) }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@stable - run: | cargo run --example "${{ matrix.example }}" @@ -88,7 +88,7 @@ jobs: name: Rustfmt runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@stable with: components: rustfmt @@ -98,7 +98,7 @@ jobs: name: Clippy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@stable with: components: clippy diff --git a/.github/workflows/pr_review.yml b/.github/workflows/pr_review.yml index 597437883..16397be5e 100644 --- a/.github/workflows/pr_review.yml +++ b/.github/workflows/pr_review.yml @@ -4,7 +4,7 @@ jobs: clippy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@stable with: components: clippy diff --git a/example-service/Cargo.toml b/example-service/Cargo.toml index 3856b2f9c..0e7e33fc6 100644 --- a/example-service/Cargo.toml +++ b/example-service/Cargo.toml @@ -15,19 +15,19 @@ description = "An example server built on tarpc." [dependencies] anyhow = "1.0" -clap = { version = "4.4.18", features = ["derive"] } +clap = { version = "4.5.53", features = ["derive"] } log = "0.4" futures = "0.3" -opentelemetry = { version = "0.30.0" } -opentelemetry-otlp = { version = "0.30.0", features = ["grpc-tonic"] } -rand = "0.8" +opentelemetry = { version = "0.31.0" } +opentelemetry-otlp = { version = "0.31.0", features = ["grpc-tonic"] } +rand = "0.9" tarpc = { version = "0.37", path = "../tarpc", features = ["full"] } tokio = { version = "1", features = ["macros", "net", "rt-multi-thread"] } tracing = { version = "0.1" } -tracing-opentelemetry = "0.31.0" +tracing-opentelemetry = "0.32.0" tracing-subscriber = { version = "0.3", features = ["env-filter"] } -opentelemetry_sdk = { version = "0.30.0", features = ["rt-tokio"] } -opentelemetry-semantic-conventions = "0.30.0" +opentelemetry_sdk = { version = "0.31.0", features = ["rt-tokio"] } +opentelemetry-semantic-conventions = "0.31.0" [lib] name = "service" diff --git a/example-service/src/server.rs b/example-service/src/server.rs index 896280c3d..67836e069 100644 --- a/example-service/src/server.rs +++ b/example-service/src/server.rs @@ -7,8 +7,8 @@ use clap::Parser; use futures::{future, prelude::*}; use rand::{ - distributions::{Distribution, Uniform}, - thread_rng, + distr::{Distribution, Uniform}, + rng, }; use service::{World, init_tracing}; use std::{ @@ -37,7 +37,7 @@ struct HelloServer(SocketAddr); impl World for HelloServer { async fn hello(self, _: context::Context, name: String) -> String { let sleep_time = - Duration::from_millis(Uniform::new_inclusive(1, 10).sample(&mut thread_rng())); + Duration::from_millis(Uniform::new_inclusive(1, 10).unwrap().sample(&mut rng())); time::sleep(sleep_time).await; format!("Hello, {name}! You are connected from {}", self.0) } diff --git a/tarpc/Cargo.toml b/tarpc/Cargo.toml index 778eb0938..e4de5518e 100644 --- a/tarpc/Cargo.toml +++ b/tarpc/Cargo.toml @@ -44,42 +44,42 @@ travis-ci = { repository = "google/tarpc" } anyhow = "1.0" fnv = "1.0" futures = "0.3" -humantime = "2.0" -pin-project = "1.0" -rand = "0.8" +humantime = "2.3" +pin-project = "1.1" +rand = "0.9" serde = { optional = true, version = "1.0", features = ["derive"] } static_assertions = "1.1.0" tarpc-plugins = { path = "../plugins", version = "0.14" } thiserror = "2.0" tokio = { version = "1", features = ["time"] } -tokio-util = { version = "0.7.3", features = ["time"] } +tokio-util = { version = "0.7.17", features = ["time"] } tokio-serde = { optional = true, version = "0.9" } tracing = { version = "0.1", default-features = false, features = [ "attributes", "log", ] } -tracing-opentelemetry = { version = "0.31.0", default-features = false } -opentelemetry = { version = "0.30.0", default-features = false } -opentelemetry-semantic-conventions = "0.30.0" +tracing-opentelemetry = { version = "0.32.0", default-features = false } +opentelemetry = { version = "0.31.0", default-features = false } +opentelemetry-semantic-conventions = "0.31.0" [dev-dependencies] -assert_matches = "1.4" +assert_matches = "1.5" bincode = { version = "2.0", features = ["serde"] } bytes = { version = "1", features = ["serde"] } -flate2 = "1.0" +flate2 = "1.1" futures-test = "0.3" -opentelemetry = { version = "0.30.0", default-features = false } -opentelemetry-otlp = { version = "0.30.0", features = ["grpc-tonic"] } -opentelemetry_sdk = { version = "0.30.0", features = ["rt-tokio"] } +opentelemetry = { version = "0.31.0", default-features = false } +opentelemetry-otlp = { version = "0.31.0", features = ["grpc-tonic"] } +opentelemetry_sdk = { version = "0.31.0", features = ["rt-tokio"] } pin-utils = "0.1.0" serde_bytes = "0.11" tracing-subscriber = { version = "0.3", features = ["env-filter"] } tokio = { version = "1", features = ["full", "test-util", "tracing"] } -console-subscriber = "0.4" +console-subscriber = "0.5" tokio-serde = { version = "0.9", features = ["json", "bincode"] } trybuild = "1.0" tokio-rustls = "0.26" -rustls-pemfile = "2.0" +rustls-pemfile = "2.2" [package.metadata.docs.rs] all-features = true diff --git a/tarpc/src/context.rs b/tarpc/src/context.rs index 8e77cf223..f2a11bbab 100644 --- a/tarpc/src/context.rs +++ b/tarpc/src/context.rs @@ -142,7 +142,7 @@ pub(crate) trait SpanExt { impl SpanExt for tracing::Span { fn set_context(&self, context: &Context) { - self.set_parent( + let _ = self.set_parent( opentelemetry::Context::new() .with_remote_span_context(opentelemetry::trace::SpanContext::new( opentelemetry::trace::TraceId::from(context.trace_context.trace_id), diff --git a/tarpc/src/trace.rs b/tarpc/src/trace.rs index d172dc2e2..3e4fcf296 100644 --- a/tarpc/src/trace.rs +++ b/tarpc/src/trace.rs @@ -81,7 +81,7 @@ impl Context { pub(crate) fn new_child(&self) -> Self { Self { trace_id: self.trace_id, - span_id: SpanId::random(&mut rand::thread_rng()), + span_id: SpanId::random(&mut rand::rng()), sampling_decision: self.sampling_decision, } } @@ -91,7 +91,7 @@ impl TraceId { /// Returns a random trace ID that can be assumed to be globally unique if `rng` generates /// actually-random numbers. pub fn random(rng: &mut R) -> Self { - TraceId(rng.r#gen::().get()) + TraceId(rng.random::().get()) } /// Returns true iff the trace ID is 0. @@ -103,7 +103,7 @@ impl TraceId { impl SpanId { /// Returns a random span ID that can be assumed to be unique within a single trace. pub fn random(rng: &mut R) -> Self { - SpanId(rng.r#gen::().get()) + SpanId(rng.random::().get()) } /// Returns true iff the span ID is 0. From 4b7e4c605442b955e89045cc68dc67c91e27e1f6 Mon Sep 17 00:00:00 2001 From: Luke Carr Date: Thu, 20 Nov 2025 13:15:07 +0000 Subject: [PATCH 2/7] Dervied `Default` for `SamplingDecision` to make clippy happy Replaced manual `impl Default for SamplingDecision` with `#[derive(Default)]` to resolve clippy error. --- tarpc/src/trace.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tarpc/src/trace.rs b/tarpc/src/trace.rs index 3e4fcf296..6d27c99e2 100644 --- a/tarpc/src/trace.rs +++ b/tarpc/src/trace.rs @@ -66,13 +66,14 @@ pub struct SpanId(u64); /// dependencies. On the other hand, if an upstream process has chosen to sample this trace, then /// the downstream samplers are expected to respect that decision and also sample the trace. /// Otherwise, the full trace would not be able to be reconstructed reliably. -#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)] +#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy, Default)] #[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] #[repr(u8)] pub enum SamplingDecision { /// The associated span was sampled by its creating process. Child spans must also be sampled. Sampled, /// The associated span was not sampled by its creating process. + #[default] Unsampled, } @@ -203,12 +204,6 @@ impl From<&opentelemetry::trace::SpanContext> for SamplingDecision { } } -impl Default for SamplingDecision { - fn default() -> Self { - Self::Unsampled - } -} - /// Returned when a [`Context`] cannot be constructed from a [`Span`](tracing::Span). #[derive(Debug)] pub struct NoActiveSpan; From a0e607c06ab8081a7e55006c4024d537b441bc5a Mon Sep 17 00:00:00 2001 From: Luke Carr Date: Thu, 20 Nov 2025 15:51:14 +0000 Subject: [PATCH 3/7] Removed `patch` parts from Cargo dependency versions --- example-service/Cargo.toml | 12 ++++++------ plugins/Cargo.toml | 2 +- tarpc/Cargo.toml | 18 +++++++++--------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/example-service/Cargo.toml b/example-service/Cargo.toml index 0e7e33fc6..2d63f443d 100644 --- a/example-service/Cargo.toml +++ b/example-service/Cargo.toml @@ -15,19 +15,19 @@ description = "An example server built on tarpc." [dependencies] anyhow = "1.0" -clap = { version = "4.5.53", features = ["derive"] } +clap = { version = "4.5", features = ["derive"] } log = "0.4" futures = "0.3" -opentelemetry = { version = "0.31.0" } -opentelemetry-otlp = { version = "0.31.0", features = ["grpc-tonic"] } +opentelemetry = { version = "0.31" } +opentelemetry-otlp = { version = "0.31", features = ["grpc-tonic"] } rand = "0.9" tarpc = { version = "0.37", path = "../tarpc", features = ["full"] } tokio = { version = "1", features = ["macros", "net", "rt-multi-thread"] } tracing = { version = "0.1" } -tracing-opentelemetry = "0.32.0" +tracing-opentelemetry = "0.32" tracing-subscriber = { version = "0.3", features = ["env-filter"] } -opentelemetry_sdk = { version = "0.31.0", features = ["rt-tokio"] } -opentelemetry-semantic-conventions = "0.31.0" +opentelemetry_sdk = { version = "0.31", features = ["rt-tokio"] } +opentelemetry-semantic-conventions = "0.31" [lib] name = "service" diff --git a/plugins/Cargo.toml b/plugins/Cargo.toml index 8be746c26..9d0853433 100644 --- a/plugins/Cargo.toml +++ b/plugins/Cargo.toml @@ -28,7 +28,7 @@ syn = { version = "2.0", features = ["full", "extra-traits"] } proc-macro = true [dev-dependencies] -assert-type-eq = "0.1.0" +assert-type-eq = "0.1" futures = "0.3" serde = { version = "1.0", features = ["derive"] } tarpc = { path = "../tarpc", features = ["serde1"] } diff --git a/tarpc/Cargo.toml b/tarpc/Cargo.toml index e4de5518e..5ac0fde48 100644 --- a/tarpc/Cargo.toml +++ b/tarpc/Cargo.toml @@ -48,19 +48,19 @@ humantime = "2.3" pin-project = "1.1" rand = "0.9" serde = { optional = true, version = "1.0", features = ["derive"] } -static_assertions = "1.1.0" +static_assertions = "1.1" tarpc-plugins = { path = "../plugins", version = "0.14" } thiserror = "2.0" tokio = { version = "1", features = ["time"] } -tokio-util = { version = "0.7.17", features = ["time"] } +tokio-util = { version = "0.7", features = ["time"] } tokio-serde = { optional = true, version = "0.9" } tracing = { version = "0.1", default-features = false, features = [ "attributes", "log", ] } -tracing-opentelemetry = { version = "0.32.0", default-features = false } -opentelemetry = { version = "0.31.0", default-features = false } -opentelemetry-semantic-conventions = "0.31.0" +tracing-opentelemetry = { version = "0.32", default-features = false } +opentelemetry = { version = "0.31", default-features = false } +opentelemetry-semantic-conventions = "0.31" [dev-dependencies] assert_matches = "1.5" @@ -68,10 +68,10 @@ bincode = { version = "2.0", features = ["serde"] } bytes = { version = "1", features = ["serde"] } flate2 = "1.1" futures-test = "0.3" -opentelemetry = { version = "0.31.0", default-features = false } -opentelemetry-otlp = { version = "0.31.0", features = ["grpc-tonic"] } -opentelemetry_sdk = { version = "0.31.0", features = ["rt-tokio"] } -pin-utils = "0.1.0" +opentelemetry = { version = "0.31", default-features = false } +opentelemetry-otlp = { version = "0.31", features = ["grpc-tonic"] } +opentelemetry_sdk = { version = "0.31", features = ["rt-tokio"] } +pin-utils = "0.1" serde_bytes = "0.11" tracing-subscriber = { version = "0.3", features = ["env-filter"] } tokio = { version = "1", features = ["full", "test-util", "tracing"] } From 7edd8e40a7179b66720bcfc0903da3e5118aa509 Mon Sep 17 00:00:00 2001 From: Luke Carr Date: Thu, 20 Nov 2025 16:04:44 +0000 Subject: [PATCH 4/7] Add comment justifying explicit `Result` ignore. --- tarpc/src/context.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tarpc/src/context.rs b/tarpc/src/context.rs index f2a11bbab..fec15ac14 100644 --- a/tarpc/src/context.rs +++ b/tarpc/src/context.rs @@ -142,6 +142,9 @@ pub(crate) trait SpanExt { impl SpanExt for tracing::Span { fn set_context(&self, context: &Context) { + // Explicitly ignore the returned result because it either means that the span has + // already started, or the Otel layer is not present, so we don't mind if the result + // is an error we silently ignore. let _ = self.set_parent( opentelemetry::Context::new() .with_remote_span_context(opentelemetry::trace::SpanContext::new( From 810660704ae1f889de1c3fd8fdd52ebe27eec161 Mon Sep 17 00:00:00 2001 From: Luke Carr Date: Thu, 20 Nov 2025 18:45:42 +0000 Subject: [PATCH 5/7] Bumped `actions/checkout` to `v6`. --- .github/workflows/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4b506ecfd..bfb542f85 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,7 +42,7 @@ jobs: - unix: "--features unix" serde-transport: "" steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: dtolnay/rust-toolchain@stable - run: > cargo test --manifest-path tarpc/Cargo.toml @@ -56,7 +56,7 @@ jobs: outputs: examples: ${{ steps.matrix.outputs.examples }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: dtolnay/rust-toolchain@stable - id: matrix run: | @@ -79,7 +79,7 @@ jobs: matrix: example: ${{ fromJSON(needs.list-examples.outputs.examples) }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: dtolnay/rust-toolchain@stable - run: | cargo run --example "${{ matrix.example }}" @@ -88,7 +88,7 @@ jobs: name: Rustfmt runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: dtolnay/rust-toolchain@stable with: components: rustfmt @@ -98,7 +98,7 @@ jobs: name: Clippy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: dtolnay/rust-toolchain@stable with: components: clippy From a3576ca7c06ee53f266b9eba976dfa64ebd9f8eb Mon Sep 17 00:00:00 2001 From: Luke Carr Date: Thu, 20 Nov 2025 18:46:15 +0000 Subject: [PATCH 6/7] Updated `stderr` for `serde1/opt_out_serde` test case. --- tarpc/tests/compile_fail/serde1/opt_out_serde.stderr | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tarpc/tests/compile_fail/serde1/opt_out_serde.stderr b/tarpc/tests/compile_fail/serde1/opt_out_serde.stderr index bdb46999c..630924f71 100644 --- a/tarpc/tests/compile_fail/serde1/opt_out_serde.stderr +++ b/tarpc/tests/compile_fail/serde1/opt_out_serde.stderr @@ -2,10 +2,15 @@ error[E0277]: the trait bound `FooRequest: serde::Serialize` is not satisfied --> tests/compile_fail/serde1/opt_out_serde.rs:12:40 | 12 | tarpc::serde::Serialize::serialize(&x, f); - | ---------------------------------- ^^ the trait `Serialize` is not implemented for `FooRequest` + | ---------------------------------- ^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Serialize` is not implemented for `FooRequest` + --> tests/compile_fail/serde1/opt_out_serde.rs:5:1 + | + 5 | #[tarpc::service(derive_serde = false)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: for local types consider adding `#[derive(serde::Serialize)]` to your `FooRequest` type = note: for types from other crates check whether the crate offers a `serde` feature flag = help: the following other types implement trait `Serialize`: @@ -18,3 +23,4 @@ error[E0277]: the trait bound `FooRequest: serde::Serialize` is not satisfied (T0, T1, T2, T3) (T0, T1, T2, T3, T4) and $N others + = note: this error originates in the attribute macro `tarpc::service` (in Nightly builds, run with -Z macro-backtrace for more info) From b9362b3a29de92768b9fdce6899e247904c49e97 Mon Sep 17 00:00:00 2001 From: Luke Carr Date: Thu, 20 Nov 2025 18:47:20 +0000 Subject: [PATCH 7/7] Bumped `actions/checkout` to `v6`. --- .github/workflows/pr_review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_review.yml b/.github/workflows/pr_review.yml index 16397be5e..d848f0358 100644 --- a/.github/workflows/pr_review.yml +++ b/.github/workflows/pr_review.yml @@ -4,7 +4,7 @@ jobs: clippy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: dtolnay/rust-toolchain@stable with: components: clippy