浏览代码

these raw instructions are unsafe

M Farkas-Dyck 6 年之前
父节点
当前提交
8e0faa9182
共有 1 个文件被更改,包括 2 次插入4 次删除
  1. 2 4
      src/asm.rs

+ 2 - 4
src/asm.rs

@@ -3,12 +3,10 @@
 macro_rules! instruction {
     ($fnname:ident, $asm:expr) => (
         #[inline]
-        pub fn $fnname() {
+        pub unsafe fn $fnname() {
             match () {
                 #[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))]
-                () => unsafe {
-                    asm!($asm :::: "volatile");
-                },
+                () => asm!($asm :::: "volatile"),
                 #[cfg(not(any(target_arch = "riscv32", target_arch = "riscv64")))]
                 () => {}
             }