Skip to content

Remove T: Send + Sync bound from Arc::downcast - #161531

Open
maxdexh wants to merge 1 commit into
rust-lang:mainfrom
maxdexh:arc-downcast-no-sync-send
Open

maxdexh wants to merge 1 commit into
rust-lang:mainfrom
maxdexh:arc-downcast-no-sync-send

Conversation

@maxdexh

@maxdexh maxdexh commented Aug 22, 2026 •

Copy link
Copy Markdown
Member

Discussion on zulip

Implements the change described in rust-lang/libs-team#859.
T-libs can pick if they want to skip the ACP or not.

@rustbot label needs-fcp T-libs

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 22, 2026
@rustbot

rustbot commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 12 candidates
  • Random selection from JohnTitor, Mark-Simulacrum, clarfonthey, nia-e

@rustbot rustbot added the needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. label Aug 22, 2026
@Mark-Simulacrum

Copy link
Copy Markdown
Member
 impl<A: Allocator> Arc<dyn Any + Send + Sync, A> {
 // stable diff
-    fn downcast<T: Any + Send + Sync>(self) -> Result<Arc<T, A>, Arc<dyn Any + Send + Sync, A>>;
+    fn downcast<T: Any>(self) -> Result<Arc<T, A>, Arc<dyn Any + Send + Sync, A>>;
 // unstable diff
-    fn downcast_unchecked<T: Any + Send + Sync>(self) -> Arc<T, A>;
+    fn downcast_unchecked<T: Any>(self) -> Arc<T, A>;
 }

@rfcbot fcp merge libs

I think this bound is probably further relaxable to T: 'static + ?Sized, but if we do that it can be follow-up across all of the downcast APIs on Box/Arc/Rc.

@rust-rfcbot

rust-rfcbot commented Aug 22, 2026 •

Copy link
Copy Markdown
Collaborator

@Mark-Simulacrum has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

cc @rust-lang/libs-ping: FCP proposed for libs, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. and removed needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. labels Aug 22, 2026
@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 22, 2026
@maxdexh

maxdexh commented Aug 22, 2026 •

Copy link
Copy Markdown
Member Author

I think this bound is probably further relaxable to T: 'static + ?Sized, but if we do that it can be follow-up across all of the downcast APIs on Box/Arc/Rc.

Do you mean by returning Err for all unsized types? Ah I see, you'd also relax the bound on is. Yeah that should work

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. 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.

4 participants