rust-lang/rust

Tracking issue for `IntoCow` stabilization

aturon opened this issue · 6 comments

NOTE: IntoCow has been deprecated, but you can get the same conversion by using the Cow::Owned constructor, like so: Cow::Owned(vec![1, 2, 3]).

The IntoCow trait is a custom conversion trait for working with Cow; the custom nature is needed to deal with trait coherence issues.

Ultimately, the hope was that this trait could support ergonomic "ownership polymorphism" for things like the entry API. That's not the case today due to coherence limitations, but may become possible with impl specialization or other changes to the trait system.

The API needs a full re-evaluation before stabilization.

Seems like we can potentially deprecate this due to a lack of interest?

This is being used in HashMap2 to provide an ergonomic CoW entry, but I think there's some silly issues that result.

@apasel422 do you recall the details?

Does Into<Cow<_>> not work for HashMap2?

🔔 This issue is now entering its final comment period for deprecation 🔔

The libs team discussed this in triage recently and the decision was to deprecate