Skip to content

Commit 72c9876

Browse files
committed
Revert inference failure from Deref/Borrow constification
1 parent 1d23d06 commit 72c9876

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

library/alloc/src/borrow.rs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ use crate::fmt;
1616
#[cfg(not(no_global_oom_handling))]
1717
use crate::string::String;
1818

19+
// FIXME(inference): const bounds removed due to inference regressions found by crater;
20+
// see https://github.com/rust-lang/rust/issues/147964
21+
// #[rustc_const_unstable(feature = "const_convert", issue = "143773")]
1922
#[stable(feature = "rust1", since = "1.0.0")]
20-
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
21-
impl<'a, B: ?Sized> const Borrow<B> for Cow<'a, B>
22-
where
23-
B: ToOwned,
24-
B::Owned: [const] Borrow<B>,
23+
impl<'a, B: ?Sized + ToOwned> Borrow<B> for Cow<'a, B>
24+
// where
25+
// B::Owned: [const] Borrow<B>,
2526
{
2627
fn borrow(&self) -> &B {
2728
&**self
@@ -327,11 +328,13 @@ impl<B: ?Sized + ToOwned> Cow<'_, B> {
327328
}
328329
}
329330

331+
// FIXME(inference): const bounds removed due to inference regressions found by crater;
332+
// see https://github.com/rust-lang/rust/issues/147964
333+
// #[rustc_const_unstable(feature = "const_convert", issue = "143773")]
330334
#[stable(feature = "rust1", since = "1.0.0")]
331-
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
332-
impl<B: ?Sized + ToOwned> const Deref for Cow<'_, B>
333-
where
334-
B::Owned: [const] Borrow<B>,
335+
impl<B: ?Sized + ToOwned> Deref for Cow<'_, B>
336+
// where
337+
// B::Owned: [const] Borrow<B>,
335338
{
336339
type Target = B;
337340

@@ -441,11 +444,13 @@ where
441444
}
442445
}
443446

447+
// FIXME(inference): const bounds removed due to inference regressions found by crater;
448+
// see https://github.com/rust-lang/rust/issues/147964
449+
// #[rustc_const_unstable(feature = "const_convert", issue = "143773")]
444450
#[stable(feature = "rust1", since = "1.0.0")]
445-
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
446-
impl<T: ?Sized + ToOwned> const AsRef<T> for Cow<'_, T>
447-
where
448-
T::Owned: [const] Borrow<T>,
451+
impl<T: ?Sized + ToOwned> AsRef<T> for Cow<'_, T>
452+
// where
453+
// T::Owned: [const] Borrow<T>,
449454
{
450455
fn as_ref(&self) -> &T {
451456
self

0 commit comments

Comments
 (0)