-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide niches under UnsafeCell #68491
Hide niches under UnsafeCell #68491
Conversation
r? @zackmdavis (rust_highfive has picked a reviewer for you, use r? to override) |
Was the choice of |
We did discuss it at the relevant lang team meeting. I think it is fair to say that no one there was a strong champion of the I nonetheless went with it. It is more readily adaptable if we discover other cases that should be treated like this. It is also more flexible: for example, if we decide that we want #[lang = "unsafe_cell"]
#[repr(transparent)]
struct UnsafeCellWithExposedNiche<T: ?Sized> {
value: T,
}
#[repr(transparent)]
#[repr(no_niche)]
pub struct UnsafeCell<T: ?Sized> {
value: UnsafeCellWithExposedNiche<T>,
}
#[repr(transparent)]
pub struct Cell<T: ?Sized> {
value: UnsafeCellWithExposedNiche<T>,
} |
I didn't give a super detailed review, but this looks good to me. I think that having |
@bors r+ |
📌 Commit c29be616278e583b76d8aa2d486585ae8112c1c2 has been approved by |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@bors r- |
(I lost the race with PR #68122; I'll rebase atop current master and update the test to remove |
64e541b
to
5649128
Compare
@bors r=oli |
📌 Commit 56491287a37cbd684c341c8c0d982ac215ff9dfc has been approved by |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
👉 "who's got two thumbs and thought 'surely nothing bad could happen if I just change the issue number in the feature meta-data to point at this PR rather than the issue, and move the meta-data record to a more appropriate spot in the list!' ...? This guy!" 👈 |
@pnkfelix I think I would prefer to have a true tracking issue, myself, versus pointing to this PR. It'd be great to link to (e.g.) the write-up that I did, the original issue, and to give some context about how this mechanism is rustc-internal and not expected to be stabilized. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@nikomatsakis The standard approach to internal feature gates is to put them in the "internal feature gates" section without a tracking issue: rust/src/librustc_feature/active.rs Lines 96 to 98 in b181835
|
⌛ Testing commit ea11b244d9793c9c7a2bcf61e95ea0f7e9aed6ec with merge 483c481cc8cd6bad32fedc84cd407fbf72f60149... |
💥 Test timed out |
☔ The latest upstream changes (presumably #68933) made this pull request unmergeable. Please resolve the merge conflicts. |
This repr-hint makes a struct/enum hide any niche within from its surrounding type-construction context. It is meant (at least initially) as an implementation detail for resolving issue 68303. We will not stabilize the repr-hint unless someone finds motivation for doing so. (So, declaration of `no_niche` feature lives in section of file where other internal implementation details are grouped, and deliberately leaves out the tracking issue number.) incorporated review feedback, and fixed post-rebase.
ea11b24
to
1b12232
Compare
@bors r=oli |
📌 Commit 1b12232 has been approved by |
@bors p=1 |
☀️ Test successful - checks-azure |
Hide any niche of T from type-construction context of
UnsafeCell<T>
.Fix #68303
Fix #68206