-
Notifications
You must be signed in to change notification settings - Fork 721
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
attributes: prepare to release 0.1.9 #773
Conversation
It occurs to me that the second change in the changelog, emitting errors for unrecognized input to @carllerche do you have any thoughts on how this interacts with tokio's versioning policies? |
In an ideal world, we would emit warnings rather than errors, and this would definitely not be breaking...but unfortunately, there isn't currently a good way for proc macros to emit warnings. |
I think its fine tbh, curious what @davidbarsky thinks too? |
How many people do you think are using tracing in such a way that it would affect them rather than help them? (even if its breaking their code) |
Hmm. I mean, it's helping everyone, because they may be unaware that their code is actually not doing anything. But, if the incorrect code exists in the wild, it might e.g. break CI builds that were previously passing. |
this is a pretty critical reason to increment the semver imo. I'm thinking about cases where I've had semver bit me. Most recently on a big project I hadn't touched in a year where it stopped compiling because amethyst or one of its deps fked up semver. I couldn't easily fix the issue other than figuring out the correct exact version or upgrading to the next version of amethyst which was more than I was willing to do so I just gave up trying to play with it and wrote off the codebase as dead. I can see this same issue cropping up if someone has a dependency that stops compiling because of this change, where its not an easy change to their own code to fix. On the other side, if we do a major semver bump could any of this cause compilation failures if two different versions of this crate are linked in? I recently did a small breaking change bugfix to eyre and almost immediately got a bug report because someone had a crate that exposed It seems like the former concern is the only one likely to be an issue for tracing-attributes, so I lean towards calling this a breaking change. |
This is especially concerning because |
If this does end up requiring a semver bump change, we should make sure to also change the behavior with empty fields in
|
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
## Motivation In PR #672, the `#[instrument]` attribute was rewritten to use a custom `syn` parser rather than using `syn::AttributeArgs`. This was primarily to allow the use of arbitrary expressions as fields, but it had the side benefit of also allowing more sophisticated error reporting. In particular, we were able to replace the previous behavior of silently ignoring unknown input with a compiler error, which has been requested a few times (see #772 and #727). However, emitting a compiler error for inputs that we previously allowed (even if they did nothing) is technically a breaking change --- see #773 (comment) and following comments. This means that the other new features added in #672 cannot be released until we release `tracing-subscriber` 0.2. ## Solution This branch avoids the breaking change by downgrading these errors to warnings. However, it isn't currently possible to emit a warning from a proc-macro on stable --- the `proc_macro::Diagnostic` API which would allow this requires a nightly feature. This branch hacks around this by generating a fake deprecated item with for each unrecognized token in the input, emitting the skipped item's parse error as the deprecation's `note`, and "using" the deprecated item. The deprecated warning is used here rather than other code that will emit compiler warnings, because it gives us a way to customize the warning output (via the `note` field). I've tried to make it fairly obvious that this is not a "real" deprecation. Sample output looks like this: ![Screenshot_20200707_153151](https://user-images.githubusercontent.com/2796466/86850948-fce0a780-c066-11ea-9b1c-5085c0fd43e0.png) Fixes #727 Fixes #772 Signed-off-by: Eliza Weisman <eliza@elizas.website>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
61224c9
to
0d3d43b
Compare
Okay, I've rebased to pick up #786 and updated the changelog. Now, we should emit warnings rather than errors for unrecognized input, meaning that this is no longer a potentially breaking change. |
0.1.9 (July 8, 2020)
Added
#[instrument]
(attributes: support arbitrary field expressions #672)Changed
#[instrument]
now emits a compiler warning when ignoringunrecognized input (attributes: support arbitrary field expressions #672, attributes: downgrade unrecognized input errors to warnings #786)
Fixes #785