Skip to content

Instantly share code, notes, and snippets.

@algesten
Created August 7, 2022 13:22
Show Gist options
  • Save algesten/8009cf37503513cfe341da5a62758799 to your computer and use it in GitHub Desktop.
Save algesten/8009cf37503513cfe341da5a62758799 to your computer and use it in GitHub Desktop.
Unhelpful tracing macro error
use tracing::{info_span, Span};
pub struct Blah {
pub span: Span,
}
impl Blah {
pub fn new(name: &str) -> Self {
Blah {
span: info_span!(name),
}
}
}
Compiling ice v0.1.0 (/Users/martin/dev/str0m/ice)
error[E0435]: attempt to use a non-constant value in a constant
--> ice/tests/blah.rs:10:30
|
10 | span: info_span!(name),
| -----------^^^^-
| | |
| | non-constant value
| help: consider using `let` instead of `static`: `let CALLSITE`
For more information about this error, try `rustc --explain E0435`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment