docs

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

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

#E0111: invalid #[lang] item

#[lang("slot")] (standard library only) names a known slot, once, on an item of the slot's form.

nabi
#[lang("add_trait")]
trait BadAdd { fn plus(self, o: Self) -> Self; }
error[E0111]: `BadAdd` does not match the form of lang slot `add_trait`: it needs `fn add(self, _)`
  --> main.nabi:1:1
   |
 1 | #[lang("add_trait")]
   | ^^

#[lang] is for the standard library. A program implements the standard trait instead: impl ops::Add for Point gives Point the + operator.

Related: E0115 invalid #[intrinsic], E0123 registered twice

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