ci: add tracing_unstable to CI (#1894)

* ci: add `tracing_unstable` to CI

Currently, the `valuable` support requires the `tracing_unstable` cfg to
be set. Because none of our current CI jobs set this, we aren't
currently testing that code, and have no way of even ensuring that it
compiles. This is Bad.

This PR adds a CI job to run tests with the unstable cfg enabled.

* core: fix wrong `self` types with `valuable`

This should fix the build.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
This commit is contained in:
Eliza Weisman 2022-02-03 13:50:58 -08:00 committed by GitHub
parent 08dc62cd5e
commit 1a9ee003ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 3 deletions

View File

@ -270,6 +270,26 @@ jobs:
command: test
args: --all
test-unstable:
# Test the `tracing-unstable` cfg flags
env:
RUSTFLAGS: "--cfg tracing_unstable"
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all --features "valuable"
features-stable:
# Feature flag tests that run on stable Rust.
# TODO(david): once tracing's MSRV goes up to Rust 1.51, we should be able to switch to

View File

@ -2,7 +2,7 @@
mod app {
use std::collections::HashMap;
use tracing::field::valuable;
use tracing::{info, info_span, instrument};
use tracing::{info, instrument};
use valuable::Valuable;
#[derive(Valuable)]

View File

@ -643,7 +643,7 @@ impl crate::sealed::Sealed for valuable::Value<'_> {}
#[cfg_attr(docsrs, doc(cfg(all(tracing_unstable, feature = "valuable"))))]
impl Value for valuable::Value<'_> {
fn record(&self, key: &Field, visitor: &mut dyn Visit) {
visitor.record_value(key, self)
visitor.record_value(key, *self)
}
}
@ -654,7 +654,7 @@ impl crate::sealed::Sealed for &'_ dyn valuable::Valuable {}
#[cfg_attr(docsrs, doc(cfg(all(tracing_unstable, feature = "valuable"))))]
impl Value for &'_ dyn valuable::Valuable {
fn record(&self, key: &Field, visitor: &mut dyn Visit) {
visitor.record_value(key, &self.as_value())
visitor.record_value(key, self.as_value())
}
}