Skip to content

Conversation

@cuviper
Copy link
Member

@cuviper cuviper commented Oct 28, 2025

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 28, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 28, 2025

r? @BoxyUwU

rustbot has assigned @BoxyUwU.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Copy link
Member

@BoxyUwU BoxyUwU left a 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

View changes since this review

@cuviper
Copy link
Member Author

cuviper commented Oct 28, 2025

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
     }

Copy link
Member

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cuviper
Copy link
Member Author

cuviper commented Oct 28, 2025

@bors r=BoxyUwU,jackh726 rollup=never p=1000

@bors
Copy link
Collaborator

bors commented Oct 28, 2025

📌 Commit faf3e0b has been approved by BoxyUwU,jackh726

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 28, 2025
@bors
Copy link
Collaborator

bors commented Oct 28, 2025

⌛ Testing commit faf3e0b with merge f8297e3...

@bors
Copy link
Collaborator

bors commented Oct 28, 2025

☀️ Test successful - checks-actions
Approved by: BoxyUwU,jackh726
Pushing f8297e3 to stable...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 28, 2025
@bors bors merged commit f8297e3 into rust-lang:stable Oct 28, 2025
11 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants