Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,27 @@ jobs:
diff --unified=5 "cpp-overload-test/examples/$test_name.stderr" /tmp/"$test_name.stderr"
done

markdown-lint:
name: 11. Lint Markdown files
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run markdownlint-cli
uses: nosborn/github-action-markdown-cli@508d6cefd8f0cc99eab5d2d4685b1d5f470042c1 # v3.5.0
with:
files: "**.md"

markdown-style:
name: 12. Check Markdown style
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run prettier on Markdown files
# The version available on macOS homebrew
run: npx --yes prettier@3.9.6 --check **/*.md

all:
name: All checks
# Always run this job, even if earlier steps were skipped (or failed):
Expand All @@ -247,6 +268,8 @@ jobs:
- diagnostics-rust
- cpp-overload-test-ok
- cpp-overload-test-fail
- markdown-lint
- markdown-style
steps:
- name: Fail if any other job failed
# Every job status needs to be checked here, because `always()` stops failures from propagating automatically
Expand All @@ -262,3 +285,5 @@ jobs:
[[ "${{ needs.diagnostics-rust.result }}" == "success" ]] || exit 1
[[ "${{ needs.cpp-overload-test-ok.result }}" == "success" ]] || exit 1
[[ "${{ needs.cpp-overload-test-fail.result }}" == "success" ]] || exit 1
[[ "${{ needs.markdown-lint.result }}" == "success" ]] || exit 1
[[ "${{ needs.markdown-style.result }}" == "success" ]] || exit 1
17 changes: 17 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# MD013/line-length : Line length : https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md013.md
MD013:
# Number of characters
line_length: 100
# Number of characters for headings
heading_line_length: 100
# Number of characters for code blocks
code_block_line_length: 100

# MD033/no-inline-html : Inline HTML : https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md033.md
MD033:
# Allowed elements
allowed_elements: [
"br",
]
# Allowed elements in tables
table_allowed_elements: []
18 changes: 9 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# Contributing to a Rust Foundation Project

Thank you for your interest in contributing to this Rust Foundation project.
Thank you for your interest in contributing to this Rust Foundation project.
We are happy and excited to review and accept your pull requests.

## Before You Begin Contributing

### Licenses

There is no Contributor License Agreement to sign to contribute this project.
Your contribution will be covered by the license(s) granted for this
repository, commonly MIT, Apache, and/or CC-BY, but could be a different
license. In other words, your contribution will be licensed to the Foundation
and all downstream users under those licenses. You can read more in the
There is no Contributor License Agreement to sign to contribute this project.
Your contribution will be covered by the license(s) granted for this
repository, commonly MIT, Apache, and/or CC-BY, but could be a different
license. In other words, your contribution will be licensed to the Foundation
and all downstream users under those licenses. You can read more in the
Foundation's [intellectual property policy][ip-policy].

### Code of Conduct

Please review and adhere to the [code of conduct](CODE_OF_CONDUCT.md) before
Please review and adhere to the [code of conduct](CODE_OF_CONDUCT.md) before
contributing any pull requests.

## Contribution Process

All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult [GitHub Help][pull-requests]
use GitHub pull requests for this purpose. Consult [GitHub Help][pull-requests]
for more information on using pull requests.

### Issues

Do you just want to file an issue for the project? Please do so in GitHub under
Do you just want to file an issue for the project? Please do so in GitHub under
the `Issues` tab.

[ip-policy]: https://foundation.rust-lang.org/policies/intellectual-property-policy/
Expand Down
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
# Rust Function Overloading Macros

This repository is a [Rust Foundation *experiment*](https://rustfoundation.org/media/experimenting-with-function-overloading-in-rust-why-it-matters/) in ergonomic function overloading in Rust.
This repository is a [Rust Foundation *experiment*][experiment-blog] in ergonomic function
overloading in Rust.

The experiment uses macros to improve the ergonomics of the [`splat` Rust language experiment](https://github.com/rust-lang/rust/issues/153629).
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 experiment uses macros to improve the ergonomics of the
[`splat` Rust language experiment][splat-tracking]. Technical details for the current stage of the
experiment can be found [on the Inside Rust blog][technical-blog].

Most of this code requires a recent nightly Rust compiler.

[experiment-blog]: https://rustfoundation.org/media/experimenting-with-function-overloading-in-rust-why-it-matters/
[splat-tracking]: https://github.com/rust-lang/rust/issues/153629
[technical-blog]: https://blog.rust-lang.org/inside-rust/2026/08/19/overloading-experiment/

## Experimental Outcomes

Some outcomes of this experiment are summarised in the [C++ overloads in Rust](https://github.com/rustfoundation/overloading-macros/blob/main/cpp-overloads-in-rust.md) document & compatibility table.
Some outcomes of this experiment are summarised in the [C++ overloads in Rust][cpp-overloads-rust]
document & compatibility table.

These outcomes are based on the current state of the experimental compiler feature and overloading
macro: they are not Rust language design decisions.

These outcomes are based on the current state of the experimental compiler feature and overloading macro: they are not Rust language design decisions.
[cpp-overloads-rust]: https://github.com/rustfoundation/overloading-macros/blob/main/cpp-overloads-in-rust.md

## Macro Setup

Expand All @@ -22,7 +32,8 @@ Add this `overloading-macros` crate as a dependency.
rustup update nightly
cd your-project-name
rustup override set nightly
cargo add overloading-macros || cargo add --git https://github.com/rustfoundation/overloading-macros overloading-macros
cargo add overloading-macros || \
cargo add --git https://github.com/rustfoundation/overloading-macros overloading-macros
```

Then use the macro to add overloading to your functions or methods.
Expand Down
3 changes: 2 additions & 1 deletion cpp-overload-test/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
This code is automatically run in CI:

- Submodules of `lib.rs` are expected to succeed. They are named after each C++ class.
- Examples are expected to fail, with output in the corresponding `.stderr` file, also named after C++ classes.
- Examples are expected to fail, with output in the corresponding `.stderr` file, also named after
C++ classes.

Sometimes the C++ code extracted by `cpp_build` will become outdated, and you will get errors like:

Expand Down
Loading