3 ms·
I don’t know much about the topic, but I am curious: does this open Rust up to being less “safe” (in the Rust sense of safety)? C is of course higher level tha
by gonational 6y ago
I don’t know much about the topic, but I am curious: does this open Rust up to being less “safe” (in the Rust sense of safety)?
C is of course higher level than assembly and I understand that C is very much not “safe”, so it makes me wonder whether this gives library developers incentives to add code that has a higher likelihood of creating security bugs while optimizing their code.
Is there any reason to believe this could be the case, or am I just misunderstanding how all of this fits together?
- _bxg1 6y agounsafe { } blocks already exist, and in fact it looks like these have to go inside of them. Rust can do unsafe things, it just goes to great lengths to empower you to avoid accidentally doing unsafe things. It also forces you to label all unsafe code with an easily-searchable demarcation.
- andolanra 6y agoThis does not make Rust less safe. The capability to use assembly is already there: either by using the existing assembly syntax, by linking to C code, or by linking to assembly routines directly. In order to use this, you need to use the unsafe keyword in order to indicate to Rust, "I am aware that the guarantees that Rust provides to me are not applicable when using this feature." This is true of all the existing ways of interfacing with non-Rust or assembly code, and it does not change with this new syntax.