Skip to content

tracing::instrument: "Reached the type-length limit while instantiating ..." #616

@akshayknarayan

Description

@akshayknarayan

Bug Report

Version

├── tracing v0.1.10
│   ├── tracing-attributes v0.1.7
│   └── tracing-core v0.1.10
├── tracing-attributes v0.1.7 (*)
└── tracing-futures v0.2.3
    └── tracing v0.1.10 (*)

Platform

Linux 4.19.0

Crates

tracing-attributes v 0.1.7

Description

Best-effort minimal example:

#[tokio::main]
async fn main() {
    foo_4().await.unwrap();
}

#[tracing::instrument(level = "debug")]
async fn foo() -> usize {
    0
}

#[tracing::instrument(level = "debug")]
async fn foo_1() -> Result<(), ()> {
    foo().await;
    Ok(())
}

#[tracing::instrument(level = "debug")]
async fn foo_2() -> Result<(), ()> {
    return foo_1().await;
}

#[tracing::instrument(level = "debug")]
async fn foo_3() -> Result<(), ()> {
    return foo_2().await;
}

#[tracing::instrument(level = "debug")]
async fn foo_4() -> Result<(), ()> {
    return foo_3().await;
}

This causes:

error: reached the type-length limit while instantiating `std::pin::Pin::<&mut std::future...}[1]::poll[0]::{{closure}}[0])]>`
    |
    = note: consider adding a `#![type_length_limit="1439423"]` attribute to your crate

tracing-attributes + tracing-futures seems to be inflating the type-length significantly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    crate/attributesRelated to the `tracing-attributes` cratekind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions