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

core::intrinsics::abort() is unsafe and requires an unsafe block? #11611

Closed
callym opened this issue Mar 3, 2022 · 0 comments · Fixed by #11613
Closed

core::intrinsics::abort() is unsafe and requires an unsafe block? #11611

callym opened this issue Mar 3, 2022 · 0 comments · Fixed by #11613
Assignees

Comments

@callym
Copy link
Contributor

callym commented Mar 3, 2022

core::intrinsics::abort();

With the above code anywhere in my library, I get a red error in VSCode saying the following. The code compiles properly, and passes cargo check and cargo clippy with no warnings or errors.

this operation is unsafe and requires an unsafe function or block 
rust-analyzer(missing-unsafe)

When I add the unsafe block, I then get:

unnecessary `unsafe` block
`#[warn(unused_unsafe)]` on by default
rustc(unused_unsafe)

In the stdlib docs, intrinsics::abort says "Note that, unlike most intrinsics, this is safe to call".

rust-analyzer version: (eg. output of "Rust Analyzer: Show RA Version" command)

rust-analyzer version: a55dd29e8 2022-03-03 nightly

rustc version: (eg. output of rustc -V)

rustc 1.61.0-nightly (4b043faba 2022-02-24)

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTUP_HOME or CARGO_HOME)

VSCode settings:

{
    "rust-analyzer.checkOnSave.allTargets": false,
    "rust-analyzer.cargo.target": "i686-pc-windows-msvc"
}
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.

2 participants