-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
remove pref_align_of intrinsic #90877
Conversation
Some changes occured to rustc_codegen_cranelift cc @bjorn3 Some changes occured to the CTFE / Miri engine cc @rust-lang/miri |
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
9ec424f
to
3d75550
Compare
The Zulip thread does mention that this is used by c2rust though. |
Good point, I pinged the person who wrote that on Zulip (not sure about their GH handle). AFAIK we usually do remove features that have no path to stabilization. This one does not even have a tracking issue (to my knowledge) -- the least we should have if anyone actually needs this. |
However, https://github.com/immunant/c2rust/search?q=pref_align_to turns up no results. |
Hm, so it seems like the |
oops
By that argument, we should aim to have a function in |
Interesting, back in 2014, |
Ah yeah, I meant warranted in a sense that “this will produce the expected result” and less so a justification for use of an intrinsic as an implementation strategy. None of the mechanisms to obtain the preferred alignment in C are standard either, though, so c2rust could consider not supporting preferred alignment too. |
I assume there will be pre-C11 code that uses |
Since this concerns intrinsics, Cc @rust-lang/lang |
With my lang hat on, I consider intrinsics entirely a compiler-team question so long as they're not otherwise exposed. So removing something unexposed sounds fine to me, FWIW. (I have no opinion right now on whether it should be exposed.) |
Well, they are unstably 'exposed' and the main concern here is breaking c2rust which uses one of those intrinsics that are not really but de-facto sufficiently exposed. |
Even though I'm not really familiar with this intrinsic, my thoughts are: 1) What is/was its original purpose? 2) Is that purpose no longer needed or is it solved some other way? 3) If it isn't solved some other way, should it be? 4) How often is this actually used/how much breakage do we expect? |
@RalfJung what do you think the next step here is? I don't feel comfortable approving this alone (at least not without the questions above answered, maybe also with lang FCP given this is unstably exposed). |
Looks like some team needs to decide if we want to keep an unexposed un-RFCd no-tracking-issue intrinsic around because it has a downstream user. I don't think this is a good situation. If we didn't already have it, we certainly would not add it like that. Ideally, someone who needs that intrinsic would work towards exposing it, unstably at least. |
It definitely doesn't need an FCP, since it's a reversible decision that doesn't affect stable. I've nominated for lang to try to get unstuck. |
Cc @thedataking for c2rust input. |
Appreciate the ping @RalfJung. The code which may emit this intrinsic was added to support LLVM 8 (commit). The LLVM source code for
Which sounds like we'd lose the ability to correctly transpile some code if preferred alignment is no longer exposed; we would have to emit an error if the input source uses this intrinsic. |
Here are the relevant GCC bug reports about this:
I'm not sure exactly the sense in which the preferred alignment is ABI impacting. It will of course affect the ABI of things like Emitting an error on |
We discussed this both in last week's and today's @rust-lang/lang meeting. In both cases, we came to the conclusion that we're not in a hurry to remove this intrinsic, and it's not obvious that the intrinsic couldn't be stabilized in the future if it makes sense to do so, given that people are using it. Given that, we don't want to merge this PR at this time, and we don't mind letting this sit on nightly, unless there's some other reason that we should be considering this an urgent issue. |
Okay, I opened a tracking issue at #91971 then. |
…lacrum link to pref_align_of tracking issue If we are not going to remove this intrinsic (rust-lang#90877), I think we should at least have a place to centralize discussion around it, so here we go. Intrinsics don't have their own separate features and usually we instead use the public method for tracking it, but this one does not have such a method... so the tracking issue is just a regular link. (And then we sue it for the const part as well.)
…lacrum link to pref_align_of tracking issue If we are not going to remove this intrinsic (rust-lang#90877), I think we should at least have a place to centralize discussion around it, so here we go. Intrinsics don't have their own separate features and usually we instead use the public method for tracking it, but this one does not have such a method... so the tracking issue is just a regular link. (And then we sue it for the const part as well.)
…lacrum link to pref_align_of tracking issue If we are not going to remove this intrinsic (rust-lang#90877), I think we should at least have a place to centralize discussion around it, so here we go. Intrinsics don't have their own separate features and usually we instead use the public method for tracking it, but this one does not have such a method... so the tracking issue is just a regular link. (And then we sue it for the const part as well.)
…lacrum link to pref_align_of tracking issue If we are not going to remove this intrinsic (rust-lang#90877), I think we should at least have a place to centralize discussion around it, so here we go. Intrinsics don't have their own separate features and usually we instead use the public method for tracking it, but this one does not have such a method... so the tracking issue is just a regular link. (And then we sue it for the const part as well.)
This intrinsic has never been stably exposed, and its existence occasionally causes confusion. Preferred alignment still exists as a concept inside the compiler that it might use e.g. for aligning globals, but there seems to be no good reason to expose it to clients. Also see this discussion on Zulip.