Skip to content

Conversation

@GrigorenkoPV
Copy link
Contributor

@GrigorenkoPV GrigorenkoPV commented Nov 2, 2025

Tracking issue: #148227

Going with the TransmuteFrom approach suggested in rust-lang/libs-team#674 (comment), but a bit simplified.

Currently does not work in some places where it should due to the limitations of the current implementation of the transmutability analysis: #148227 (comment)

@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 Nov 2, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 2, 2025

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

@rust-log-analyzer

This comment has been minimized.

///
/// ```
/// #![feature(vec_recycle)]
/// #![feature(transmutability)]
Copy link
Member

Choose a reason for hiding this comment

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

Is the explicit transmutability feature flag needed for this example?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the feature flag seems to propagate from the bound on the impl

Copy link
Member

Choose a reason for hiding this comment

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

Hm, I wonder how Try avoids that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The initial TransmuteFrom trait is marked with unstable_feature_bound, while Try is not

Copy link
Member

Choose a reason for hiding this comment

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

Oh, interesting! I didn't add that, and I'm curious why it was added (it's usually used to create unstable impls of stable traits). Hey @tiif, can you chime in as to why you added #[unstable_feature_bound(transmutability)] to TransmuteFrom here?

For context: We're using TransmuteFrom as a private implementation detail of Vec::recycle, but requiring users of recycle to have #![feature(transmutability)] even when they don't mention TransmuteFrom leaks that implementation detail.

Copy link
Member

Choose a reason for hiding this comment

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

There is a #[unstable_feature_bound(transmutability)] for impl ConstParamTy_ for Assume {}. Since TransmuteFrom uses const ASSUME: Assume = { Assume::NOTHING } here, it needs to add #[unstable_feature_bound(transmutability)] too.

Unfortunately we haven't made it possible to stop propagating #[unstable_feature_bound] this way for now :(

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 3, 2025
@bors
Copy link
Collaborator

bors commented Nov 10, 2025

☔ The latest upstream changes (presumably #135634) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot

This comment has been minimized.

@GrigorenkoPV
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 11, 2025
@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Nov 11, 2025

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

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

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants