tracing: Instrument attribute with async-trait breaks include_str

Bug Report

Version

tracing v0.1.15 tracing-futures v0.2.4

Platform

Windows (64-bit)

Crates

async-trait v0.1.35

Description

When adding #[tracing::instrument] to a function in a #[async_trait::async_trait] trait implementation, include_str will think its in the root of the src folder when its not.

File tree:

src/
+-- lib.rs
+-- example/
    +-- mod.rs
    +-- text.txt

lib.rs:

mod example;

#[async_trait::async_trait]
pub trait Test {
    async fn example(&self);
}

mod.rs:

use crate::Test;

#[derive(Debug)]
pub struct Example {}


#[async_trait::async_trait]
impl Test for Example {
    #[tracing::instrument]
    async fn example(&self) {
        let _text = include_str!("text.txt");
    }
}

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (18 by maintainers)

Most upvoted comments

I will try to bisect it further, if I have the time (and courage). Had I to do a completely uneducated guess, I would have said this may be related to https://github.com/rust-lang/rust/commit/d277904582d530feb4701dc76508fdf473cce8f4#diff-0e785ff001c38d0918429e6a9880f0cd ?