-
Notifications
You must be signed in to change notification settings - Fork 723
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
tracing 0.1.38 included accidentally-breaking change from added Drop impl #2578
Comments
Oh, that's really unfortunate. Thanks for the report. I'm willing to consider yanking I don't believe |
I went ahead and yanked v0.1.38 until we figure out a long-term fix. |
Yeah, I think it's just As for unsafe impl<#[may_dangle(droppable)] T> PinnedDrop for Instrumented<T> { This may also end up requiring support from The Which is all to say, I think our options are:
What's kind of annoying about option 2 is that you really do want the You have a better idea than I do about how valuable the change in #2562 is, and whether it's okay to delay or not. |
@NobodyXu I'm not sure what fix you're referring to, but nothing was committed to this repo since this issue was reported, nor can I see any linked issue that might be a fix for this. |
Sorry I mistook some other linked PRs as fix. Really sorry about that, I was probably too sleepy. |
One potentially useful data point: a (small) test internally at |
This reverts commit b914250. tracing 0.1.38 was yanked due to an unintended backwards-incompatible change in a patch version bump: tokio-rs/tracing#2578 (comment)
This reverts commit b914250. tracing 0.1.38 was yanked due to an unintended backwards-incompatible change in a patch version bump: tokio-rs/tracing#2578 (comment)
This reverts commit b914250. tracing 0.1.38 was yanked due to an unintended backwards-incompatible change in a patch version: tokio-rs/tracing#2578 (comment)
The current release of the tracing crate was yanked for an unintended API change. tokio-rs/tracing#2578 Revert to the next-latest release to address the audit warning.
This reverts commit b914250. tracing 0.1.38 was yanked due to an unintended backwards-incompatible change in a patch version: tokio-rs/tracing#2578 (comment)
Version `0.1.38` was yanked: tokio-rs/tracing#2578
👋 cargo-semver-checks maintainer here — is there a way this could have been caught by looking at rustdoc? I understand that the " I've added this example to the |
I think the way to detect it is if a Drop impl is ever added to a generic type. That's all it takes if I'm not mistaken (which it could totally be that I am). In practice it often won't break people because non static things don't end up in the generics, but if they ever do then you hit this. Unless the unstable |
Could the generic type already have a bound that is equivalent or stronger than the bound that For example, would adding a Trying to figure out the exact delineation to avoid false-positives in cargo-semver-checks. |
IMHO it is a breaking change, with |
Sorry, I didn't state that clearly enough. If And are any other bounds like this that would also have made adding |
I don't think this it is even valid. |
Here's exactly what I mean. The Before: pub struct Foo<T> where T: 'static {
...
} After: pub struct Foo<T> where T: 'static {
...
}
impl<T: 'static> Drop for Foo<T> {
...
} Can the |
It's a good question. I think |
Thanks for the help! Is a bound like I'd love to add an automated check for this in cargo-semver-checks but I'm worried about getting the edge cases wrong and giving people bad advice, either false-negative or false-positive. |
@jonhoo I wonder if we can workaround this by wrapping the future itself:
It could avoid the drop implementation altogether, since rust drops variable in the reverse of declaration order. |
Sorry, I don't have the time to dig into this currently, but I hope the documentation added by rust-lang/rust#103413 helps. AFAIK currently making a type
There is no point in adding a bound to the Of course the other question is whether adding a |
Sorry for the confusion! As the maintainer of Thanks for all the help, everyone! |
After 0.1.38 was yanked, no 0.1.39 was published with the revert/fix, meaning people who updated quickly currently use 0.1.38 and will never receive a dependabot notif for a new version nor for the yanking |
Tracing was yanked, which left things in an interesting state that renovate didn't seem to know how to handle. I also regenerated the lockfile, which pulled in a bunch of updates. This also fixed the CI issues from proc-macro2 / ts-rs and the beta clippy. Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com> [1]: tokio-rs/tracing#2578
Bug Report
Version
Builds fine:
Is broken:
Platform
Crates
tracing
andtracing-attributes
(I believe aDrop
impl was added in the latter as well)Description
The change in #2562 that was intended to fix #2541 is a breaking change (and indeed broke my code). In particular, we now have
https://github.com/ilslv/tracing/blob/73e73a9d7677a848c614c976ac176d56c889bb9b/tracing/src/instrument.rs#L307
whereas we didn't before. If you have
impl Drop
for type with a generic type parameterT
, Rust assumes that the typeT
may be used in theDrop
implementation, and therefore requires thatT
outlives the wrapper type. This wasn't previously the case — without theDrop
, theT
only had to live as long as the last use of the wrapper, but crucially not all the way until it is dropped. You can see this with code like:which will build fine with
tracing 0.1.37
, but no longer builds withtracing 0.1.38
(which has this change):This likely warrants a yank if enough people run into it. It could just be me, though this was in fairly innocuous code. Tracing it back to this change also wasn't trivial, so some folks may run into this but not realize how the issue arose for them in the first place.
The change will either need to be rolled back, or we'll need to include a
#[may_dangle]
annotation on the addedimpl Drop
.The text was updated successfully, but these errors were encountered: