Skip to content

Remove most unsafe via #[target_feature] v1.1 #166

@Shnatsel

Description

@Shnatsel

Rust now RustFFT relies on #[target_feature=...] unsafe fn functions for runtime detection of SSE and AVX. This obscures which operations are actually unsafe, such as loads/stores by raw pointer, and which are perfectly safe as long as the CPU supports the required instructions.

Rust 1.86 has stabilized the target-feature-1.1 RFC. Starting with Rust 1.86 it is no longer necessary to use unsafe fn for functions annotated with #[target_feature=...]. They are safe to call as long as they are being called from a context with the same target features, so e.g. AVX functions can freely call other AVX functions without unsafe.

Removing the now-redundant unsafe would make the codebase much easier to understand and audit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions