You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fnfoo(){vec![0];//~ call to unsafe function is unsafe and requires an unsafe function or block}
This happens because vec![] now expands to a alloc::boxed::box_new call which is marked as #[rustc_intrinsic]. Rust-analyzer however doesn't treat it as safe intrinsic. In the past there was a list of hard coded intrinsics that are safe, but nowadays any #[rustc_intrinsic] which doesn't have unsafe as part of their signature is safe (rustc still double checks the declaration I think, but rust-analyzer shouldn't need to).
The text was updated successfully, but these errors were encountered:
rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)
rustc version:
rustc 1.86.0-nightly (1891c2866 2025-01-04)
editor or extension: VSCode
relevant settings: none
repository link (if public, optional):
code snippet to reproduce:
This happens because
vec![]
now expands to aalloc::boxed::box_new
call which is marked as#[rustc_intrinsic]
. Rust-analyzer however doesn't treat it as safe intrinsic. In the past there was a list of hard coded intrinsics that are safe, but nowadays any#[rustc_intrinsic]
which doesn't haveunsafe
as part of their signature is safe (rustc still double checks the declaration I think, but rust-analyzer shouldn't need to).The text was updated successfully, but these errors were encountered: