docs

You are reading the docs for v0.1.0. Nabi 0.1.0 is no longer supported. Latest release: v0.1.3 →

#E0121: invalid cfg predicate

A #[cfg(..)] or cfg!(..) predicate is not well formed. It is a flag (unix), a key = "value" pair, or all(..), any(..) and not(..) of those.

nabi
#[cfg(either(target_family = "unix", target_family = "windows"))]
println("desktop");
error[E0121]: unknown cfg combinator `either` (`all`, `any`, `not`)
  --> main.nabi:1:1
   |
 1 | #[cfg(either(target_family = "unix", target_family = "windows"))]
   | ^^

Use all, any or not:

nabi
#[cfg(any(target_family = "unix", target_family = "windows"))]
println("desktop");
desktop

Chapter 17 lists the keys.

Related: E0109 malformed attribute

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