Conversation
|
r? @clarfonthey rustbot has assigned @clarfonthey. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| @@ -85,7 +85,3 @@ impl<T: PointeeSized, U: PointeeSized> CoerceUnsized<pattern_type!(*const U is ! | |||
| impl<T: DispatchFromDyn<U>, U> DispatchFromDyn<pattern_type!(U is !null)> for pattern_type!(T is !null) {} | |||
|
|
|||
| impl<T: PointeeSized> Unpin for pattern_type!(*const T is !null) {} | |||
|
|
|||
| unsafe impl<T: PointeeSized> Freeze for pattern_type!(*const T is !null) {} | |||
There was a problem hiding this comment.
The UnsafeUnpin implementation already lives in marker, so I've moved this too for consistency.
| #[lang = "freeze"] | ||
| #[unstable(feature = "freeze", issue = "121675")] | ||
| pub unsafe auto trait Freeze {} | ||
| pub impl(crate) unsafe auto trait Freeze {} |
There was a problem hiding this comment.
Can these be impl(self)?
There was a problem hiding this comment.
There is a manual Freeze implementation for NonZero that's used to provide nicer error messages. Since it's in core, I don't think it matters too much, but I can change it if you want.
There was a problem hiding this comment.
I figured impl(self) would make it less likely that someone adds a manual impl outside this module not knowing that it is probably a bad idea. But a manual impl for better error messages makes sense I guess.
There was a problem hiding this comment.
On second thought, it's very unlikely for this to show up anyway: there's no way to require the absence of a trait, and NonZero is Freeze for all types that can implement ZeroablePrimitive. So I think you could never run into a situation where the error is "NonZero doesn't implement Freeze because <T as ZeroablePrimitive>::NonZeroInner doesn't implement it". I'll constrain it to impl(self).
Wait, it's about the documentation, so this is still relevant. Nevermind!
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
Wait, does that mean we can get rid of |
|
Hmm, is the behaviour on derived impls something explicitly documented anywhere? The code looks fine otherwise, but I would like at least some assurance that this isn't going to change down the line. |
|
Wait, never mind, I misinterpreted "auto-derived" to mean… ones that came from Yes, this makes a lot more sense. We should be able to merge this once tests are good. |
|
For behavior on auto-impls (i.e. from an |
No, these traits still need to be implemented, it's just done by the compiler. |
|
@rustbot author |
Fixes #161630
impl(crate)only prevents explicit implementations, but not the automatically derived ones (playground), so we can use it to the same effect as#[rustc_deny_explicit_impl]while still having the fundamental implementations of these traits incore.