Skip to content

Commit

Permalink
[Rust]unsafeなコードを原則禁止にした (VOICEVOX#175)
Browse files Browse the repository at this point in the history
unsafeなコードを原則禁止にした

unsafe_codeをdenyにすることにより、うっかりunsafeコードを書くのを防ぐことが目的
例外としてc関数向けの実装である c_export moduleと、static領域に配置する必要があるStatus structについてはunsafeを使うことを許可している

refs VOICEVOX#128
  • Loading branch information
qwerty2501 committed Jul 23, 2022
1 parent 45cc387 commit 48d760b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/voicevox_core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#![deny(unsafe_code)]

#[allow(unsafe_code)]
mod c_export;
mod engine;
mod error;
Expand Down
2 changes: 2 additions & 0 deletions crates/voicevox_core/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ impl SupportedDevices {
}
}

#[allow(unsafe_code)]
unsafe impl Send for Status {}
#[allow(unsafe_code)]
unsafe impl Sync for Status {}

impl Status {
Expand Down

0 comments on commit 48d760b

Please sign in to comment.