docs

你正在阅读 v0.1.2 的文档。Nabi 0.1.2 已不再提供支持。 最新版本:v0.1.3 →

本页尚未翻译,以下为英文原文。

#E0115: invalid #[intrinsic]

#[intrinsic("nabi.OP.TYPE")] is for the standard library, on a function of the shape the operation takes.

nabi
#[intrinsic("nabi.add.i32")]
fn add(a: i32, b: i32) -> i32 { a + b }
error[E0115]: `#[intrinsic]` on `add`: the intrinsic attribute is for the standard library only
  --> main.nabi:2:1
   |
 2 | fn add(a: i32, b: i32) -> i32 { a + b }
   | ^^

Remove the attribute and write the body in Nabi; the compiler optimizes plain arithmetic on its own.

Related: E0111 invalid #[lang] item

Found a mistake? Edit this page on GitHub. Last updated