0xPlaygrounds / 0xPlaygrounds/rig

Remove the redundant `tool_macro` alias for `#[rig_tool]`

Abierto Apto para principiantes
#2,452 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Rust
Estrellas
8.6k
Forks
959
Merge medio
4 h 32 min
PR fusionados (30 d)
117

Descripción

`#[rig_tool]` is re-exported under a second name, `tool_macro`, from all three crate roots. There is only one macro — `rig_derive::rig_tool` (`crates/rig-derive/src/lib.rs:148`), the only `#[proc_macro_attribute]` of its kind — and both names point at it:

- `crates/rig-core/src/lib.rs:203` — `pub use rig_derive::{rig_tool, rig_tool as tool_macro};`
- `crates/rig-agent/src/lib.rs:87,90` — the same pair
- `src/lib.rs:251` — `pub use rig_derive::rig_tool as tool_macro;`

`tool_macro` has never been a distinct macro: `git log -S 'pub fn tool_macro'` across all refs returns nothing. The name first appears in #2197 (the rig-core / rig-agent facade split) purely as an alias, added beside the `rig_tool` re-export.

The cost is user confusion, which #2448 is the concrete instance of: the docs use one spelling and rig-derive's examples use the other, so a reader reasonably assumes they are two macros, or that one supersedes the other. Neither is true.

Nothing in the tree prefers `tool_macro`. Its only occurrences are the alias definitions and the tests written to pin that the alias resolves — `tests/core/tool_macro.rs` and `tests/fixtures/tool_facade/src/main.rs`, one of which does `use rig::tool_macro as rig_tool;` (`tests/providers/gemini/cassette/tool_definitions.rs:237`).

## Proposal

Delete `tool_macro` and keep `rig_tool`, the macro's real name — the one rig-derive defines, documents and uses in its examples, and the one that works identically whether you depend on `rig`, `rig-core` or `rig-agent`.

This is the same class of item #2429 cleared this cycle; it was missed there presumably because it carries no `#[deprecated]` and no persisted-record tolerance behind it. The change is the three re-export sites plus retargeting the alias-pinning tests to `rig_tool`, and a "Removed" entry in the migration guide.

Happy to open the PR if the direction is agreed.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

The issue identifies three files with the redundant alias: crates/rig-core/src/lib.rs, crates/rig-agent/src/lib.rs, and src/lib.rs. Start by removing the `tool_macro` alias lines from these files. Then, update the test files that reference the alias: tests/core/tool_macro.rs, tests/fixtures/tool_facade/src/main.rs, and tests/providers/gemini/cassette/tool_definitions.rs, changing `tool_macro` to `rig_tool`. Finally, verify the build passes with `cargo test` and add a 'Removed' note to the migration guide.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
rust
Área
backend-api-design
Tipo de issue
Refactorización
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Tranquilo
Claridad
Bien especificado
Aptitud para principiantes
65/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.