Change:
/// Consumes the `Weak<T>` and turns it into a raw pointer. /// <del> /// This converts the weak pointer into a raw pointer, preserving the original weak count. It /// can be turned back into the `Weak<T>` with [`from_raw`]. </del> <ins> /// This converts the weak pointer into a raw pointer, while still preserving the ownership of /// one weak reference (the weak count is not modified by this operation). It can be turned /// back into the `Weak<T>` with [`from_raw`]. </ins> /// /// The same restrictions of accessing the target of the pointer as with /// [`as_ptr`] apply.

Discussion:
... as documented. The problem: this line from the documentation: The weak count as reported by is 0 when the strong count is 0, even if there are still outstanding weak references: The combination of these two means that getting a pointer from is not enough to guarantee that it's safe to use in . Instead, you have to know that (if it originated from a strong reference) you still have an outstanding strong reference to the allocation, because otherwise the (exposed) weak count is 0, and thus calling is "documented UB". To properly document when this is intuitively allowed (i.e. it's allowed because I got the pointer from and have called more than , so there are still "unowned" raw weak references to claim) (which lines up with what the implementation allows), we need to expose (probably docs only) the fact that there is still being a weak reference count behind the hood being tracked until all of the s have been dropped. This will probably also require guaranteeing that doesn't drop its weak reference and become dangling "early" (e.g. note that failed, decrement the (real) weak count (potentially deallocating the place), and become a dangling weak via internal mutability) and that on a "zombie" increments the (real) weak count and creates a new "zombie" , not a dangling .
(I don't know if C-bug is the correct label for a "documentation bug," but it was the closest template to correct.)
I guess that means the internal weak count rather than the user-visible .
That's obviously the intent and what the implementation shows is the case, but when considering documented properties of an API, you have to only consider the documented API. A correct resolution to the issue would be to adjust the documentation to clarify that the weak count is referring to the hidden internal weak count that's not exposed (except conceptually for the safety of /). cc who wrote these methods and docs
Yes, it's meant as the actual number of weak pointers pointing there (including the ones „frozen“ to raw pointers), not what some method returns (if it's currently in the form of the raw pointer, you really can't even call the method, so I'm not sure if that part can even apply). I agree it could probably be documented better.

I'd try to fix the docs, but considering I've already updated them like 3 times during the review and they still haven't ended up entirely correct, I'll probably ask if you want to give it a go first, as obviously the docs aren't my strong ability :-).
The main thing this requires is actually specifying how the "internal" weak count works, and guarnateeing that we don't do "clever" things with converting "zombie "s into dangling s. I really don't know the best way to do this or even where to do this, since it basically only impacts how and when is allowed to be called.
:thinking: Maybe just getting rid of the „weak count“ term altogether and try to describe it in a way that the pointer preserves the ownership of the , or that it's an alternative form of and it can be turned back if it still has the ownership. Or maybe just point out that the „weak count“ is meant in its natural meaning, not referring to the method.
Ok, looking into this, how about wording like this? On the intoraw: And on the : Do you think this would be better?
Yeah, I think that wording captures the semantics properly.
Thanks. I'll get around to submitting the changes some time soonish.