Skip to content

Conversation

Jules-Bertholet
Copy link
Contributor

@Jules-Bertholet Jules-Bertholet commented Aug 29, 2025

  • From<T: Copy> for ManuallyDrop<T>
  • From<T: UnwindSafe> for AssertUnwindSafe<T>
  • From<T> for LazyCell<T, F>
  • From<T> for LazyLock<T, F>
  • From<T> for ThinBox<T> (unstable)
  • From<T> for UniqueRc<T> (unstable)
  • From<T> for UniqueArc<T> (unstable)

@rustbot label T-libs-api needs-fcp

Also needs a crater run, as the insta-stable impls are technically breaking changes.

- `From<T> for ThinBox<T>`
- `From<T> for UniqueRc<T>`
- `From<T> for UniqueArc<T>`
- `From<T> for ManuallyDrop<T>`
- `From<T> for AssertUnwindSafe<T>`
@rustbot
Copy link
Collaborator

rustbot commented Aug 29, 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

@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. needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Aug 29, 2025
@Kivooeo
Copy link
Member

Kivooeo commented Aug 29, 2025

@rustbot label +needs-crater

@rustbot
Copy link
Collaborator

rustbot commented Aug 29, 2025

Error: Label needs-crater can only be set by Rust team members

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip.

@rust-log-analyzer

This comment has been minimized.

@tgross35
Copy link
Contributor

@bors try

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Aug 30, 2025
@tgross35 tgross35 added I-libs-api-nominated Nominated for discussion during a libs-api team meeting. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 30, 2025
@rust-bors
Copy link

rust-bors bot commented Aug 30, 2025

☀️ Try build successful (CI)
Build commit: 804fff1 (804fff1ae95da9d03bd44eee27f258020a575dab, parent: fe55364329579d361b1ab565728bc033a7dba07e)

@tgross35
Copy link
Contributor

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-146013 created and queued.
🤖 Automatically detected try build 804fff1
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 30, 2025
@craterbot
Copy link
Collaborator

🚧 Experiment pr-146013 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🎉 Experiment pr-146013 is completed!
📊 1312 regressed and 1466 fixed (691117 total)
📊 2007 spurious results on the retry-regessed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Footnotes

  1. re-run the experiment with crates=https://crater-reports.s3.amazonaws.com/pr-146013/retry-regressed-list.txt

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Sep 7, 2025
@Jules-Bertholet
Copy link
Contributor Author

Jules-Bertholet commented Sep 7, 2025

I haven't been able to review all the regressions yet. But from the few I spot-checked: most are spurious (filesystem errors), but a few are not. All the real regressions I saw were due to the ManuallyDrop impl. And, upon reflection, that one as well as the AssertUnwindSafe impl seem dubious, so I removed the former and restricted the latter.

@Mark-Simulacrum

This comment was marked as resolved.

@craterbot

This comment was marked as resolved.

@Mark-Simulacrum

This comment was marked as resolved.

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Sep 7, 2025
@rust-bors
Copy link

rust-bors bot commented Sep 7, 2025

☀️ Try build successful (CI)
Build commit: 69cf481 (69cf48176da7795067be67cef76e41a8aac9b134, parent: 23718020b12d7e5a54f82a19910e8356ee719667)

@Jules-Bertholet
Copy link
Contributor Author

Alright… now we can retry crater

@tgross35
Copy link
Contributor

tgross35 commented Sep 9, 2025

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-146013-1 created and queued.
🤖 Automatically detected try build 69cf481
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 9, 2025
@tgross35
Copy link
Contributor

tgross35 commented Sep 9, 2025

We probably only need to regressions from the first run, but I'm not sure if it's the same retry-regressed list as above. @Mark-Simulacrum if you get the chance could you update the job?

@Urgau

This comment was marked as off-topic.

@craterbot

This comment was marked as off-topic.

@Urgau
Copy link
Member

Urgau commented Sep 11, 2025

@craterbot name=pr-146013-1 mode=check-only crates=https://crater-reports.s3.amazonaws.com/pr-146013/retry-regressed-list.txt

@craterbot
Copy link
Collaborator

📝 Configuration of the pr-146013-1 experiment changed.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@Urgau

This comment was marked as off-topic.

@craterbot

This comment was marked as off-topic.

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Sep 11, 2025
@Urgau Urgau added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 11, 2025
@craterbot
Copy link
Collaborator

🚧 Experiment pr-146013-1 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🎉 Experiment pr-146013-1 is completed!
📊 0 regressed and 0 fixed (2679 total)
📊 169 spurious results on the retry-regessed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Footnotes

  1. re-run the experiment with crates=https://crater-reports.s3.amazonaws.com/pr-146013-1/retry-regressed-list.txt

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Sep 12, 2025
@Jules-Bertholet
Copy link
Contributor Author

No regressions 🎉

@the8472
Copy link
Member

the8472 commented Sep 16, 2025

There's has been no issue discussing this, no ACP. Can you add some motivation why these are needed, why those trait bounds are on there and so on?

@Jules-Bertholet
Copy link
Contributor Author

Jules-Bertholet commented Sep 16, 2025

These are for consistency with the existing From<T> impls for Box<T>, Rc<T>, Arc<T>, Option<T>, Poll<T>, Cell<T>, UnsafeCell<T>, SyncUnsafeCell<T>, OnceCell<T>, RefCell<T>, UnsafePinned<T>, Exclusive<T>, Mutex<T>, OnceLock<T>, ReentrantLock<T>, and RwLock<T>. Also, they are useful for convenience: value.into() is shorter than WrapperType::new(value).

The Copy bound on the ManuallyDrop impl is to ensure users can’t accidentally leak data with an into(), and to ensure the conversion is “value-preserving” as From’s docs require (Copy implies a trivial destructor). The UnwindSafe bound on the AssertUnwindSafe impl has an analogous motivation.

@tgross35
Copy link
Contributor

The Copy bound on the ManuallyDrop impl is to ensure users can’t accidentally leak data with an into(), and to ensure the conversion is “value-preserving” as From’s docs require (Copy implies a trivial destructor). The UnwindSafe bound on the AssertUnwindSafe impl has an analogous motivation.

This makes things a bit unconvincing for the ManuallyDrop impl imo. How often is ManuallyDrop going to come into play for types that are known to be Copy? Subtly constructing a ManuallyDrop via .into() doesn't seem like it would be the best coding practice anyway, Copy or not.

In any case, the bounds here would be good to cover in a doc comment to remove the guesswork.

@Jules-Bertholet
Copy link
Contributor Author

Jules-Bertholet commented Sep 17, 2025

How often is ManuallyDrop going to come into play for types that are known to be Copy?

Probably not very. But it could come up when constructing a type like Foo below, with a T that happens to be Copy:

union Foo<T> {
    // `ManuallyDrop` needed because it’s a union and `T` has no `Copy` bound
    field: ManuallyDrop<T>,

    // ...
}

Subtly constructing a ManuallyDrop via .into() doesn't seem like it would be the best coding practice anyway, Copy or not.

I don’t see it as any worse than all the other wrapper type From impls I listed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-libs-api-nominated Nominated for discussion during a libs-api team meeting. needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants