Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type annotations in ansi fmt #438

Merged
merged 1 commit into from
Dec 6, 2019

Conversation

pimeys
Copy link
Contributor

@pimeys pimeys commented Nov 19, 2019

Motivation

Latest master cannot infer types in the fmt function.

Solution

Tell the compiler the result type. Funnily I couldn't reproduce this directly from tracing repo, but when I have tracing as a dependency following it from github, the later versions would not pass cargo check

We used to be on this version 16fee661ac1f5dd175491e611ff4c08b33c070fa, and cargo update would break the project.

Copy link
Member

@davidbarsky davidbarsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a weird one. Sorry about the trouble, but thanks for the fix!

@davidbarsky
Copy link
Member

Before I merge, can this be reproduced from https://crates.io/crates/tracing-subscriber/0.2.0-alpha.1?

@pimeys
Copy link
Contributor Author

pimeys commented Nov 19, 2019

diff --git a/query-engine/prisma/Cargo.toml b/query-engine/prisma/Cargo.toml
index 0d84b535..70d43776 100644
--- a/query-engine/prisma/Cargo.toml
+++ b/query-engine/prisma/Cargo.toml
@@ -37,7 +37,7 @@ clap = "2.33"

 tracing = "0.1"
 tracing-log = "0.1"
-tracing-subscriber = { git = "https://github.com/pimeys/tracing", branch = "fix-type-annotations", features = ["json"] }
+tracing-subscriber = { version = "0.2.0-alpha.1", branch = "fix-type-annotations", features = ["json"] }
 tracing-attributes = "0.1"
 log = "0.4"
   Compiling prisma v0.1.0 (/home/pimeys/code/prisma-engine/query-engine/prisma)
   Compiling tracing-subscriber v0.2.0-alpha.1
   Compiling query-core v0.1.0 (/home/pimeys/code/prisma-engine/query-engine/core)
error[E0282]: type annotations needed
   --> /home/pimeys/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/tracing-subscriber-0.2.0-alpha.1/src/fmt/format/mod.rs:513:9
    |
513 | /         self.ctx.visit_spans(|span| {
514 | |             if seen {
515 | |                 f.pad(":")?;
516 | |             }
...   |
526 | |             Ok(())
527 | |         })?;
    | |___________^ cannot infer type

error: aborting due to previous error

@pimeys
Copy link
Contributor Author

pimeys commented Nov 19, 2019

Yeah super weird... Although sometimes you get weird errors with a super generic codebase, although this is new to me too...

@hawkw hawkw merged commit 43685e1 into tokio-rs:master Dec 6, 2019
hawkw added a commit that referenced this pull request Dec 8, 2019
Added:

- `LookupSpans` implementation for `Layered` (#448)
- `SpanRef::from_root` to iterate over a span's parents from the root
  (#460)
- `Context::scope`, to iterate over the current context from the root
  (#460)
- `Context::lookup_current`, which returns a `SpanRef` to the current
  span's data (#460)

Changed:

- Lifetimes on some new `Context` methods to be less restrictive (#460)

Fixed:

- `Layer::downcast_ref` returning invalid references (#454)
- Compilation failure on 32-bit platforms (#462)
- Compilation failure with ANSI formatters (#438)

Signed-off-by: Eliza Weisman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants