compiler/rustc_error_codes/src/error_codes/E0511.md MARKDOWN 32 lines View on github.com → Search inside
1Invalid monomorphization of an intrinsic function was used.23Erroneous code example:45```compile_fail,E05116#![feature(intrinsics)]78#[rustc_intrinsic]9unsafe fn simd_add<T>(a: T, b: T) -> T;1011fn main() {12    unsafe { simd_add(0, 1); }13    // error: invalid monomorphization of `simd_add` intrinsic14}15```1617The generic type has to be a SIMD type. Example:1819```20#![feature(repr_simd)]21#![feature(intrinsics)]2223#[repr(simd)]24#[derive(Copy, Clone)]25struct i32x2([i32; 2]);2627#[rustc_intrinsic]28unsafe fn simd_add<T>(a: T, b: T) -> T;2930unsafe { simd_add(i32x2([0, 0]), i32x2([1, 2])); } // ok!31```

Findings

✓ No findings reported for this file.

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.