Rust: Tracking issue for the `thiscall` calling convention

Created on 24 May 2017  路  6Comments  路  Source: rust-lang/rust

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.

B-unstable C-tracking-issue T-compiler

Most helpful comment

But maybe there is cleverness around assigning assembly names to things that I am not aware of.

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.

All 6 comments

But maybe there is cleverness around assigning assembly names to things that I am not aware of.

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.

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.

I think this sounds like an excellent idea!

It looks like there's already an export_name attribute that does this. That probably would work.

Triage: not aware of any movement on stabilizing this.

not aware of any movement on stabilizing _this_

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)

What's blocking stabilization of this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nikomatsakis picture nikomatsakis  路  412Comments

GuillaumeGomez picture GuillaumeGomez  路  300Comments

cramertj picture cramertj  路  512Comments

nikomatsakis picture nikomatsakis  路  331Comments

nikomatsakis picture nikomatsakis  路  268Comments