Skip to content

Conversation

Darksonn
Copy link
Contributor

This was suggested by @tmandry.

diff library/core/src/marker.rs library/core/src/ops/unsize.rs
@@ -10,7 +10,7 @@
 /// By using the macro, the following example will compile:
 /// ```
 /// #![feature(derive_coerce_pointee)]
-/// use std::marker::CoercePointee;
+/// use std::ops::CoercePointee;
 /// use std::ops::Deref;
 ///
 /// #[derive(CoercePointee)]
@@ -57,7 +57,7 @@
 ///
 /// ```
 /// #![feature(arbitrary_self_types, derive_coerce_pointee)]
-/// use std::marker::CoercePointee;
+/// use std::ops::CoercePointee;
 /// use std::ops::Deref;
 ///
 /// #[derive(CoercePointee)]
@@ -111,7 +111,7 @@
 ///   (reference, raw pointer, `NonNull`, `Box`, `Rc`, `Arc`, etc.) or another user-defined type
 ///   also using the `#[derive(CoercePointee)]` macro.
 /// * Zero-sized fields must not mention any generic parameters unless the zero-sized field has
-///   type [`PhantomData`].
+///   type [`PhantomData`](crate::marker::PhantomData).
 ///
 /// ## Multiple type parameters
 ///
@@ -119,7 +119,8 @@
 /// used for dynamic dispatch. For example:
 /// ```
 /// # #![feature(derive_coerce_pointee)]
-/// # use std::marker::{CoercePointee, PhantomData};
+/// # use std::marker::PhantomData;
+/// # use std::ops::CoercePointee;
 /// #[derive(CoercePointee)]
 /// #[repr(transparent)]
 /// struct MySmartPointer<#[pointee] T: ?Sized, U> {
@@ -134,7 +135,7 @@
 /// A custom implementation of the `Rc` type:
 /// ```
 /// #![feature(derive_coerce_pointee)]
-/// use std::marker::CoercePointee;
+/// use std::ops::CoercePointee;
 /// use std::ops::Deref;
 /// use std::ptr::NonNull;
 ///

@Darksonn Darksonn added the F-derive_coerce_pointee Feature: RFC 3621's oft-renamed implementation label Sep 26, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 26, 2025

Some changes occurred in src/tools/cargo

cc @ehuss

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. labels Sep 26, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 26, 2025

r? @tgross35

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

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Copy link
Member

Choose a reason for hiding this comment

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

This will break rust-analyzer tests as these paths are pulled from our mini core which would also need to be adjusted

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@bors

This comment was marked as outdated.

@rustbot
Copy link
Collaborator

rustbot commented Sep 30, 2025

This PR was rebased onto a different master 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.

@Darksonn
Copy link
Contributor Author

@rustbot ready

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Sep 30, 2025

The Miri subtree was changed

cc @rust-lang/miri

@rust-log-analyzer

This comment has been minimized.

use std::fs::{File, Metadata};
use std::io::{ErrorKind, IsTerminal, Seek, SeekFrom, Write};
use std::marker::CoercePointee;
use std::ops::CoercePointee;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed the path used by FileDescriptionRef so I don't understand why CoercePointee broke for FileDescriptionRef. :(

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you'll need #[cfg(bootstrap)] std::marker::CoercePointee and #[cfg(not(bootstrap))] std::ops::CoercePointee so that miri can build stage 1 with an older std and stage 2 with a newer std. Check everything using ./x check --stage 2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. I thought we got rid of the bootstrap stuff recently, but I guess not everywhere. Thinking about it a bit more, I'm just going to add a re-export and remove it in the next rustc cycle.

I believe that also avoids the need to patch the Rust for Linux job, since it uses the macro too.

@tmandry
Copy link
Member

tmandry commented Oct 3, 2025

@rustbot label I-lang-nominated I-libs-api-nominated

This puts CoercePointee (the derive) in the same module as CoerceUnsized (the trait). Both are unstable. In terms of semantics they certainly both enable operations. The current docs of the ops module describe it as defining overloadable operators, which is ambiguous in its meaning, but the module includes traits like Deref and Drop which do not always correspond to explicit syntax.

In my view the common thread between traits in the ops module should be that implementing them enables language-level operations on types, including coercions. This has some precedent in that implementing Deref enables new coercions for your type.

If we don't do this we should adopt another framing that explains where traits like the following should go. There is clearly ambiguity here which is how we ended up with CoercePointee and CoerceUnsized in different modules.

@rustbot rustbot added I-lang-nominated Nominated for discussion during a lang team meeting. I-libs-api-nominated Nominated for discussion during a libs-api team meeting. labels Oct 3, 2025
@traviscross traviscross added P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels Oct 3, 2025
@tgross35 tgross35 removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. F-derive_coerce_pointee Feature: RFC 3621's oft-renamed implementation I-lang-nominated Nominated for discussion during a lang team meeting. I-libs-api-nominated Nominated for discussion during a libs-api team meeting. P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). 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. T-rust-analyzer Relevant to the rust-analyzer 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