Skip to content

fix: support service impl-only type generics#1278

Merged
m62624 merged 7 commits intomasterfrom
fix/generic-service-macro
Apr 7, 2026
Merged

fix: support service impl-only type generics#1278
m62624 merged 7 commits intomasterfrom
fix/generic-service-macro

Conversation

@m62624
Copy link
Copy Markdown
Member

@m62624 m62624 commented Apr 3, 2026

Fix #[service] for impl-only type generics.

For impls like #[service] impl<T: Bound> Service<T> { ... }, generated invocation_io! code ended up in a non-generic *_meta module while still referencing Service<T>, making T out of scope. Use an internal __SERVICE_INTERFACE_ID inside *_meta so impl generics do not leak into generated meta/params code.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the service macro generation by introducing a __SERVICE_INTERFACE_ID constant, which is used in the Identifiable trait implementation and invocation_io! macros. This change ensures that generic parameters on the service implementation are correctly scoped. A new test case was added to verify this behavior. Feedback suggests that a similar scoping issue remains for generic base service paths within the overrides attribute, which should be addressed to ensure complete coverage of generic scenarios.

Comment thread rs/macros/core/src/service/mod.rs
@m62624 m62624 marked this pull request as draft April 3, 2026 09:50
@m62624 m62624 force-pushed the fix/generic-service-macro branch from 65b8012 to b03ff80 Compare April 6, 2026 10:46
@m62624 m62624 marked this pull request as ready for review April 6, 2026 11:05
@m62624 m62624 force-pushed the fix/generic-service-macro branch from 4c76761 to 0deea41 Compare April 6, 2026 12:49
@m62624 m62624 requested a review from vobradovich April 7, 2026 05:35
@m62624 m62624 force-pushed the fix/generic-service-macro branch from 1fdf460 to 25b064d Compare April 7, 2026 05:50
@m62624 m62624 force-pushed the fix/generic-service-macro branch from 25b064d to 2121753 Compare April 7, 2026 12:20
@m62624 m62624 merged commit bae8442 into master Apr 7, 2026
4 checks passed
@m62624 m62624 deleted the fix/generic-service-macro branch April 7, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants