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

marked semihosting_halt function unsafe #163

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kitcatier
Copy link

Description

Please describe the PR here.

Pre-Submission Checklist

When you submit a PR, please make sure your PR satisfies the following checklist:

  • I assert this contribution was authored by me.
  • I license this contribution under the license of this project.
  • The PR title describes your changes briefly and uses the present tense, without a trailing full stop.
  • The PR description describes the reason why we need the change.
  • This is an isolated change. No multiple changes and no unrelated changes are included.
  • Fixed all cargo clippy warnings.
  • Applied rustfmt.
    pub fn semihosting_halt(status: SemihostingExitStatus) {
    unsafe {
    outw(0x501, status as u16);
    }
    }

    hello, if a function's entire body is unsafe, the function is itself unsafe and should be marked appropriately. Marking them unsafe also means that callers must make sure they know what they're doing.

Copy link
Owner

@nuta nuta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Left a suggestion.

Comment on lines +10 to 13
pub unsafe fn semihosting_halt(status: SemihostingExitStatus) {
unsafe {
outw(0x501, status as u16);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
pub unsafe fn semihosting_halt(status: SemihostingExitStatus) {
unsafe {
outw(0x501, status as u16);
}
pub unsafe fn semihosting_halt(status: SemihostingExitStatus) {
outw(0x501, status as u16);

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 this pull request may close these issues.

2 participants