Repository navigation
Closed
Labels
B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-design-concernsStatus: There are blocking design concerns.Status: There are blocking design concerns.S-tracking-needs-summaryStatus: It's hard to tell what's been done and what hasn't! Someone should do some investigation.Status: It's hard to tell what's been done and what hasn't! Someone should do some investigation.T-langRelevant to the language teamRelevant to the language team
Description
Added in #42058, which fixes #42044 and related requests from other bugs.
This calling convention is the default calling convention for C++ instance methods in the (MSVC) Windows ABI. At the very least, bindgen (and its dependency syntex) need this to exist so they have a reasonable chance of representing C++ instance methods in an AST. thiscall is therefore important for the interop story between Rust and C++ on Windows.
I don't think you could actually write callable C++ instance methods in Rust for MSVC, since mangled names in MSVC contain characters that, AFAICT, are not legal in Rust identifiers ('?', for instance). But maybe there is cleverness around assigning assembly names to things that I am not aware of.
Reacted by Diana, Markus Hauge, Jamen Marz, felicia, Luracasmus and Arto Bendiken
Metadata
Metadata
Assignees
Labels
B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-design-concernsStatus: There are blocking design concerns.Status: There are blocking design concerns.S-tracking-needs-summaryStatus: It's hard to tell what's been done and what hasn't! Someone should do some investigation.Status: It's hard to tell what's been done and what hasn't! Someone should do some investigation.T-langRelevant to the language teamRelevant to the language team
Activity
ids1024 commentedon May 25, 2017
If this doesn't exist, perhaps it warrants an RFC? In particular some kind of attribute to specify the symbol name as an alternative to
no_mangle.froydnj commentedon May 25, 2017
I think this sounds like an excellent idea!
ids1024 commentedon May 25, 2017
It looks like there's already an
export_nameattribute that does this. That probably would work.steveklabnik commentedon Mar 12, 2019
Triage: not aware of any movement on stabilizing this.
whatisaphone commentedon Apr 25, 2019
I see what you did there, and I like it.
More seriously, I'm just swinging by to say I use this feature independently of bindgen, and I hope it's stabilized one day (or at least sticks around in some form)
MSxDOS commentedon Sep 28, 2020
What's blocking stabilization of this?
pravic commentedon Dec 24, 2020
The same question.
cc @dtolnay to route this to an appropriate person.
super-continent commentedon Apr 19, 2021
Wondering the same myself, any updates on stabilizing this? Would be very nice to have access to in stable.
zorftw commentedon Jul 26, 2021
It's been rather long, why is still unstable?
chorman0773 commentedon Aug 22, 2021
Indeed. I have a use for this in my compiler project https://github.com/LightningCreations/lccc, which would allow me to write bindings to the C++ api in rust on MSVC (which I am able to do on other major compilers, but need thiscall for i386 windows).
beepster4096 commentedon Sep 20, 2021
I think this feature should be stabilized.
Stabilization Report
Summary
The
abi_thiscallfeature allows code to export and link to functions with the thiscall abi. This is the abi used by default for C++ member functions on x86 MSVC, and is very important for C++ FFI.Tests
This feature is tested in
ui/extern/extern-thiscall.rsDocumentation PRs
There are no known issues or unresolved questions related to this feature.
ChrisDenton commentedon Oct 22, 2021
If/when this is fcp'd, would anyone be ready with the stabilization PR? @drmeepster maybe?
Not that I want to rush anyone. I understand people have other priorities and commitments, etc. But I am quite keen to see this stabilized as soon as realistically possible. 😀
58 remaining items
Rollup merge of #114562 - Trolldemorted:thiscall, r=oli-obk
Rollup merge of #114562 - Trolldemorted:thiscall, r=oli-obk
Rollup merge of #114562 - Trolldemorted:thiscall, r=oli-obk
rust: kbuild: set `bindgen`'s Rust target version
rust: kbuild: set `bindgen`'s Rust target version
rust: kbuild: set `bindgen`'s Rust target version
rust: kbuild: set `bindgen`'s Rust target version
rust: kbuild: set `bindgen`'s Rust target version
rust: kbuild: set `bindgen`'s Rust target version
rust: kbuild: set `bindgen`'s Rust target version
rust: kbuild: set `bindgen`'s Rust target version
rust: kbuild: set `bindgen`'s Rust target version
rust: kbuild: set `bindgen`'s Rust target version
rust: kbuild: set `bindgen`'s Rust target version
rust: kbuild: set `bindgen`'s Rust target version