# Rust's SIMD is finally safe — and the trick is a zero-sized token

Original title: Safe SIMD in Rust, even on the inside

> Hacker News story 50033601 · language: en · submitted 2026-10-10
> Web version: https://zeli.app/story/50033601
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 65 · by [ravenical](<https://news.ycombinator.com/user?id=ravenical>) · 💬 4
[original](<https://shnatsel.github.io/safe-simd-in-rust-even-on-the-inside/>) · [HN discussion](<https://news.ycombinator.com/item?id=50033601>)

## Summary

Rust's SIMD abstractions hid vast amounts of unsafe code beneath their surface, occasionally leading to bugs. Sergey "Shnatsel" Davidoff explains how an unforgeable zero-sized token, obtained only after a runtime CPU feature check, lets you call AVX2 intrinsics without unsafe. A macro encapsulates the one unsafe block, and generics over instruction-set levels give you a + b with automatic dispatch. The catch: function call overhead means you must inline or annotate with #[target_feature].

## Key quote

> Inside, they're still full of unsafe. It wasn't gone, just hidden. Vast quantities of it lurking just beneath the surface, getting screwed up occasionally.

---

## Cite

- Page: https://zeli.app/story/50033601
- Date: 2026-10-10
- Source: shnatsel.github.io (https://shnatsel.github.io/safe-simd-in-rust-even-on-the-inside/)
- Hacker News: https://news.ycombinator.com/item?id=50033601

## Other languages

- zh: https://zeli.app/zh/story/50033601 · markdown: https://zeli.app/zh/story/50033601.md
- ja: https://zeli.app/ja/story/50033601 · markdown: https://zeli.app/ja/story/50033601.md
- ko: https://zeli.app/ko/story/50033601 · markdown: https://zeli.app/ko/story/50033601.md
- de: https://zeli.app/de/story/50033601 · markdown: https://zeli.app/de/story/50033601.md
- es: https://zeli.app/es/story/50033601 · markdown: https://zeli.app/es/story/50033601.md
- ru: https://zeli.app/ru/story/50033601 · markdown: https://zeli.app/ru/story/50033601.md
