Ruta graveolens  ·  notes from a language experiment  ·  cultivated since 2025

E0706: Private member access

CodeCategoryStability
E0706IntrinsicPermanent

Explanation

An access crossed a directory boundary to a private item. The top-level item, or the enclosing type for an enum variant or associated function, was not declared pub. Rue privacy is directory-based: private items remain usable by files in their defining directory but are hidden from importers in other directories. One code covers every position that can name the item — a value, a type annotation, a function signature, a struct literal, a match-pattern head, an associated-function receiver — and every kind of item, named with the keyword the source would have written: function, struct, enum, const. A module binding is a const, so crossing a private one on the way to a public item behind it reports this same code against the binding.

Likely cause

A function, constant, type, enum, or module re-export needed by an external importer is missing pub; an associated function or variant belongs to a private enclosing type; or the caller was moved outside the defining directory.

Examples

Access a private function across directories

// --- main.rue
const lib = @import("sub/lib.rue");
fn main() -> i32 { lib.secret() }
// --- sub/lib.rue
fn secret() -> i32 { 42 }

Export the cross-directory member

// --- main.rue
const lib = @import("sub/lib.rue");
fn main() -> i32 { lib.answer() }
// --- sub/lib.rue
pub fn answer() -> i32 { 42 }

References