[PATCH v3 0/4] Enable rustdoc tests for the macros crate

Ethan D. Twardy posted 4 patches 1 year, 5 months ago
rust/Makefile        |  29 ++++++++--
rust/macros/lib.rs   | 125 ++++++++++++++++++++++++++++++++-----------
rust/macros/paste.rs |  15 ++++--
3 files changed, 131 insertions(+), 38 deletions(-)
[PATCH v3 0/4] Enable rustdoc tests for the macros crate
Posted by Ethan D. Twardy 1 year, 5 months ago
This patch series addresses GitHub issue Rust-For-Linux/linux#1076 by
enabling the rustdoc tests for the macros crate and updating kbuild to
compile these tests with appropriate dependencies respected. Reviewers:
Please pay particular attention to the Kbuild changes in rust/Makefile.
I appreciate your time in reviewing this series!

Changes from v2:
 - Remove one more noisy empty line in the macros doctest

Changes from v1:
 - Resolve a duplicate kbuild rule identified by the test robot
 - Fix a number of formatting issues in the tests

Ethan D. Twardy (4):
  kbuild: rust: Expand rusttest target for macros
  rust: Enable test for macros::module
  rust: macros: Enable use from macro_rules!
  rust: macros: Enable the rest of the tests

 rust/Makefile        |  29 ++++++++--
 rust/macros/lib.rs   | 125 ++++++++++++++++++++++++++++++++-----------
 rust/macros/paste.rs |  15 ++++--
 3 files changed, 131 insertions(+), 38 deletions(-)


base-commit: a126eca844353360ebafa9088d22865cb8e022e3
-- 
2.44.2
Re: [PATCH v3 0/4] Enable rustdoc tests for the macros crate
Posted by Miguel Ojeda 1 year, 1 month ago
On Thu, Jul 4, 2024 at 4:57 PM Ethan D. Twardy <ethan.twardy@gmail.com> wrote:
>
> This patch series addresses GitHub issue Rust-For-Linux/linux#1076 by
> enabling the rustdoc tests for the macros crate and updating kbuild to
> compile these tests with appropriate dependencies respected. Reviewers:
> Please pay particular attention to the Kbuild changes in rust/Makefile.
> I appreciate your time in reviewing this series!

Applied to `rust-next` -- thanks Ethan!

I had to rebase it and simplify/change/clean some things here and
there as you can see below, so it would be great if you can
double-check the result in the branch -- please let me know if you see
anything wrong!

    [ Rebased (`alloc` is gone nowadays, sysroot handling is simpler) and
      simplified (reused `rustdoc_test` rule instead of adding a new one,
      no need for `rustdoc-compiler_builtins`, removed unneeded `macros`
      explicit path). Made `vtable` example fail (avoiding to increase
      the complexity in the `rusttest` target). Removed unstable
      `-Zproc-macro-backtrace` option. Reworded accordingly. - Miguel ]

    [ Rebased (moved the `export` to the `rustdoc_test` rule, enable the
      firmware example too). Removed `export` for `RUST_MODFILE`. Removed
      unneeded `rust` language in examples, as well as `#[macro_use]`
      `extern`s. Reworded accordingly. - Miguel ]

    [ Rebased (one fix was already applied) and reworded. Remove unneeded
      `rust` as language in examples. - Miguel ]

    [ Rebased (use `K{Box,Vec}` instead, enable `lint_reasons` feature).
      Remove unneeded `rust` as language in examples, as well as
      `#[macro_use]` `extern`s. - Miguel ]

I think we could also simplify some of those tests (I think the
examples are clear without so many constants), but I didn't want to
introduce extra/unneeded changes to your series.

Thanks!

Cheers,
Miguel