From 7b9ebebc9f6c4ac6f7f49b5cbf1fd79c5c63e6ac Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 3 Sep 2026 12:42:17 -0400 Subject: [PATCH 1/9] Add intro doc to the crate lib.rs --- splat-overload/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/splat-overload/src/lib.rs b/splat-overload/src/lib.rs index a0cbf0c..393dfa9 100644 --- a/splat-overload/src/lib.rs +++ b/splat-overload/src/lib.rs @@ -1,3 +1,13 @@ +//! A [Rust Foundation *experiment*](https://rustfoundation.org/media/experimenting-with-function-overloading-in-rust-why-it-matters/) +//! in ergonomic function overloading in Rust. Technical details for the current stage of the +//! experiment can be found +//! [on the Inside Rust blog](https://blog.rust-lang.org/inside-rust/2026/08/19/overloading-experiment/). +//! +//! The `overload!` macro improves the ergonomics of the +//! [`splat` Rust language experiment](https://github.com/rust-lang/rust/issues/153629), by +//! allowing functions to be declared as an overload set. This requires a recent nightly Rust +//! compiler. + use proc_macro::TokenStream; use quote::quote; use syn::{ From d125409aff51a8625f6560a6d50bdffbcdcbcbfa Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 3 Sep 2026 12:42:33 -0400 Subject: [PATCH 2/9] Add rustdoc example code --- splat-overload/src/lib.rs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/splat-overload/src/lib.rs b/splat-overload/src/lib.rs index 393dfa9..b192869 100644 --- a/splat-overload/src/lib.rs +++ b/splat-overload/src/lib.rs @@ -7,6 +7,44 @@ //! [`splat` Rust language experiment](https://github.com/rust-lang/rust/issues/153629), by //! allowing functions to be declared as an overload set. This requires a recent nightly Rust //! compiler. +//! +//! # Example +//! +//! The macro supports methods with return values: +//! ```rust +//! #![feature(splat, tuple_trait)] +//! #![allow(incomplete_features, unused_braces)] +//! # #[macro_use] extern crate splat_overload; +//! use splat_overload::overload; +//! struct Calculator; +//! overload! { +//! impl Calculator { +//! fn compute(&self, x: i32) -> i32 { x * 2 } +//! fn compute(&self, x: i32, y: i32) -> i32 { x + y } +//! } +//! } +//! # fn main() { +//! let calc = Calculator; +//! assert_eq!(calc.compute(21), 42); +//! assert_eq!(calc.compute(10, 32), 42); +//! # } +//! ``` +//! +//! And free functions: +//! ```rust +//! #![feature(splat, tuple_trait)] +//! #![allow(incomplete_features, unused_braces)] +//! # #[macro_use] extern crate splat_overload; +//! use splat_overload::overload; +//! overload! { +//! fn compute(x: i32) -> i32 { x * 2 } +//! fn compute(x: i32, y: i32) -> i32 { x + y } +//! } +//! # fn main() { +//! assert_eq!(compute(21), 42); +//! assert_eq!(compute(10, 32), 42); +//! # } +//! ``` use proc_macro::TokenStream; use quote::quote; From f047391e5174ed9ec2d5e88433273eb23ba6ee34 Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 3 Sep 2026 12:48:56 -0400 Subject: [PATCH 3/9] Add doctests to CI --- .github/workflows/check.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 4e8eddc..0e11921 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -39,7 +39,9 @@ jobs: toolchain: nightly components: cargo,clippy,rustfmt - name: Test each Rust crate - run: cargo test --workspace --all-targets --all-features + run: | + cargo test --workspace --all-targets --all-features + cargo test --doc --all-features run: name: 3. Run Rust example binaries From 0c2bd66e9be04872f0bcee50c98e61bf43e01ced Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 3 Sep 2026 14:19:11 -0400 Subject: [PATCH 4/9] Add examples README --- splat-overload-test/src/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 splat-overload-test/src/README.md diff --git a/splat-overload-test/src/README.md b/splat-overload-test/src/README.md new file mode 100644 index 0000000..bcc4f5c --- /dev/null +++ b/splat-overload-test/src/README.md @@ -0,0 +1 @@ +These example binaries are automatically run in CI, they are expected to pass. From c3f88ce3b8a3cf40bc366e023db348bff23f0504 Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 3 Sep 2026 14:23:30 -0400 Subject: [PATCH 5/9] Update required rust version --- Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6923d13..dd153c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,9 +25,9 @@ keywords = [ license = "MIT OR APACHE-2.0" readme = "README.md" repository = "https://github.com/rustfoundation/overloading-macros" -# Requires #[rustc_splat] which was renamed in nightly-2026-07-31 (rust-lang/rust#159817) -# FIXME: we can't specify nightly dates or the latest nightly here, update to 1.100 once 1.99 beta branches (20 August 2026) -rust-version = "1.99" +# Requires nightly `#[rustc_splat]` which was renamed in nightly-2026-07-31 (rust-lang/rust#159817) +# We can't specify nightly here, because version suffixes aren't supported. +rust-version = "1.100" [workspace.dependencies] syn = { version = "2.0.119", features = ["full"] } From 48736839dbb9a3eb6bfd6f77dc5cf8636046eb83 Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 3 Sep 2026 14:36:55 -0400 Subject: [PATCH 6/9] Initial overload diagnostics --- Cargo.lock | 7 +++++ Cargo.toml | 7 +++-- splat-overload-diagnostics/Cargo.toml | 16 ++++++++++++ .../rust-toolchain.toml | 2 ++ splat-overload-diagnostics/src/README.md | 2 ++ .../src/bin/diag-function-return-values.rs | 21 +++++++++++++++ .../src/bin/diag-function.rs | 19 ++++++++++++++ .../src/bin/diag-method-return-values.rs | 26 +++++++++++++++++++ .../src/bin/diag-methods.rs | 24 +++++++++++++++++ 9 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 splat-overload-diagnostics/Cargo.toml create mode 100644 splat-overload-diagnostics/rust-toolchain.toml create mode 100644 splat-overload-diagnostics/src/README.md create mode 100644 splat-overload-diagnostics/src/bin/diag-function-return-values.rs create mode 100644 splat-overload-diagnostics/src/bin/diag-function.rs create mode 100644 splat-overload-diagnostics/src/bin/diag-method-return-values.rs create mode 100644 splat-overload-diagnostics/src/bin/diag-methods.rs diff --git a/Cargo.lock b/Cargo.lock index c49b044..15f1f9c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,6 +29,13 @@ dependencies = [ "syn", ] +[[package]] +name = "splat-overload-diagnostics" +version = "0.0.0" +dependencies = [ + "splat-overload", +] + [[package]] name = "splat-overload-test" version = "0.0.0" diff --git a/Cargo.toml b/Cargo.toml index dd153c9..f9a119d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,11 +2,14 @@ resolver = "3" members = [ "splat-overload", - "splat-overload-test" + "splat-overload-test", + "splat-overload-diagnostics", ] default-members = [ "splat-overload", - "splat-overload-test" + "splat-overload-test", + # Excluded from default members because it deliberately fails compilation + #"splat-overload-diagnostics", ] [workspace.package] diff --git a/splat-overload-diagnostics/Cargo.toml b/splat-overload-diagnostics/Cargo.toml new file mode 100644 index 0000000..c45615b --- /dev/null +++ b/splat-overload-diagnostics/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "splat-overload-diagnostics" +description = "Diagnostics test crate for the experimental splat-overload proc-macro" +publish = false +version.workspace = true +authors.workspace = true +edition.workspace = true +homepage.workspace = true +keywords.workspace = true +license.workspace = true +readme.workspace = true +repository.workspace = true +rust-version.workspace = true + +[dependencies] +splat-overload = { path = "../splat-overload" } diff --git a/splat-overload-diagnostics/rust-toolchain.toml b/splat-overload-diagnostics/rust-toolchain.toml new file mode 100644 index 0000000..5d56faf --- /dev/null +++ b/splat-overload-diagnostics/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "nightly" diff --git a/splat-overload-diagnostics/src/README.md b/splat-overload-diagnostics/src/README.md new file mode 100644 index 0000000..2fec828 --- /dev/null +++ b/splat-overload-diagnostics/src/README.md @@ -0,0 +1,2 @@ +These example binaries are automatically run in CI, they are expected to fail, with output in the +corresponding `.stderr` file. diff --git a/splat-overload-diagnostics/src/bin/diag-function-return-values.rs b/splat-overload-diagnostics/src/bin/diag-function-return-values.rs new file mode 100644 index 0000000..6246d7d --- /dev/null +++ b/splat-overload-diagnostics/src/bin/diag-function-return-values.rs @@ -0,0 +1,21 @@ +#![feature(splat)] +#![feature(tuple_trait)] +#![allow(incomplete_features)] +#![allow(unused_braces)] + +use splat_overload::overload; + +overload! { + fn foo(x: i32) -> i32 { x } + fn foo(x: f64) -> f64 { x } +} + +fn main() { + // Empty argument list + foo(); + foo("wrong type"); + // Wrong number of arguments + foo(1_i32, 2, 3); + // Wrong return type + let a: i32 = foo(1.0_f64); +} diff --git a/splat-overload-diagnostics/src/bin/diag-function.rs b/splat-overload-diagnostics/src/bin/diag-function.rs new file mode 100644 index 0000000..f57fec7 --- /dev/null +++ b/splat-overload-diagnostics/src/bin/diag-function.rs @@ -0,0 +1,19 @@ +#![feature(splat)] +#![feature(tuple_trait)] +#![allow(incomplete_features, clippy::approx_constant)] + +use splat_overload::overload; + +overload! { + fn foo(_x: i32, _y: f64) {} + fn foo(_x: bool, _y: i32, _z: f64) {} + fn foo(_a: i32, _b: f64, _c: bool, _d: u8) {} +} + +fn main() { + // Empty argument list + foo(); + foo("one wrong type", 2.0_f64); + // Wrong number of arguments + foo(1_i32, 2_f64, true, 4_u8, 5); +} diff --git a/splat-overload-diagnostics/src/bin/diag-method-return-values.rs b/splat-overload-diagnostics/src/bin/diag-method-return-values.rs new file mode 100644 index 0000000..a21b710 --- /dev/null +++ b/splat-overload-diagnostics/src/bin/diag-method-return-values.rs @@ -0,0 +1,26 @@ +#![feature(splat)] +#![feature(tuple_trait)] +#![allow(incomplete_features)] +#![allow(unused_braces)] + +use splat_overload::overload; + +struct Calculator; + +overload! { + impl Calculator { + fn compute(&self, x: i32) -> i32 { x } + fn compute(&self, x: i32, y: i32) -> i32 { x + y } + } +} + +fn main() { + let calc = Calculator; + // Empty argument list + calc.compute(); + calc.compute("wrong type"); + // Wrong number of arguments + calc.compute(1_i32, 2_i32, 3); + // Wrong return type + let a: f64 = calc.compute(1_i32); +} diff --git a/splat-overload-diagnostics/src/bin/diag-methods.rs b/splat-overload-diagnostics/src/bin/diag-methods.rs new file mode 100644 index 0000000..746ee06 --- /dev/null +++ b/splat-overload-diagnostics/src/bin/diag-methods.rs @@ -0,0 +1,24 @@ +#![feature(splat)] +#![feature(tuple_trait)] +#![allow(incomplete_features)] +#![allow(unused_braces, clippy::disallowed_names)] + +use splat_overload::overload; + +struct Foo; + +overload! { + impl Foo { + fn method(&self, x: i32) {} + fn method(&self, x: f64) {} + } +} + +fn main() { + let foo = Foo; + // Empty argument list + foo.method(); + foo.method("wrong type"); + // Wrong number of arguments + foo.method(1_i32, 2); +} From 6dc0c1b13ea0ba417555aba811b555feff8d5b5e Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 3 Sep 2026 14:39:17 -0400 Subject: [PATCH 7/9] Only run CI jobs on default members --- .github/workflows/check.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 0e11921..6cf81f8 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -27,7 +27,7 @@ jobs: # Use the same components in every step for caching components: cargo,clippy,rustfmt - name: Build each Rust crate - run: cargo build --workspace --all-targets --all-features + run: cargo build --all-targets --all-features test-rust: name: 2. Test Rust crates @@ -40,7 +40,7 @@ jobs: components: cargo,clippy,rustfmt - name: Test each Rust crate run: | - cargo test --workspace --all-targets --all-features + cargo test --all-targets --all-features cargo test --doc --all-features run: @@ -71,7 +71,7 @@ jobs: toolchain: nightly components: cargo,clippy,rustfmt - name: Run clippy on Rust crates - run: cargo clippy --workspace --all-targets --all-features -- --deny warnings + run: cargo clippy --all-targets --all-features -- --deny warnings doc-rust: name: 5. Doc lints on Rust crates @@ -83,7 +83,7 @@ jobs: toolchain: nightly components: cargo,clippy,rustfmt - name: Run doc checks on Rust crates - run: cargo doc --workspace --all-features + run: cargo doc --all-features fmt-rust: name: 6. Code format on Rust crates From 58c88ee356b254f595d7cd2906b04df4e3403664 Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 3 Sep 2026 15:00:16 -0400 Subject: [PATCH 8/9] Add diagnostics checks to CI --- .github/workflows/check.yml | 40 +++++ .../bin/diag-function-return-values.stderr | 153 ++++++++++++++++++ .../{diag-function.rs => diag-functions.rs} | 0 .../src/bin/diag-functions.stderr | 133 +++++++++++++++ .../src/bin/diag-method-return-values.stderr | 97 +++++++++++ .../src/bin/diag-methods.rs | 4 +- .../src/bin/diag-methods.stderr | 89 ++++++++++ 7 files changed, 514 insertions(+), 2 deletions(-) create mode 100644 splat-overload-diagnostics/src/bin/diag-function-return-values.stderr rename splat-overload-diagnostics/src/bin/{diag-function.rs => diag-functions.rs} (100%) create mode 100644 splat-overload-diagnostics/src/bin/diag-functions.stderr create mode 100644 splat-overload-diagnostics/src/bin/diag-method-return-values.stderr create mode 100644 splat-overload-diagnostics/src/bin/diag-methods.stderr diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 6cf81f8..12c66e5 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -109,6 +109,44 @@ jobs: - name: Dry run publishing run: cargo publish --dry-run + diagnostics-rust: + name: 8. Diagnostics tests on Rust crates + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0 + with: + toolchain: nightly + # Use the same components in every step for caching + components: cargo,clippy,rustfmt + - name: Build each Rust crate + # To bless (update the expected diagnostics), change '/tmp' to 'splat-overload-diagnostics/src/bin', + # and disable color output. + # FIXME: turn this into a script so we can run it locally. + run: | + export CARGO_TERM_COLOR=never + set -o pipefail + TEST_NAMES=$(find splat-overload-diagnostics/src/bin -name "*.rs" | \ + sed 's|.*/\([^/]*\).rs|\1|g' ) + echo "testing: $TEST_NAMES" + for test_name in $TEST_NAMES; do + echo "testing: $test_name" + # We expect cargo to fail, so don't exit the shell when it does + set +e + # Ignore build progress, if it's cached then the built crates change + cargo build --all-features --package splat-overload-diagnostics --bin "$test_name" 2>&1 | \ + grep --invert-match -e 'Updating .* index' -e 'Compiling [^ ]* .*' \ + > "/tmp/$test_name.stderr" + CARGO_EXIT_CODE=$? + set -e + if [[ $CARGO_EXIT_CODE -ne 101 ]]; then + echo "error: $test_name compilation unexpectedly returned exit code $CARGO_EXIT_CODE rather than 101" + exit 1 + fi + echo "comparing diagnostics for: $test_name" + diff --unified=5 "splat-overload-diagnostics/src/bin/$test_name.stderr" /tmp/"$test_name.stderr" + done + all: name: All checks # Always run this job, even if earlier steps were skipped (or failed): @@ -123,6 +161,7 @@ jobs: - doc-rust - fmt-rust - publish-dry-run + - diagnostics-rust steps: - name: Fail if any other job failed # Every job status needs to be checked here, because `always()` stops failures from propagating automatically @@ -135,3 +174,4 @@ jobs: [[ "${{ needs.doc-rust.result }}" == "success" ]] || exit 1 [[ "${{ needs.fmt-rust.result }}" == "success" ]] || exit 1 [[ "${{ needs.publish-dry-run.result }}" == "success" ]] || exit 1 + [[ "${{ needs.diagnostics-rust.result }}" == "success" ]] || exit 1 diff --git a/splat-overload-diagnostics/src/bin/diag-function-return-values.stderr b/splat-overload-diagnostics/src/bin/diag-function-return-values.stderr new file mode 100644 index 0000000..0fd3f93 --- /dev/null +++ b/splat-overload-diagnostics/src/bin/diag-function-return-values.stderr @@ -0,0 +1,153 @@ +error[E0277]: the trait bound `(): FooArgs` is not satisfied + --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:15:5 + | +15 | foo(); + | ^^^ the trait `FooArgs` is not implemented for `()` + | +help: the following other types implement trait `FooArgs` + --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:8:1 + | + 8 | / overload! { + 9 | | fn foo(x: i32) -> i32 { x } +10 | | fn foo(x: f64) -> f64 { x } +11 | | } + | | ^ + | | | + | |_`(f64,)` + | `(i32,)` +note: required by a bound in `foo` + --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:8:1 + | + 8 | / overload! { + 9 | | fn foo(x: i32) -> i32 { x } +10 | | fn foo(x: f64) -> f64 { x } +11 | | } + | |_^ required by this bound in `foo` + = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `(&str,): FooArgs` is not satisfied + --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:16:9 + | +16 | foo("wrong type"); + | --- ^^^^^^^^^^^^ the trait `FooArgs` is not implemented for `(&str,)` + | | + | required by a bound introduced by this call + | +help: the following other types implement trait `FooArgs` + --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:8:1 + | + 8 | / overload! { + 9 | | fn foo(x: i32) -> i32 { x } +10 | | fn foo(x: f64) -> f64 { x } +11 | | } + | | ^ + | | | + | |_`(f64,)` + | `(i32,)` +note: required by a bound in `foo` + --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:8:1 + | + 8 | / overload! { + 9 | | fn foo(x: i32) -> i32 { x } +10 | | fn foo(x: f64) -> f64 { x } +11 | | } + | |_^ required by this bound in `foo` + = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `(_, _, _): FooArgs` is not satisfied + --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:18:9 + | +18 | foo(1_i32, 2, 3); + | --- ^^^^^ the trait `FooArgs` is not implemented for `(_, _, _)` + | | + | required by a bound introduced by this call + | +help: the following other types implement trait `FooArgs` + --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:8:1 + | + 8 | / overload! { + 9 | | fn foo(x: i32) -> i32 { x } +10 | | fn foo(x: f64) -> f64 { x } +11 | | } + | | ^ + | | | + | |_`(f64,)` + | `(i32,)` +note: required by a bound in `foo` + --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:8:1 + | + 8 | / overload! { + 9 | | fn foo(x: i32) -> i32 { x } +10 | | fn foo(x: f64) -> f64 { x } +11 | | } + | |_^ required by this bound in `foo` + = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:20:18 + | +20 | let a: i32 = foo(1.0_f64); + | --- ^^^^^^^^^^^^ expected `i32`, found `f64` + | | + | expected due to this + +error[E0277]: the trait bound `(): FooArgs` is not satisfied + --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:15:5 + | +15 | foo(); + | ^^^^^ the trait `FooArgs` is not implemented for `()` + | +help: the following other types implement trait `FooArgs` + --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:8:1 + | + 8 | / overload! { + 9 | | fn foo(x: i32) -> i32 { x } +10 | | fn foo(x: f64) -> f64 { x } +11 | | } + | | ^ + | | | + | |_`(f64,)` + | `(i32,)` + = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `(&str,): FooArgs` is not satisfied + --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:16:5 + | +16 | foo("wrong type"); + | ^^^^^^^^^^^^^^^^^ the trait `FooArgs` is not implemented for `(&str,)` + | +help: the following other types implement trait `FooArgs` + --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:8:1 + | + 8 | / overload! { + 9 | | fn foo(x: i32) -> i32 { x } +10 | | fn foo(x: f64) -> f64 { x } +11 | | } + | | ^ + | | | + | |_`(f64,)` + | `(i32,)` + = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `(i32, {integer}, {integer}): FooArgs` is not satisfied + --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:18:5 + | +18 | foo(1_i32, 2, 3); + | ^^^^^^^^^^^^^^^^ the trait `FooArgs` is not implemented for `(i32, {integer}, {integer})` + | +help: the following other types implement trait `FooArgs` + --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:8:1 + | + 8 | / overload! { + 9 | | fn foo(x: i32) -> i32 { x } +10 | | fn foo(x: f64) -> f64 { x } +11 | | } + | | ^ + | | | + | |_`(f64,)` + | `(i32,)` + = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) + +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. +error: could not compile `splat-overload-diagnostics` (bin "diag-function-return-values") due to 7 previous errors diff --git a/splat-overload-diagnostics/src/bin/diag-function.rs b/splat-overload-diagnostics/src/bin/diag-functions.rs similarity index 100% rename from splat-overload-diagnostics/src/bin/diag-function.rs rename to splat-overload-diagnostics/src/bin/diag-functions.rs diff --git a/splat-overload-diagnostics/src/bin/diag-functions.stderr b/splat-overload-diagnostics/src/bin/diag-functions.stderr new file mode 100644 index 0000000..46681e1 --- /dev/null +++ b/splat-overload-diagnostics/src/bin/diag-functions.stderr @@ -0,0 +1,133 @@ +error[E0277]: the trait bound `(): FooArgs` is not satisfied + --> splat-overload-diagnostics/src/bin/diag-functions.rs:15:5 + | +15 | foo(); + | ^^^ the trait `FooArgs` is not implemented for `()` + | +help: the following other types implement trait `FooArgs` + --> splat-overload-diagnostics/src/bin/diag-functions.rs:7:1 + | + 7 | / overload! { + 8 | | fn foo(_x: i32, _y: f64) {} + 9 | | fn foo(_x: bool, _y: i32, _z: f64) {} +10 | | fn foo(_a: i32, _b: f64, _c: bool, _d: u8) {} +11 | | } + | | ^ + | | | + | | `(bool, i32, f64)` + | |_`(i32, f64)` + | `(i32, f64, bool, u8)` +note: required by a bound in `foo` + --> splat-overload-diagnostics/src/bin/diag-functions.rs:7:1 + | + 7 | / overload! { + 8 | | fn foo(_x: i32, _y: f64) {} + 9 | | fn foo(_x: bool, _y: i32, _z: f64) {} +10 | | fn foo(_a: i32, _b: f64, _c: bool, _d: u8) {} +11 | | } + | |_^ required by this bound in `foo` + = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> splat-overload-diagnostics/src/bin/diag-functions.rs:16:9 + | +16 | foo("one wrong type", 2.0_f64); + | --- ^^^^^^^^^^^^^^^^ expected `i32`, found `&str` + | | + | arguments to this function are incorrect + | +help: the return type of this call is `&'static str` due to the type of the argument passed + --> splat-overload-diagnostics/src/bin/diag-functions.rs:16:5 + | +16 | foo("one wrong type", 2.0_f64); + | ^^^^----------------^^^^^^^^^^ + | | + | this argument influences the return type of `foo` +note: function defined here + --> splat-overload-diagnostics/src/bin/diag-functions.rs:8:8 + | + 7 | / overload! { + 8 | | fn foo(_x: i32, _y: f64) {} + | | ^^^ + 9 | | fn foo(_x: bool, _y: i32, _z: f64) {} +10 | | fn foo(_a: i32, _b: f64, _c: bool, _d: u8) {} +11 | | } + | |_- + +error[E0277]: the trait bound `(_, _, _, _, _): FooArgs` is not satisfied + --> splat-overload-diagnostics/src/bin/diag-functions.rs:18:9 + | +18 | foo(1_i32, 2_f64, true, 4_u8, 5); + | --- ^^^^^ the trait `FooArgs` is not implemented for `(_, _, _, _, _)` + | | + | required by a bound introduced by this call + | +help: the following other types implement trait `FooArgs` + --> splat-overload-diagnostics/src/bin/diag-functions.rs:7:1 + | + 7 | / overload! { + 8 | | fn foo(_x: i32, _y: f64) {} + 9 | | fn foo(_x: bool, _y: i32, _z: f64) {} +10 | | fn foo(_a: i32, _b: f64, _c: bool, _d: u8) {} +11 | | } + | | ^ + | | | + | | `(bool, i32, f64)` + | |_`(i32, f64)` + | `(i32, f64, bool, u8)` +note: required by a bound in `foo` + --> splat-overload-diagnostics/src/bin/diag-functions.rs:7:1 + | + 7 | / overload! { + 8 | | fn foo(_x: i32, _y: f64) {} + 9 | | fn foo(_x: bool, _y: i32, _z: f64) {} +10 | | fn foo(_a: i32, _b: f64, _c: bool, _d: u8) {} +11 | | } + | |_^ required by this bound in `foo` + = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `(): FooArgs` is not satisfied + --> splat-overload-diagnostics/src/bin/diag-functions.rs:15:5 + | +15 | foo(); + | ^^^^^ the trait `FooArgs` is not implemented for `()` + | +help: the following other types implement trait `FooArgs` + --> splat-overload-diagnostics/src/bin/diag-functions.rs:7:1 + | + 7 | / overload! { + 8 | | fn foo(_x: i32, _y: f64) {} + 9 | | fn foo(_x: bool, _y: i32, _z: f64) {} +10 | | fn foo(_a: i32, _b: f64, _c: bool, _d: u8) {} +11 | | } + | | ^ + | | | + | | `(bool, i32, f64)` + | |_`(i32, f64)` + | `(i32, f64, bool, u8)` + = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `(i32, f64, bool, u8, {integer}): FooArgs` is not satisfied + --> splat-overload-diagnostics/src/bin/diag-functions.rs:18:5 + | +18 | foo(1_i32, 2_f64, true, 4_u8, 5); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FooArgs` is not implemented for `(i32, f64, bool, u8, {integer})` + | +help: the following other types implement trait `FooArgs` + --> splat-overload-diagnostics/src/bin/diag-functions.rs:7:1 + | + 7 | / overload! { + 8 | | fn foo(_x: i32, _y: f64) {} + 9 | | fn foo(_x: bool, _y: i32, _z: f64) {} +10 | | fn foo(_a: i32, _b: f64, _c: bool, _d: u8) {} +11 | | } + | | ^ + | | | + | | `(bool, i32, f64)` + | |_`(i32, f64)` + | `(i32, f64, bool, u8)` + = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) + +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. +error: could not compile `splat-overload-diagnostics` (bin "diag-functions") due to 5 previous errors diff --git a/splat-overload-diagnostics/src/bin/diag-method-return-values.stderr b/splat-overload-diagnostics/src/bin/diag-method-return-values.stderr new file mode 100644 index 0000000..6e838d9 --- /dev/null +++ b/splat-overload-diagnostics/src/bin/diag-method-return-values.stderr @@ -0,0 +1,97 @@ +error[E0277]: the trait bound `(): ComputeArgs` is not satisfied + --> splat-overload-diagnostics/src/bin/diag-method-return-values.rs:20:10 + | +20 | calc.compute(); + | ^^^^^^^ the trait `ComputeArgs` is not implemented for `()` + | +help: the following other types implement trait `ComputeArgs` + --> splat-overload-diagnostics/src/bin/diag-method-return-values.rs:10:1 + | +10 | / overload! { +11 | | impl Calculator { +12 | | fn compute(&self, x: i32) -> i32 { x } +13 | | fn compute(&self, x: i32, y: i32) -> i32 { x + y } +14 | | } +15 | | } + | | ^ + | | | + | |_`(i32, i32)` + | `(i32,)` + = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> splat-overload-diagnostics/src/bin/diag-method-return-values.rs:21:18 + | +21 | calc.compute("wrong type"); + | ------- ^^^^^^^^^^^^ expected `i32`, found `&str` + | | + | arguments to this method are incorrect + | +help: the return type of this call is `&'static str` due to the type of the argument passed + --> splat-overload-diagnostics/src/bin/diag-method-return-values.rs:21:5 + | +21 | calc.compute("wrong type"); + | ^^^^^^^^^^^^^------------^ + | | + | this argument influences the return type of `compute` +note: method defined here + --> splat-overload-diagnostics/src/bin/diag-method-return-values.rs:12:12 + | +10 | / overload! { +11 | | impl Calculator { +12 | | fn compute(&self, x: i32) -> i32 { x } + | | ^^^^^^^ +13 | | fn compute(&self, x: i32, y: i32) -> i32 { x + y } +14 | | } +15 | | } + | |_- + +error[E0277]: the trait bound `(_, _, _): ComputeArgs` is not satisfied + --> splat-overload-diagnostics/src/bin/diag-method-return-values.rs:23:18 + | +23 | calc.compute(1_i32, 2_i32, 3); + | ------- ^^^^^ the trait `ComputeArgs` is not implemented for `(_, _, _)` + | | + | required by a bound introduced by this call + | +help: the following other types implement trait `ComputeArgs` + --> splat-overload-diagnostics/src/bin/diag-method-return-values.rs:10:1 + | +10 | / overload! { +11 | | impl Calculator { +12 | | fn compute(&self, x: i32) -> i32 { x } +13 | | fn compute(&self, x: i32, y: i32) -> i32 { x + y } +14 | | } +15 | | } + | | ^ + | | | + | |_`(i32, i32)` + | `(i32,)` +note: required by a bound in `Calculator::compute` + --> splat-overload-diagnostics/src/bin/diag-method-return-values.rs:10:1 + | +10 | / overload! { +11 | | impl Calculator { +12 | | fn compute(&self, x: i32) -> i32 { x } +13 | | fn compute(&self, x: i32, y: i32) -> i32 { x + y } +14 | | } +15 | | } + | |_^ required by this bound in `Calculator::compute` + = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> splat-overload-diagnostics/src/bin/diag-method-return-values.rs:25:18 + | +25 | let a: f64 = calc.compute(1_i32); + | --- ^^^^^^^^^^^^^^^^^^^ expected `f64`, found `i32` + | | + | expected due to this + | +help: you can convert an `i32` to an `f64`, producing the floating point representation of the integer + | +25 | let a: f64 = calc.compute(1_i32).into(); + | +++++++ + +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. +error: could not compile `splat-overload-diagnostics` (bin "diag-method-return-values") due to 4 previous errors diff --git a/splat-overload-diagnostics/src/bin/diag-methods.rs b/splat-overload-diagnostics/src/bin/diag-methods.rs index 746ee06..32062db 100644 --- a/splat-overload-diagnostics/src/bin/diag-methods.rs +++ b/splat-overload-diagnostics/src/bin/diag-methods.rs @@ -9,8 +9,8 @@ struct Foo; overload! { impl Foo { - fn method(&self, x: i32) {} - fn method(&self, x: f64) {} + fn method(&self, _x: i32) {} + fn method(&self, _x: f64) {} } } diff --git a/splat-overload-diagnostics/src/bin/diag-methods.stderr b/splat-overload-diagnostics/src/bin/diag-methods.stderr new file mode 100644 index 0000000..e17b9ff --- /dev/null +++ b/splat-overload-diagnostics/src/bin/diag-methods.stderr @@ -0,0 +1,89 @@ +error[E0277]: the trait bound `(): MethodArgs` is not satisfied + --> splat-overload-diagnostics/src/bin/diag-methods.rs:20:9 + | +20 | foo.method(); + | ^^^^^^ the trait `MethodArgs` is not implemented for `()` + | +help: the following other types implement trait `MethodArgs` + --> splat-overload-diagnostics/src/bin/diag-methods.rs:10:1 + | +10 | / overload! { +11 | | impl Foo { +12 | | fn method(&self, _x: i32) {} +13 | | fn method(&self, _x: f64) {} +14 | | } +15 | | } + | | ^ + | | | + | |_`(f64,)` + | `(i32,)` + = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `(&str,): MethodArgs` is not satisfied + --> splat-overload-diagnostics/src/bin/diag-methods.rs:21:16 + | +21 | foo.method("wrong type"); + | ------ ^^^^^^^^^^^^ the trait `MethodArgs` is not implemented for `(&str,)` + | | + | required by a bound introduced by this call + | +help: the following other types implement trait `MethodArgs` + --> splat-overload-diagnostics/src/bin/diag-methods.rs:10:1 + | +10 | / overload! { +11 | | impl Foo { +12 | | fn method(&self, _x: i32) {} +13 | | fn method(&self, _x: f64) {} +14 | | } +15 | | } + | | ^ + | | | + | |_`(f64,)` + | `(i32,)` +note: required by a bound in `Foo::method` + --> splat-overload-diagnostics/src/bin/diag-methods.rs:10:1 + | +10 | / overload! { +11 | | impl Foo { +12 | | fn method(&self, _x: i32) {} +13 | | fn method(&self, _x: f64) {} +14 | | } +15 | | } + | |_^ required by this bound in `Foo::method` + = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `(_, _): MethodArgs` is not satisfied + --> splat-overload-diagnostics/src/bin/diag-methods.rs:23:16 + | +23 | foo.method(1_i32, 2); + | ------ ^^^^^ the trait `MethodArgs` is not implemented for `(_, _)` + | | + | required by a bound introduced by this call + | +help: the following other types implement trait `MethodArgs` + --> splat-overload-diagnostics/src/bin/diag-methods.rs:10:1 + | +10 | / overload! { +11 | | impl Foo { +12 | | fn method(&self, _x: i32) {} +13 | | fn method(&self, _x: f64) {} +14 | | } +15 | | } + | | ^ + | | | + | |_`(f64,)` + | `(i32,)` +note: required by a bound in `Foo::method` + --> splat-overload-diagnostics/src/bin/diag-methods.rs:10:1 + | +10 | / overload! { +11 | | impl Foo { +12 | | fn method(&self, _x: i32) {} +13 | | fn method(&self, _x: f64) {} +14 | | } +15 | | } + | |_^ required by this bound in `Foo::method` + = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) + +For more information about this error, try `rustc --explain E0277`. +error: could not compile `splat-overload-diagnostics` (bin "diag-methods") due to 3 previous errors From 098454a072953ff055db37aa758e25485a69ba98 Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 3 Sep 2026 16:39:55 -0400 Subject: [PATCH 9/9] Add diagnostics for missing overloads --- .../bin/diag-function-return-values.stderr | 42 +++++++++++++------ .../src/bin/diag-functions.stderr | 28 +++++++++---- splat-overload/src/lib.rs | 6 +++ 3 files changed, 56 insertions(+), 20 deletions(-) diff --git a/splat-overload-diagnostics/src/bin/diag-function-return-values.stderr b/splat-overload-diagnostics/src/bin/diag-function-return-values.stderr index 0fd3f93..7ad9e5e 100644 --- a/splat-overload-diagnostics/src/bin/diag-function-return-values.stderr +++ b/splat-overload-diagnostics/src/bin/diag-function-return-values.stderr @@ -1,9 +1,12 @@ -error[E0277]: the trait bound `(): FooArgs` is not satisfied +error[E0277]: missing overload for arguments `()` --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:15:5 | 15 | foo(); - | ^^^ the trait `FooArgs` is not implemented for `()` + | ^^^ the argument types `()` do not match any overload | + = help: the trait `FooArgs` is not implemented for `()` + = note: check for missing or extra arguments, and check argument types + = note: consider adding a new overload in the overload! { ... } block help: the following other types implement trait `FooArgs` --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:8:1 | @@ -25,14 +28,17 @@ note: required by a bound in `foo` | |_^ required by this bound in `foo` = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `(&str,): FooArgs` is not satisfied +error[E0277]: missing overload for arguments `(&str,)` --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:16:9 | 16 | foo("wrong type"); - | --- ^^^^^^^^^^^^ the trait `FooArgs` is not implemented for `(&str,)` + | --- ^^^^^^^^^^^^ the argument types `(&str,)` do not match any overload | | | required by a bound introduced by this call | + = help: the trait `FooArgs` is not implemented for `(&str,)` + = note: check for missing or extra arguments, and check argument types + = note: consider adding a new overload in the overload! { ... } block help: the following other types implement trait `FooArgs` --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:8:1 | @@ -54,14 +60,17 @@ note: required by a bound in `foo` | |_^ required by this bound in `foo` = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `(_, _, _): FooArgs` is not satisfied +error[E0277]: missing overload for arguments `(_, _, _)` --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:18:9 | 18 | foo(1_i32, 2, 3); - | --- ^^^^^ the trait `FooArgs` is not implemented for `(_, _, _)` + | --- ^^^^^ the argument types `(_, _, _)` do not match any overload | | | required by a bound introduced by this call | + = help: the trait `FooArgs` is not implemented for `(_, _, _)` + = note: check for missing or extra arguments, and check argument types + = note: consider adding a new overload in the overload! { ... } block help: the following other types implement trait `FooArgs` --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:8:1 | @@ -91,12 +100,15 @@ error[E0308]: mismatched types | | | expected due to this -error[E0277]: the trait bound `(): FooArgs` is not satisfied +error[E0277]: missing overload for arguments `()` --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:15:5 | 15 | foo(); - | ^^^^^ the trait `FooArgs` is not implemented for `()` + | ^^^^^ the argument types `()` do not match any overload | + = help: the trait `FooArgs` is not implemented for `()` + = note: check for missing or extra arguments, and check argument types + = note: consider adding a new overload in the overload! { ... } block help: the following other types implement trait `FooArgs` --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:8:1 | @@ -110,12 +122,15 @@ help: the following other types implement trait `FooArgs` | `(i32,)` = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `(&str,): FooArgs` is not satisfied +error[E0277]: missing overload for arguments `(&str,)` --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:16:5 | 16 | foo("wrong type"); - | ^^^^^^^^^^^^^^^^^ the trait `FooArgs` is not implemented for `(&str,)` + | ^^^^^^^^^^^^^^^^^ the argument types `(&str,)` do not match any overload | + = help: the trait `FooArgs` is not implemented for `(&str,)` + = note: check for missing or extra arguments, and check argument types + = note: consider adding a new overload in the overload! { ... } block help: the following other types implement trait `FooArgs` --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:8:1 | @@ -129,12 +144,15 @@ help: the following other types implement trait `FooArgs` | `(i32,)` = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `(i32, {integer}, {integer}): FooArgs` is not satisfied +error[E0277]: missing overload for arguments `(i32, {integer}, {integer})` --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:18:5 | 18 | foo(1_i32, 2, 3); - | ^^^^^^^^^^^^^^^^ the trait `FooArgs` is not implemented for `(i32, {integer}, {integer})` + | ^^^^^^^^^^^^^^^^ the argument types `(i32, {integer}, {integer})` do not match any overload | + = help: the trait `FooArgs` is not implemented for `(i32, {integer}, {integer})` + = note: check for missing or extra arguments, and check argument types + = note: consider adding a new overload in the overload! { ... } block help: the following other types implement trait `FooArgs` --> splat-overload-diagnostics/src/bin/diag-function-return-values.rs:8:1 | diff --git a/splat-overload-diagnostics/src/bin/diag-functions.stderr b/splat-overload-diagnostics/src/bin/diag-functions.stderr index 46681e1..d98a784 100644 --- a/splat-overload-diagnostics/src/bin/diag-functions.stderr +++ b/splat-overload-diagnostics/src/bin/diag-functions.stderr @@ -1,9 +1,12 @@ -error[E0277]: the trait bound `(): FooArgs` is not satisfied +error[E0277]: missing overload for arguments `()` --> splat-overload-diagnostics/src/bin/diag-functions.rs:15:5 | 15 | foo(); - | ^^^ the trait `FooArgs` is not implemented for `()` + | ^^^ the argument types `()` do not match any overload | + = help: the trait `FooArgs` is not implemented for `()` + = note: check for missing or extra arguments, and check argument types + = note: consider adding a new overload in the overload! { ... } block help: the following other types implement trait `FooArgs` --> splat-overload-diagnostics/src/bin/diag-functions.rs:7:1 | @@ -54,14 +57,17 @@ note: function defined here 11 | | } | |_- -error[E0277]: the trait bound `(_, _, _, _, _): FooArgs` is not satisfied +error[E0277]: missing overload for arguments `(_, _, _, _, _)` --> splat-overload-diagnostics/src/bin/diag-functions.rs:18:9 | 18 | foo(1_i32, 2_f64, true, 4_u8, 5); - | --- ^^^^^ the trait `FooArgs` is not implemented for `(_, _, _, _, _)` + | --- ^^^^^ the argument types `(_, _, _, _, _)` do not match any overload | | | required by a bound introduced by this call | + = help: the trait `FooArgs` is not implemented for `(_, _, _, _, _)` + = note: check for missing or extra arguments, and check argument types + = note: consider adding a new overload in the overload! { ... } block help: the following other types implement trait `FooArgs` --> splat-overload-diagnostics/src/bin/diag-functions.rs:7:1 | @@ -86,12 +92,15 @@ note: required by a bound in `foo` | |_^ required by this bound in `foo` = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `(): FooArgs` is not satisfied +error[E0277]: missing overload for arguments `()` --> splat-overload-diagnostics/src/bin/diag-functions.rs:15:5 | 15 | foo(); - | ^^^^^ the trait `FooArgs` is not implemented for `()` + | ^^^^^ the argument types `()` do not match any overload | + = help: the trait `FooArgs` is not implemented for `()` + = note: check for missing or extra arguments, and check argument types + = note: consider adding a new overload in the overload! { ... } block help: the following other types implement trait `FooArgs` --> splat-overload-diagnostics/src/bin/diag-functions.rs:7:1 | @@ -107,12 +116,15 @@ help: the following other types implement trait `FooArgs` | `(i32, f64, bool, u8)` = note: this error originates in the macro `overload` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `(i32, f64, bool, u8, {integer}): FooArgs` is not satisfied +error[E0277]: missing overload for arguments `(i32, f64, bool, u8, {integer})` --> splat-overload-diagnostics/src/bin/diag-functions.rs:18:5 | 18 | foo(1_i32, 2_f64, true, 4_u8, 5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FooArgs` is not implemented for `(i32, f64, bool, u8, {integer})` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the argument types `(i32, f64, bool, u8, {integer})` do not match any overload | + = help: the trait `FooArgs` is not implemented for `(i32, f64, bool, u8, {integer})` + = note: check for missing or extra arguments, and check argument types + = note: consider adding a new overload in the overload! { ... } block help: the following other types implement trait `FooArgs` --> splat-overload-diagnostics/src/bin/diag-functions.rs:7:1 | diff --git a/splat-overload/src/lib.rs b/splat-overload/src/lib.rs index b192869..6ab747f 100644 --- a/splat-overload/src/lib.rs +++ b/splat-overload/src/lib.rs @@ -185,6 +185,12 @@ fn generate_free_functions(functions: Vec) -> TokenStream { } let generated = quote! { + #[diagnostic::on_unimplemented( + message = "missing overload for arguments `{Self}`", + label = "the argument types `{Self}` do not match any overload", + note = "check for missing or extra arguments, and check argument types", + note = "consider adding a new overload in the overload! {{ ... }} block", + )] trait #trait_name: std::marker::Tuple { type Output; fn call(self) -> Self::Output;