Error codes

E0422: per-target files of a module disagree on what the package uses

In a terminal: auk explain E0422 prints this page.

On this page

In the runtime package, x.macos.auk, x.linux.auk, x.linux-arm64.auk and x.auk are variants of the module x: each target compiles the most specific one (docs/lowlevel.md §11). Whatever the rest of the package uses from x must be declared pub in the variant of every target that uses it, with the same signature in all of them. Every file is parsed, so this is checked on any machine, for every target. Items only one target's own files use may exist only in that target's variant.

Wrong#

toml
[package]
name = "auk_rt"
version = "0.1.0"
effects = ["raw"]
auk
fn main() { let _ = plat.page_size() }
auk
pub fn page_size(): i64 = 16384
auk
pub fn page_size(): i32 = 4096

Fixed#

auk
pub fn page_size(): i64 = 4096

Common causes#

  • A constant or function added to one platform's file only, then used from shared code.
  • A type that differs by platform written into a signature: give it a raw type alias per file (raw type ModeT = u16) and use the alias in the shared signature.
  • A typo in one variant's name.

Stuck on a word? Try the glossary. Got a compiler error? Look up its code. Improve this page