Rust-GCC / gccrs

GCC Front-End for Rust
https://rust-gcc.github.io/
GNU General Public License v2.0
2.36k stars 151 forks source link

Forbid calls to `asm!()` in safe contexts #1569

Closed CohenArthur closed 2 days ago

CohenArthur commented 1 year ago

Needs #1568

liamnaddell commented 1 month ago

@CohenArthur This issue should be closed, it is no longer present in gccrs:

liam@gentoo /tmp $ cat inline_asm_nop.rs
#![feature(rustc_attrs)]

#[rustc_builtin_macro]
macro_rules! asm {
    () => {}
}

fn main() {
        asm!("nop");
        asm!("nop",);
}
liam@gentoo /tmp $ gccrs inline_asm_nop.rs
inline_asm_nop.rs:9:9: error: use of inline assembly is unsafe and requires unsafe function or block [E0133]
    9 |         asm!("nop");
      |         ^~~
inline_asm_nop.rs:10:9: error: use of inline assembly is unsafe and requires unsafe function or block [E0133]
   10 |         asm!("nop",);
      |         ^~~