Skip to content

#[tokio::main] proc macro attaches questionable spans to user code #5518

@jonas-schievink

Description

@jonas-schievink

Version
tokio-macros 1.8.2

Platform
n/a

Description

In the following code, the variable; statement has incorrect spans attached to itself:

#[tokio::main]
async fn main() {
    let variable = "";
    variable;
}

The spans of variable; point to tokio::runtime::Builder::new_multi_thread() in the output of the macro. This causes rust-analyzer to (correctly) highlight variable as a function call and to show the new_multi_thread function on hover.

Please consider not doing this, as it degrades IDE functionality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tokio-macrosArea: The tokio-macros crateC-requestCategory: A non-feature request, e.g.: metadata updates, optimization suggestion, etc.E-help-wantedCall for participation: Help is requested to fix this issue.E-mediumCall for participation: Experience needed to fix: Medium / intermediate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions