diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:03:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:03:36 +0000 |
commit | 17d40c6057c88f4c432b0d7bac88e1b84cb7e67f (patch) | |
tree | 3f66c4a5918660bb8a758ab6cda5ff8ee4f6cdcd /vendor/tracing-core | |
parent | Adding upstream version 1.64.0+dfsg1. (diff) | |
download | rustc-upstream/1.65.0+dfsg1.tar.xz rustc-upstream/1.65.0+dfsg1.zip |
Adding upstream version 1.65.0+dfsg1.upstream/1.65.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | vendor/tracing-core/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/tracing-core/CHANGELOG.md | 23 | ||||
-rw-r--r-- | vendor/tracing-core/Cargo.toml | 6 | ||||
-rw-r--r-- | vendor/tracing-core/README.md | 26 | ||||
-rw-r--r-- | vendor/tracing-core/src/callsite.rs | 9 | ||||
-rw-r--r-- | vendor/tracing-core/src/dispatcher.rs | 15 | ||||
-rw-r--r-- | vendor/tracing-core/src/field.rs | 44 | ||||
-rw-r--r-- | vendor/tracing-core/src/metadata.rs | 89 |
8 files changed, 177 insertions, 37 deletions
diff --git a/vendor/tracing-core/.cargo-checksum.json b/vendor/tracing-core/.cargo-checksum.json index 157a61ad4..c51d0e671 100644 --- a/vendor/tracing-core/.cargo-checksum.json +++ b/vendor/tracing-core/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"291325b2d5ae0101a9cb9dadfa64810c1c98d04f43c7c1fcee4dc585cb34cf37","Cargo.toml":"d4029f638b3bbb553470ab93080fe78a155db13780e8e52d073d6ca10939614d","LICENSE":"898b1ae9821e98daf8964c8d6c7f61641f5f5aa78ad500020771c0939ee0dea1","README.md":"31f1a3504716da08f771f2fd10e06298a1fd6ecfdc2c78fd1cd66cce693d4e1c","src/callsite.rs":"6a69e08ba8e70234f4ca2a5c6215cdb5ce8d1b0e637102501787169448cbf2a1","src/dispatcher.rs":"5ffade623f3f19a7c497bc72da2d15fcdbd1ab65b1f393c9a9271dd742d99867","src/event.rs":"f2673bf5d266972e567e521c9cd92fb33f28b0c7e010937e3bc2bf9eb483087f","src/field.rs":"ec7f20bdb7a9d79b900777fc444ce82282bdfc4be4afe6223e2b7617da63964d","src/lazy.rs":"318e3558e4446abf26294287167c0788e343044a28072f9217bd985929809087","src/lib.rs":"088b29ecce4bdb5b68df9cbe3984f4b22d7124988866d5aace0e7029ea033d58","src/metadata.rs":"1019ffecd3d8a3636708c6654f34074c041af88b6221c4950037c6bbf09af835","src/parent.rs":"5d5ad733343280a64a1feb6a008e186c39305ec554f14279012b8d7915821471","src/span.rs":"dcf2135e4ca158c1be45007f0be25426c375a4081f8f3c5a4d7f7382d8a950a4","src/spin/LICENSE":"58545fed1565e42d687aecec6897d35c6d37ccb71479a137c0deb2203e125c79","src/spin/mod.rs":"c458ce5e875acb7fbfb279f23254f4924d7c6d6fee419b740800d2e8087d1524","src/spin/mutex.rs":"4d30ff2b59b18fd7909f016e1abdf9aa0c04aa11d047a46e98cffe1319e32dad","src/spin/once.rs":"3781fd4eae0db04d80c03a039906c99b1e01d1583b29ac0144e6fbbd5a0fef0b","src/stdlib.rs":"698693062b8109cace3ffea02e9c2372b7d5b5d43c0b11cb4800b0e7b1a69971","src/subscriber.rs":"916d315ca324a752f70fc3cc557089418a63779ceda54955f55f0ab3c1f3fc7b","tests/common/mod.rs":"0bbb217baa17df0f96cc1ff57dfa74ccc5a959e7f66b15bb7d25d5f43358a278","tests/dispatch.rs":"d3f000fab43734a854c82a7783142910c5e79f806cbd3f8ec5eded598c59ddb1","tests/global_dispatch.rs":"cdc05d77e448ee8b50bfb930abafa3f19b4c6f922b7bebc7797fa1dbdaa1d398","tests/macros.rs":"b1603d888b349c8d103794deceec3b1ae4538b8d3eba805f3f561899e8ad0dd2"},"package":"7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7"}
\ No newline at end of file +{"files":{"CHANGELOG.md":"10eae751c81a268b6118e2dea49d0d501ea4d2a69ece6350232f3800407ab2d3","Cargo.toml":"d29fae6d4ae043c79697e4305224fb8f65279515e1db6ad1211ccd27d073287f","LICENSE":"898b1ae9821e98daf8964c8d6c7f61641f5f5aa78ad500020771c0939ee0dea1","README.md":"f40e479c4d837f4fec140b0f4adad7aae062d55b53708f2255b93217f19d22a9","src/callsite.rs":"f5e9cdaed7fdc75dad5da6486af0ea6e9be896ab5fc1b44c49a90b8b88b33d53","src/dispatcher.rs":"1d129a0c3af976669787733101c2ce7d2f9eca794deeb2ae5a662085e966e0cf","src/event.rs":"f2673bf5d266972e567e521c9cd92fb33f28b0c7e010937e3bc2bf9eb483087f","src/field.rs":"4ec913012ffcf05d3feba2a5ea2ba99c35e2072dabfa2db75614c0e122961b7e","src/lazy.rs":"318e3558e4446abf26294287167c0788e343044a28072f9217bd985929809087","src/lib.rs":"088b29ecce4bdb5b68df9cbe3984f4b22d7124988866d5aace0e7029ea033d58","src/metadata.rs":"1a79326aee210b9e20eb08d5baa22133390f2b1e868cf4dc72a3e9bc9a37d17f","src/parent.rs":"5d5ad733343280a64a1feb6a008e186c39305ec554f14279012b8d7915821471","src/span.rs":"dcf2135e4ca158c1be45007f0be25426c375a4081f8f3c5a4d7f7382d8a950a4","src/spin/LICENSE":"58545fed1565e42d687aecec6897d35c6d37ccb71479a137c0deb2203e125c79","src/spin/mod.rs":"c458ce5e875acb7fbfb279f23254f4924d7c6d6fee419b740800d2e8087d1524","src/spin/mutex.rs":"4d30ff2b59b18fd7909f016e1abdf9aa0c04aa11d047a46e98cffe1319e32dad","src/spin/once.rs":"3781fd4eae0db04d80c03a039906c99b1e01d1583b29ac0144e6fbbd5a0fef0b","src/stdlib.rs":"698693062b8109cace3ffea02e9c2372b7d5b5d43c0b11cb4800b0e7b1a69971","src/subscriber.rs":"916d315ca324a752f70fc3cc557089418a63779ceda54955f55f0ab3c1f3fc7b","tests/common/mod.rs":"0bbb217baa17df0f96cc1ff57dfa74ccc5a959e7f66b15bb7d25d5f43358a278","tests/dispatch.rs":"d3f000fab43734a854c82a7783142910c5e79f806cbd3f8ec5eded598c59ddb1","tests/global_dispatch.rs":"cdc05d77e448ee8b50bfb930abafa3f19b4c6f922b7bebc7797fa1dbdaa1d398","tests/macros.rs":"b1603d888b349c8d103794deceec3b1ae4538b8d3eba805f3f561899e8ad0dd2"},"package":"5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7"}
\ No newline at end of file diff --git a/vendor/tracing-core/CHANGELOG.md b/vendor/tracing-core/CHANGELOG.md index c6afcb077..2db8553c9 100644 --- a/vendor/tracing-core/CHANGELOG.md +++ b/vendor/tracing-core/CHANGELOG.md @@ -1,3 +1,26 @@ +# 0.1.29 (July 29, 2022) + +This release of `tracing-core` adds `PartialEq` and `Eq` implementations for +metadata types, and improves error messages when setting the global default +subscriber fails. + +### Added + +- `PartialEq` and `Eq` implementations for `Metadata` ([#2229]) +- `PartialEq` and `Eq` implementations for `FieldSet` ([#2229]) + +### Fixed + +- Fixed unhelpful `fmt::Debug` output for `dispatcher::SetGlobalDefaultError` + ([#2250]) +- Fixed compilation with `-Z minimal-versions` ([#2246]) + +Thanks to @jswrenn and @CAD97 for contributing to this release! + +[#2229]: https://github.com/tokio-rs/tracing/pull/2229 +[#2246]: https://github.com/tokio-rs/tracing/pull/2246 +[#2250]: https://github.com/tokio-rs/tracing/pull/2250 + # 0.1.28 (June 23, 2022) This release of `tracing-core` adds new `Value` implementations, including one diff --git a/vendor/tracing-core/Cargo.toml b/vendor/tracing-core/Cargo.toml index 40d797d54..957194d39 100644 --- a/vendor/tracing-core/Cargo.toml +++ b/vendor/tracing-core/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" rust-version = "1.49.0" name = "tracing-core" -version = "0.1.28" +version = "0.1.29" authors = ["Tokio Contributors <team@tokio.rs>"] description = """ Core primitives for application-level tracing. @@ -47,7 +47,7 @@ rustc-args = [ ] [dependencies.once_cell] -version = "1.12" +version = "1.13.0" optional = true [features] @@ -60,7 +60,7 @@ std = ["once_cell"] [target."cfg(tracing_unstable)".dependencies.valuable] version = "0.1.0" optional = true -default_features = false +default-features = false [badges.maintenance] status = "actively-developed" diff --git a/vendor/tracing-core/README.md b/vendor/tracing-core/README.md index f3afec07e..c6f7b0333 100644 --- a/vendor/tracing-core/README.md +++ b/vendor/tracing-core/README.md @@ -16,9 +16,9 @@ Core primitives for application-level tracing. [Documentation][docs-url] | [Chat][discord-url] [crates-badge]: https://img.shields.io/crates/v/tracing-core.svg -[crates-url]: https://crates.io/crates/tracing-core/0.1.28 +[crates-url]: https://crates.io/crates/tracing-core/0.1.29 [docs-badge]: https://docs.rs/tracing-core/badge.svg -[docs-url]: https://docs.rs/tracing-core/0.1.28 +[docs-url]: https://docs.rs/tracing-core/0.1.29 [docs-master-badge]: https://img.shields.io/badge/docs-master-blue [docs-master-url]: https://tracing-rs.netlify.com/tracing_core [mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg @@ -79,22 +79,22 @@ The following crate feature flags are available: ```toml [dependencies] - tracing-core = { version = "0.1.28", default-features = false } + tracing-core = { version = "0.1.29", default-features = false } ``` **Note**:`tracing-core`'s `no_std` support requires `liballoc`. [`tracing`]: ../tracing -[`span::Id`]: https://docs.rs/tracing-core/0.1.28/tracing_core/span/struct.Id.html -[`Event`]: https://docs.rs/tracing-core/0.1.28/tracing_core/event/struct.Event.html -[`Subscriber`]: https://docs.rs/tracing-core/0.1.28/tracing_core/subscriber/trait.Subscriber.html -[`Metadata`]: https://docs.rs/tracing-core/0.1.28/tracing_core/metadata/struct.Metadata.html -[`Callsite`]: https://docs.rs/tracing-core/0.1.28/tracing_core/callsite/trait.Callsite.html -[`Field`]: https://docs.rs/tracing-core/0.1.28/tracing_core/field/struct.Field.html -[`FieldSet`]: https://docs.rs/tracing-core/0.1.28/tracing_core/field/struct.FieldSet.html -[`Value`]: https://docs.rs/tracing-core/0.1.28/tracing_core/field/trait.Value.html -[`ValueSet`]: https://docs.rs/tracing-core/0.1.28/tracing_core/field/struct.ValueSet.html -[`Dispatch`]: https://docs.rs/tracing-core/0.1.28/tracing_core/dispatcher/struct.Dispatch.html +[`span::Id`]: https://docs.rs/tracing-core/0.1.29/tracing_core/span/struct.Id.html +[`Event`]: https://docs.rs/tracing-core/0.1.29/tracing_core/event/struct.Event.html +[`Subscriber`]: https://docs.rs/tracing-core/0.1.29/tracing_core/subscriber/trait.Subscriber.html +[`Metadata`]: https://docs.rs/tracing-core/0.1.29/tracing_core/metadata/struct.Metadata.html +[`Callsite`]: https://docs.rs/tracing-core/0.1.29/tracing_core/callsite/trait.Callsite.html +[`Field`]: https://docs.rs/tracing-core/0.1.29/tracing_core/field/struct.Field.html +[`FieldSet`]: https://docs.rs/tracing-core/0.1.29/tracing_core/field/struct.FieldSet.html +[`Value`]: https://docs.rs/tracing-core/0.1.29/tracing_core/field/trait.Value.html +[`ValueSet`]: https://docs.rs/tracing-core/0.1.29/tracing_core/field/struct.ValueSet.html +[`Dispatch`]: https://docs.rs/tracing-core/0.1.29/tracing_core/dispatcher/struct.Dispatch.html ## Supported Rust Versions diff --git a/vendor/tracing-core/src/callsite.rs b/vendor/tracing-core/src/callsite.rs index d0fe1a3d6..bc7405ffa 100644 --- a/vendor/tracing-core/src/callsite.rs +++ b/vendor/tracing-core/src/callsite.rs @@ -137,6 +137,15 @@ pub trait Callsite: Sync { /// Returns the [metadata] associated with the callsite. /// + /// <div class="example-wrap" style="display:inline-block"> + /// <pre class="ignore" style="white-space:normal;font:inherit;"> + /// + /// **Note:** Implementations of this method should not produce [`Metadata`] + /// that share the same callsite [`Identifier`] but otherwise differ in any + /// way (e.g., have different `name`s). + /// + /// </pre></div> + /// /// [metadata]: super::metadata::Metadata fn metadata(&self) -> &Metadata<'_>; diff --git a/vendor/tracing-core/src/dispatcher.rs b/vendor/tracing-core/src/dispatcher.rs index 041722c36..a3661817c 100644 --- a/vendor/tracing-core/src/dispatcher.rs +++ b/vendor/tracing-core/src/dispatcher.rs @@ -293,14 +293,21 @@ pub fn has_been_set() -> bool { } /// Returned if setting the global dispatcher fails. -#[derive(Debug)] pub struct SetGlobalDefaultError { _no_construct: (), } +impl fmt::Debug for SetGlobalDefaultError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_tuple("SetGlobalDefaultError") + .field(&Self::MESSAGE) + .finish() + } +} + impl fmt::Display for SetGlobalDefaultError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.pad("a global default trace dispatcher has already been set") + f.pad(Self::MESSAGE) } } @@ -308,6 +315,10 @@ impl fmt::Display for SetGlobalDefaultError { #[cfg_attr(docsrs, doc(cfg(feature = "std")))] impl error::Error for SetGlobalDefaultError {} +impl SetGlobalDefaultError { + const MESSAGE: &'static str = "a global default trace dispatcher has already been set"; +} + /// Executes a closure with a reference to this thread's current [dispatcher]. /// /// Note that calls to `get_default` should not be nested; if this function is diff --git a/vendor/tracing-core/src/field.rs b/vendor/tracing-core/src/field.rs index c9869ce2c..e103c75a9 100644 --- a/vendor/tracing-core/src/field.rs +++ b/vendor/tracing-core/src/field.rs @@ -145,6 +145,16 @@ pub struct Field { pub struct Empty; /// Describes the fields present on a span. +/// +/// ## Equality +/// +/// In well-behaved applications, two `FieldSet`s [initialized] with equal +/// [callsite identifiers] will have identical fields. Consequently, in release +/// builds, [`FieldSet::eq`] *only* checks that its arguments have equal +/// callsites. However, the equality of field names is checked in debug builds. +/// +/// [initialized]: Self::new +/// [callsite identifiers]: callsite::Identifier pub struct FieldSet { /// The names of each field on the described span. names: &'static [&'static str], @@ -911,6 +921,40 @@ impl fmt::Display for FieldSet { } } +impl Eq for FieldSet {} + +impl PartialEq for FieldSet { + fn eq(&self, other: &Self) -> bool { + if core::ptr::eq(&self, &other) { + true + } else if cfg!(not(debug_assertions)) { + // In a well-behaving application, two `FieldSet`s can be assumed to + // be totally equal so long as they share the same callsite. + self.callsite == other.callsite + } else { + // However, when debug-assertions are enabled, do NOT assume that + // the application is well-behaving; check every the field names of + // each `FieldSet` for equality. + + // `FieldSet` is destructured here to ensure a compile-error if the + // fields of `FieldSet` change. + let Self { + names: lhs_names, + callsite: lhs_callsite, + } = self; + + let Self { + names: rhs_names, + callsite: rhs_callsite, + } = &other; + + // Check callsite equality first, as it is probably cheaper to do + // than str equality. + lhs_callsite == rhs_callsite && lhs_names == rhs_names + } + } +} + // ===== impl Iter ===== impl Iterator for Iter { diff --git a/vendor/tracing-core/src/metadata.rs b/vendor/tracing-core/src/metadata.rs index 47b9388a4..a154419a7 100644 --- a/vendor/tracing-core/src/metadata.rs +++ b/vendor/tracing-core/src/metadata.rs @@ -35,28 +35,25 @@ use crate::stdlib::{ /// _significantly_ lower than that of creating the actual span. Therefore, /// filtering is based on metadata, rather than on the constructed span. /// -/// <pre class="ignore" style="white-space:normal;font:inherit;"> -/// <strong>Note</strong>: Although instances of <code>Metadata</code> -/// cannot be compared directly, they provide a method -/// <a href="struct.Metadata.html#method.id"><code>id</code></a>, returning -/// an opaque <a href="../callsite/struct.Identifier.html">callsite -/// identifier</a>which uniquely identifies the callsite where the metadata -/// originated. This can be used to determine if two <code>Metadata</code> -/// correspond to the same callsite. -/// </pre> +/// ## Equality +/// +/// In well-behaved applications, two `Metadata` with equal +/// [callsite identifiers] will be equal in all other ways (i.e., have the same +/// `name`, `target`, etc.). Consequently, in release builds, [`Metadata::eq`] +/// *only* checks that its arguments have equal callsites. However, the equality +/// of `Metadata`'s other fields is checked in debug builds. /// /// [span]: super::span /// [event]: super::event -/// [name]: Metadata::name() -/// [target]: Metadata::target() -/// [fields]: Metadata::fields() -/// [verbosity level]: Metadata::level() -/// [file name]: Metadata::file() -/// [line number]: Metadata::line() -/// [module path]: Metadata::module_path() +/// [name]: Self::name +/// [target]: Self::target +/// [fields]: Self::fields +/// [verbosity level]: Self::level +/// [file name]: Self::file +/// [line number]: Self::line +/// [module path]: Self::module_path /// [`Subscriber`]: super::subscriber::Subscriber -/// [`id`]: Metadata::id -/// [callsite identifier]: super::callsite::Identifier +/// [callsite identifiers]: Self::callsite pub struct Metadata<'a> { /// The name of the span described by this metadata. name: &'static str, @@ -443,6 +440,62 @@ impl fmt::Debug for Kind { } } +impl<'a> Eq for Metadata<'a> {} + +impl<'a> PartialEq for Metadata<'a> { + #[inline] + fn eq(&self, other: &Self) -> bool { + if core::ptr::eq(&self, &other) { + true + } else if cfg!(not(debug_assertions)) { + // In a well-behaving application, two `Metadata` can be assumed to + // be totally equal so long as they share the same callsite. + self.callsite() == other.callsite() + } else { + // However, when debug-assertions are enabled, do not assume that + // the application is well-behaving; check every field of `Metadata` + // for equality. + + // `Metadata` is destructured here to ensure a compile-error if the + // fields of `Metadata` change. + let Metadata { + name: lhs_name, + target: lhs_target, + level: lhs_level, + module_path: lhs_module_path, + file: lhs_file, + line: lhs_line, + fields: lhs_fields, + kind: lhs_kind, + } = self; + + let Metadata { + name: rhs_name, + target: rhs_target, + level: rhs_level, + module_path: rhs_module_path, + file: rhs_file, + line: rhs_line, + fields: rhs_fields, + kind: rhs_kind, + } = &other; + + // The initial comparison of callsites is purely an optimization; + // it can be removed without affecting the overall semantics of the + // expression. + self.callsite() == other.callsite() + && lhs_name == rhs_name + && lhs_target == rhs_target + && lhs_level == rhs_level + && lhs_module_path == rhs_module_path + && lhs_file == rhs_file + && lhs_line == rhs_line + && lhs_fields == rhs_fields + && lhs_kind == rhs_kind + } + } +} + // ===== impl Level ===== impl Level { |