Rust and C++ Interoperability in Chrome
chromium.org
Rust and C++ Interoperability in Chrome
1–10 of 150 posts
Re: Rust and C++ Interoperability in Chrome
#2Re: Rust and C++ Interoperability in Chrome
#3https://floooh.github.io/2018/06/17/handles-vs-pointers.html
Re: Rust and C++ Interoperability in Chrome
#4Is this different from the Firefox integration with Rust in some meaningful way?
It looks like the cxx library is going to be critical for this. I’m curious how helpful others have found cxx for interop with C++?
> For a Rustacean, this is controversial - all C++ is unsafe! But “unsafe” should be a really bad code smell. If “unsafe” is needed for all C++ calls, there will be thousands of them, and the “unsafe” keyword will lose its meaning.
I don’t think the attitude about unsafe usage differs from the general Rust community. If there’s a lot of it, then it definitely is a code smell.
Re: Rust and C++ Interoperability in Chrome
#5> This seems to present some C++/Rust interoperability challenges which nobody else has faced. Is this different from the Firefox integration with Rust in some meaningful way? It looks like the cxx library is going to be critical for this. I’m curious how helpful others have found cxx for interop with C++? > For a Rustacean, this is controversial - all C++ is unsafe! But “unsafe” should be a really bad code smell. If…
#define CPP_CALL unsafe
in the Rust equivalent to annotate "unsafe" cpp calls from Rust?"No boilerplate or redeclarations. No C++ annotations. Ideally, no allowlist."
This seems like an unpractical approach. How do you even call C++ code from Rust without extern "C" linkage.
Re: Rust and C++ Interoperability in Chrome
#6Re: Rust and C++ Interoperability in Chrome
#7> This seems to present some C++/Rust interoperability challenges which nobody else has faced. Is this different from the Firefox integration with Rust in some meaningful way? It looks like the cxx library is going to be critical for this. I’m curious how helpful others have found cxx for interop with C++? > For a Rustacean, this is controversial - all C++ is unsafe! But “unsafe” should be a really bad code smell. If…
Can't you just do a: #define CPP_CALL unsafe in the Rust equivalent to annotate "unsafe" cpp calls from Rust? "No boilerplate or redeclarations. No C++ annotations. Ideally, no allowlist." This seems like an unpractical approach. How do you even call C++ code from Rust without extern "C" linkage.
Re: Rust and C++ Interoperability in Chrome
#8> This seems to present some C++/Rust interoperability challenges which nobody else has faced. Is this different from the Firefox integration with Rust in some meaningful way? It looks like the cxx library is going to be critical for this. I’m curious how helpful others have found cxx for interop with C++? > For a Rustacean, this is controversial - all C++ is unsafe! But “unsafe” should be a really bad code smell. If…
Can't you just do a: #define CPP_CALL unsafe in the Rust equivalent to annotate "unsafe" cpp calls from Rust? "No boilerplate or redeclarations. No C++ annotations. Ideally, no allowlist." This seems like an unpractical approach. How do you even call C++ code from Rust without extern "C" linkage.
Re: Rust and C++ Interoperability in Chrome
#9Re: Rust and C++ Interoperability in Chrome
#10They should focus on integrating Rust in portions of the API instead of exposing a gigantic unsafe API surface, essentially making all their code unsafe. Unless the Chrome codebase is really such a mess that they can't do anything without exposing this giant API surface. In that case they should rewrite it to... not do that.
"We can't use Rust unless it allows us to write all our code in C++ without showing unsafe warnings"