Closed
Description
Given the following code: [playground]
#![feature(min_specialization)]
use std::borrow::Borrow;
pub trait IntoOwnedBorrow<Borrowed>: Borrow<Borrowed>
where
Borrowed: ?Sized + ToOwned,
{
fn into_owned(this: Self) -> Borrowed::Owned;
}
impl<T> IntoOwnedBorrow<T> for T
where
T: ToOwned<Owned = T>,
{
fn into_owned(this: Self) -> T {
this
}
}
impl<T> IntoOwnedBorrow<T> for T::Owned
where
T: ?Sized + ToOwned,
{
default fn into_owned(this: Self) -> T::Owned {
this
}
}
The current output is:
error: cannot specialize on `Binder(ProjectionPredicate(ProjectionTy { substs: [T], item_def_id: DefId(5:776 ~ alloc[55b1]::borrow::ToOwned::Owned) }, Ty(T)), [])`
--> src/lib.rs:12:1
|
12 | / impl<T> IntoOwnedBorrow<T> for T
13 | | where
14 | | T: ToOwned<Owned = T>,
15 | | {
... |
18 | | }
19 | | }
| |_^
Ideally the output should not reference the debug format of an internal type 🙂
@rustbot modify labels +F-specialization +A-specialization +requires-nightly