Add extern "custom" - #3980
Conversation
|
Thanks @folkertdev for putting this together. @rfcbot fcp merge lang |
|
@traviscross has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
|
@rfcbot reviewed |
|
🔔 This is now entering its final comment period, as per the review above. 🔔 |
|
@rfcbot reviewed |
|
Seeing a RFC entering a final comment period 1 hour after it was opened is extremely rare, and personally makes me worried. Even if it was discussed extensively in the past and all relevant team members are on-board, I believe we should let the community more time to discuss it. |
|
imo it's fine since that's what the final comment period is for, announcing and giving people time to look at something before it's accepted, when the team already thinks it's good enough. |
|
Right, this is the (final) ping for concerns to be raised. This was coordinated during the T-lang triage meeting. This feature is based on the following lang proposal, it is basically unchanged from that thread. |
|
I also felt a bit concerned by the sudden FCP, but the methodology here seems pretty canonical since it uses naked functions. The only potential concern is bikeshedding the name "custom" which could potentially be worded as "none" (since this effectively is no ABI) but that's a pretty weak point and not worth blocking IMHO. Plus, it could be changed even post-acceptance but pre-stabilisation. I see no reason to slow down on the FCP process. |
I would expect this time frame to be fairly short in this case. |
|
"none" is incorrect, as explained in the RFC, there is an ABI happening, it's just not an ABI the compiler knows how to use without assistance. |
Yes, this is another reason justifying the choice, although I do think that "none" that the compiler knows about is still appropriate: the compiler is not using any ABI for the function, even though yes, technically, ABI will always exist no matter what. Even just jumping to a label is still an ABI, after all. My point is that this is technically a weak point of contention, but not one I think is worth discussing here, since the name is more than adequately justified. |
I'm skeptical of this. It only gives very partial type safety, because the signature doesn't tell you what the actual ABI is. I could imagine that the illusion of safety might cause more damage than it averts. It also makes it a breaking change to change the signature, which would otherwise be pure documentation (and therefore able to be improved at any time). I think we should have only a single |
This updates section headers to use Markdown 2nd level headings. As part of rust-lang#3883 we switched the template to not use level-1 headings
|
I'll echo that I'm skeptical of the actual benefits of allowing arbitrary signatures. The signature is a lie, if you need additional safety,you can wrap the type. But I'd happily implement allowing it, it does make the docs easier to write. @joshtriplett @scottmcm given Jules' comment, do you see reason to re-evaluate your decision or is that just what T-lang decided and hence what we're going with? Also to clarify
|
|
To clarify, my comment was only about function pointers. I don't object to allowing any signature on the method declaration, though I also think it would be fine to leave it as a future possibility |
|
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. |
|
A little uncomfortable that not only an FCP here, but an FCP in the main repo to stabilise both passed while there still seem to be a few active discussions. I don't think we need to block stabilisation on another FCP but I think we should at least address all the feedback on the RFC before merging the feature into stable. |
0d53797 to
edf203f
Compare
edf203f to
6dbabd0
Compare
|
We discussed this again in the T-lang meeting on July 22nd (see notes), deciding to reject argument and return types, but to note that they can be a future extension. Waffle (in DMs) requested that we don't special-case Finally, I've added function pointer checks in rust-lang/rust#159780 and updated the text to reflect that we do enforce the restrictions (must be With that, I believe the RFC text matches the current consensus of T-lang and friends, and can be merged. We can then let the dust settle a bit, and move forward with the stabilization PR in a couple of weeks. I understand that there are some people in the thread here that would like to e.g. see arguments: that door is not closed. It just doesn't seem needed right now. If someone feels they have a compelling use case after stabilization of this minimal version, they can pick up the future extensions. |
…ptrs, r=WaffleLapkin check `extern "custom"` function pointers tracking issue: rust-lang#140829 related RFC: rust-lang/rfcs#3980 Best reviewed commit-by-commit. This PR makes 3 changes - extend the ABI checks we already performed on function definitions and trait and foreign declarations to function pointer types. This touches the various `interupt` ABIs and `extern "custom"`. - remove the ability for `extern "custom"` to return `!` - improve the suggestion when `safe` is used in a function pointer type
…ptrs, r=WaffleLapkin check `extern "custom"` function pointers tracking issue: rust-lang#140829 related RFC: rust-lang/rfcs#3980 Best reviewed commit-by-commit. This PR makes 3 changes - extend the ABI checks we already performed on function definitions and trait and foreign declarations to function pointer types. This touches the various `interupt` ABIs and `extern "custom"`. - remove the ability for `extern "custom"` to return `!` - improve the suggestion when `safe` is used in a function pointer type
…ptrs, r=WaffleLapkin check `extern "custom"` function pointers tracking issue: rust-lang#140829 related RFC: rust-lang/rfcs#3980 Best reviewed commit-by-commit. This PR makes 3 changes - extend the ABI checks we already performed on function definitions and trait and foreign declarations to function pointer types. This touches the various `interupt` ABIs and `extern "custom"`. - remove the ability for `extern "custom"` to return `!` - improve the suggestion when `safe` is used in a function pointer type
…ptrs, r=WaffleLapkin check `extern "custom"` function pointers tracking issue: rust-lang#140829 related RFC: rust-lang/rfcs#3980 Best reviewed commit-by-commit. This PR makes 3 changes - extend the ABI checks we already performed on function definitions and trait and foreign declarations to function pointer types. This touches the various `interupt` ABIs and `extern "custom"`. - remove the ability for `extern "custom"` to return `!` - improve the suggestion when `safe` is used in a function pointer type
…ptrs, r=WaffleLapkin check `extern "custom"` function pointers tracking issue: rust-lang#140829 related RFC: rust-lang/rfcs#3980 Best reviewed commit-by-commit. This PR makes 3 changes - extend the ABI checks we already performed on function definitions and trait and foreign declarations to function pointer types. This touches the various `interupt` ABIs and `extern "custom"`. - remove the ability for `extern "custom"` to return `!` - improve the suggestion when `safe` is used in a function pointer type
…ptrs, r=WaffleLapkin check `extern "custom"` function pointers tracking issue: rust-lang#140829 related RFC: rust-lang/rfcs#3980 Best reviewed commit-by-commit. This PR makes 3 changes - extend the ABI checks we already performed on function definitions and trait and foreign declarations to function pointer types. This touches the various `interupt` ABIs and `extern "custom"`. - remove the ability for `extern "custom"` to return `!` - improve the suggestion when `safe` is used in a function pointer type
…ptrs, r=WaffleLapkin check `extern "custom"` function pointers tracking issue: rust-lang#140829 related RFC: rust-lang/rfcs#3980 Best reviewed commit-by-commit. This PR makes 3 changes - extend the ABI checks we already performed on function definitions and trait and foreign declarations to function pointer types. This touches the various `interupt` ABIs and `extern "custom"`. - remove the ability for `extern "custom"` to return `!` - improve the suggestion when `safe` is used in a function pointer type
…ptrs, r=WaffleLapkin check `extern "custom"` function pointers tracking issue: rust-lang#140829 related RFC: rust-lang/rfcs#3980 Best reviewed commit-by-commit. This PR makes 3 changes - extend the ABI checks we already performed on function definitions and trait and foreign declarations to function pointer types. This touches the various `interupt` ABIs and `extern "custom"`. - remove the ability for `extern "custom"` to return `!` - improve the suggestion when `safe` is used in a function pointer type
…ptrs, r=WaffleLapkin check `extern "custom"` function pointers tracking issue: rust-lang#140829 related RFC: rust-lang/rfcs#3980 Best reviewed commit-by-commit. This PR makes 3 changes - extend the ABI checks we already performed on function definitions and trait and foreign declarations to function pointer types. This touches the various `interupt` ABIs and `extern "custom"`. - remove the ability for `extern "custom"` to return `!` - improve the suggestion when `safe` is used in a function pointer type
…ptrs, r=WaffleLapkin check `extern "custom"` function pointers tracking issue: rust-lang#140829 related RFC: rust-lang/rfcs#3980 Best reviewed commit-by-commit. This PR makes 3 changes - extend the ABI checks we already performed on function definitions and trait and foreign declarations to function pointer types. This touches the various `interupt` ABIs and `extern "custom"`. - remove the ability for `extern "custom"` to return `!` - improve the suggestion when `safe` is used in a function pointer type
…ptrs, r=WaffleLapkin check `extern "custom"` function pointers tracking issue: rust-lang#140829 related RFC: rust-lang/rfcs#3980 Best reviewed commit-by-commit. This PR makes 3 changes - extend the ABI checks we already performed on function definitions and trait and foreign declarations to function pointer types. This touches the various `interupt` ABIs and `extern "custom"`. - remove the ability for `extern "custom"` to return `!` - improve the suggestion when `safe` is used in a function pointer type
Rollup merge of #159780 - folkertdev:extern-custom-check-fn-ptrs, r=WaffleLapkin check `extern "custom"` function pointers tracking issue: #140829 related RFC: rust-lang/rfcs#3980 Best reviewed commit-by-commit. This PR makes 3 changes - extend the ABI checks we already performed on function definitions and trait and foreign declarations to function pointer types. This touches the various `interupt` ABIs and `extern "custom"`. - remove the ability for `extern "custom"` to return `!` - improve the suggestion when `safe` is used in a function pointer type
…affleLapkin check `extern "custom"` function pointers tracking issue: rust-lang/rust#140829 related RFC: rust-lang/rfcs#3980 Best reviewed commit-by-commit. This PR makes 3 changes - extend the ABI checks we already performed on function definitions and trait and foreign declarations to function pointer types. This touches the various `interupt` ABIs and `extern "custom"`. - remove the ability for `extern "custom"` to return `!` - improve the suggestion when `safe` is used in a function pointer type
View all comments
Summary
An
extern "custom" fnis a function with a custom ABI that is unknown to rust. Often these are low-level functions that pass arguments in different registers than any standard calling convention.History
extern "unspecified"for naked functions with arbitrary ABI rust#140566abi_customrust#140829extern "custom"functions rust#140770extern "custom"rust#158504Important
Since RFCs involve many conversations at once that can be difficult to follow, please use review comment threads on the text changes instead of direct comments on the RFC.
If you don't have a particular section of the RFC to comment on, you can click on the "Comment on this file" button on the top-right corner of the diff, to the right of the "Viewed" checkbox. This will create a separate thread even if others have commented on the file too.
Rendered