Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using unsafe in unsafe functions #335

Closed
Medowhill opened this issue Jan 15, 2021 · 2 comments · Fixed by #377
Closed

Using unsafe in unsafe functions #335

Medowhill opened this issue Jan 15, 2021 · 2 comments · Fixed by #377
Assignees

Comments

@Medowhill
Copy link
Collaborator

현재는 unsafe 함수 안에서 unsafe 블록 없이 unsafe한 일들을 할 수 있지만 이는 바람직하지 않습니다. (https://github.com/rust-lang/rfcs/blob/master/text/2585-unsafe-block-in-unsafe-fn.md) 이는 #[deny(unsafe_op_in_unsafe_fn)]를 함수나 모듈 앞에 추가해 해결할 수 있습니다. (rust-lang/rust#72709)

PR #334 에서 해당 기능을 사용할 수 있도록 lib.rs#![feature(unsafe_block_in_unsafe_fn)]를 추가했고 PR에서 수정한 함수 하나가 #[deny(unsafe_op_in_unsafe_fn)]를 사용하고 있습니다. 현재 단계에서는 해당 기능이 당장 중요하지 않지만, 리팩토링이 마무리 단계에 들어가고 본격적으로 unsafe에 대한 논증을 하게 되면 해당 기능을 프로젝트 전체에서 사용하는 것을 고려해 보아야 할 거 같습니다.

@jeehoonkang
Copy link
Member

매우 좋은 것 같습니다. 이런 기능이 있는지 몰랐는데 우리 목적으로는 지금 빨리 켜는게 좋을 것 같습니다.

@Medowhill
Copy link
Collaborator Author

이걸 혹시 code base 전체에 적용할 수도 있을까요?

Originally posted by @jeehoonkang in #334 (comment)

네. lib.rs#![deny(unsafe_op_in_unsafe_fn)]를 추가하면 프로젝트 전체에 적용할 수 있습니다. 그러나 지금 바로 적용하면 상당히 많은 unsafe 함수에서 컴파일 오류가 발생할 것이기 때문에, 일단은 그렇게 하지 않았습니다. 일단은 리팩토링 과정에서 파일 단위로 해당 어트리뷰트를 추가하고, 나중에 대부분의 파일에 해당 어트리뷰트가 적용되면 그때 프로젝트 전체에 적용하는 것은 어떻게 생각하시나요? 이 문제는 #335 에서 이야기하는 것이 더 좋을 것 같습니다.

Originally posted by @Medowhill in #334 (comment)

anemoneflower added a commit to anemoneflower/rv6-1 that referenced this issue Jan 27, 2021
@anemoneflower anemoneflower self-assigned this Jan 27, 2021
@ghost ghost closed this as completed in 815eca3 Jan 27, 2021
@ghost ghost closed this as completed in #377 Jan 27, 2021
Gabriel4256 pushed a commit to Gabriel4256/rv6 that referenced this issue Sep 8, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants