Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug and display names for constructor and render parameters don't compile with "tracing" enabled #86

Closed
Tamschi opened this issue Jan 6, 2022 · 1 comment
Labels
priority: next I'll probably get to it, eventually. state: inactive No action needed or possible. The issue is either fixed or addressed better by other issues. type: bug Something isn't working as expected

Comments

@Tamschi
Copy link
Owner

Tamschi commented Jan 6, 2022

Describe the bug

Constructor and render parameters can't be named debug or display. This issue is inherited from tokio-rs/tracing#1318.

To Reproduce

Write a component as follows:

asteracea::component! {
    pub Test(
        pub debug: (),
        pub display: (),
    )(
        debug: (),
        display: (),
    ) -> Sync

    with {
        drop((debug, display));
    } []
}

This fails to compile with errors like the following:

error[E0282]: type annotations needed
 --> […]
  |
7 |         pub debug: (),
  |             ^^^^^ cannot infer type for type parameter `T` declared on the function `debug`

Expected behavior

This should compile.

Screenshots

Not applicable.

please complete the following information:

  • rustc --version: rustc 1.57.0 (f1edd0429 2021-11-29)
  • Crate version (if applicable): current develop branch

Additional context

This is most likely a macro hygiene issue somewhere in tracing.
It doesn't appear to originate in the #[instrument] attribute macro itself, but the fact that it appears on the parameter span is curious. (However, that span is reused for the field = given to tracing.)

@Tamschi Tamschi added type: bug Something isn't working as expected priority: next I'll probably get to it, eventually. state: inactive No action needed or possible. The issue is either fixed or addressed better by other issues. labels Jan 6, 2022
@Tamschi
Copy link
Owner Author

Tamschi commented Jan 13, 2022

This ended up avoided as a side-effect of making feature "tracing" compatible with destructured parameters.

@Tamschi Tamschi closed this as completed Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: next I'll probably get to it, eventually. state: inactive No action needed or possible. The issue is either fixed or addressed better by other issues. type: bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

1 participant