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

Warn on unnecessary unsafe blocks #6866

Closed
asterite opened this issue Dec 19, 2024 · 0 comments · Fixed by #6867
Closed

Warn on unnecessary unsafe blocks #6866

asterite opened this issue Dec 19, 2024 · 0 comments · Fixed by #6867
Assignees
Labels
enhancement New feature or request

Comments

@asterite
Copy link
Collaborator

Problem

Code like this:

fn main() {
    unsafe {
        foo();
    }
}

fn foo() {}

does not warn that the unsafe block is not needed. If the compiler does not tells us it's unneeded we could think the call is unsafe when it actually isn't.

Similarly, if there's unsafe nested inside another unsafe, the compiler should warn about it.

Happy Case

The compiler detects unsafe blocks that don't have any unconstrained calls, or unsafe blocks that happen inside unconstrained calls.

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

None

Blocker Context

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@asterite asterite added the enhancement New feature or request label Dec 19, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Dec 19, 2024
@asterite asterite self-assigned this Dec 19, 2024
@TomAFrench TomAFrench moved this from 📋 Backlog to 🏗 In progress in Noir Dec 19, 2024
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Noir Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant