mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Further revert Deref for Cow to its 1.90.0 state
ref: https://github.com/rust-lang/rust/issues/147964#issuecomment-3446420995
This commit is contained in:
@@ -333,7 +333,8 @@ pub fn into_owned(self) -> <B as ToOwned>::Owned {
|
||||
// #[rustc_const_unstable(feature = "const_convert", issue = "143773")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<B: ?Sized + ToOwned> Deref for Cow<'_, B>
|
||||
// where
|
||||
where
|
||||
B::Owned: Borrow<B>,
|
||||
// B::Owned: [const] Borrow<B>,
|
||||
{
|
||||
type Target = B;
|
||||
|
||||
@@ -5,9 +5,12 @@
|
||||
|
||||
use std::borrow::{Cow, Borrow};
|
||||
|
||||
pub fn generic_deref<'a, T: ToOwned<Owned = U>, U>(cow: Cow<'a, T>) {
|
||||
let _: &T = &cow;
|
||||
}
|
||||
// This won't work even with the non-const bound on `Deref` like 1.90.0, although note
|
||||
// as well that no such bound existed until 1.57 started `~const` experiments.
|
||||
//
|
||||
// pub fn generic_deref<'a, T: ToOwned<Owned = U>, U>(cow: Cow<'a, T>) {
|
||||
// let _: &T = &cow;
|
||||
// }
|
||||
|
||||
pub fn generic_borrow<'a, T: ToOwned<Owned = U>, U>(cow: Cow<'a, T>) {
|
||||
let _: &T = cow.borrow();
|
||||
|
||||
Reference in New Issue
Block a user