Skip to content

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

@Tamschi

Description

@Tamschi

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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: nextI'll probably get to it, eventually.state: inactiveNo action needed or possible. The issue is either fixed or addressed better by other issues.type: bugSomething isn't working as expected

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions