-
Couldn't load subscription status.
- Fork 13.9k
[stable] Further revert Deref for Cow to its 1.90.0 state
#148216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm assuming this is the only difference from a proper revert 👍 libs signed off on wanting the revert to be to 1.90 instead of the really old version. don't know if you also want them to actually review the diff itself or you're fine with my approval. up to you
|
For reference: $ git diff 1.90.0 library/alloc/src/borrow.rs
diff --git a/library/alloc/src/borrow.rs b/library/alloc/src/borrow.rs
index 07f51b7614ff..d982e46e08af 100644
--- a/library/alloc/src/borrow.rs
+++ b/library/alloc/src/borrow.rs
@@ -16,10 +16,13 @@
#[cfg(not(no_global_oom_handling))]
use crate::string::String;
+// FIXME(inference): const bounds removed due to inference regressions found by crater;
+// see https://github.com/rust-lang/rust/issues/147964
+// #[rustc_const_unstable(feature = "const_convert", issue = "143773")]
#[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, B: ?Sized> Borrow<B> for Cow<'a, B>
-where
- B: ToOwned,
+impl<'a, B: ?Sized + ToOwned> Borrow<B> for Cow<'a, B>
+// where
+// B::Owned: [const] Borrow<B>,
{
fn borrow(&self) -> &B {
&**self
@@ -325,10 +328,14 @@ pub fn into_owned(self) -> <B as ToOwned>::Owned {
}
}
+// FIXME(inference): const bounds removed due to inference regressions found by crater;
+// see https://github.com/rust-lang/rust/issues/147964
+// #[rustc_const_unstable(feature = "const_convert", issue = "143773")]
#[stable(feature = "rust1", since = "1.0.0")]
impl<B: ?Sized + ToOwned> Deref for Cow<'_, B>
where
B::Owned: Borrow<B>,
+// B::Owned: [const] Borrow<B>,
{
type Target = B;
@@ -438,8 +445,14 @@ fn hash<H: Hasher>(&self, state: &mut H) {
}
}
+// FIXME(inference): const bounds removed due to inference regressions found by crater;
+// see https://github.com/rust-lang/rust/issues/147964
+// #[rustc_const_unstable(feature = "const_convert", issue = "143773")]
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T: ?Sized + ToOwned> AsRef<T> for Cow<'_, T> {
+impl<T: ?Sized + ToOwned> AsRef<T> for Cow<'_, T>
+// where
+// T::Owned: [const] Borrow<T>,
+{
fn as_ref(&self) -> &T {
self
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@bors r=BoxyUwU,jackh726 rollup=never p=1000 |
|
☀️ Test successful - checks-actions |
It's not clear whether it breaks anything to not have this bound,
but the conservative choice is to match the state as of 1.90.0.
See also:
#147964 (comment)
https://rust-lang.zulipchat.com/#narrow/channel/144729-t-types/topic/Can.20this.20change.20break.20code.20in.201.2E91.3F/with/547528362