When writing non-async code, the common case is that a span precisely corresponds to a lexical scope. At the moment, this case requires an introduction of otherwise unnecessary local variable:
let span = tracing::info_span!("spam");
let _span = span.enter();
I wish the following worked:
let _span = tracing::info_span_enter!("spam");
To do this, I think we can introduce a second version of Entered:
pub struct EnteredScope {
span: Span, // note: owns the span
_not_send: PhantomData<*mut ()>,
}
after that, all the lifetimes should work out.